mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
xdg-{toplevel,popup}: extract destructors
This commit is contained in:
parent
edfb332b24
commit
b5b15b2625
4 changed files with 15 additions and 6 deletions
|
@ -31,11 +31,13 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
|
||||||
struct wlr_xdg_surface *parent,
|
struct wlr_xdg_surface *parent,
|
||||||
struct wlr_xdg_positioner_resource *positioner, uint32_t id);
|
struct wlr_xdg_positioner_resource *positioner, uint32_t id);
|
||||||
void unmap_xdg_popup(struct wlr_xdg_popup *popup);
|
void unmap_xdg_popup(struct wlr_xdg_popup *popup);
|
||||||
|
void destroy_xdg_popup(struct wlr_xdg_popup *popup);
|
||||||
void handle_xdg_popup_committed(struct wlr_xdg_popup *popup);
|
void handle_xdg_popup_committed(struct wlr_xdg_popup *popup);
|
||||||
|
|
||||||
void create_xdg_toplevel(struct wlr_xdg_surface *surface,
|
void create_xdg_toplevel(struct wlr_xdg_surface *surface,
|
||||||
uint32_t id);
|
uint32_t id);
|
||||||
void unmap_xdg_toplevel(struct wlr_xdg_toplevel *toplevel);
|
void unmap_xdg_toplevel(struct wlr_xdg_toplevel *toplevel);
|
||||||
|
void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel);
|
||||||
void handle_xdg_toplevel_committed(struct wlr_xdg_toplevel *toplevel);
|
void handle_xdg_toplevel_committed(struct wlr_xdg_toplevel *toplevel);
|
||||||
struct wlr_xdg_toplevel_configure *send_xdg_toplevel_configure(
|
struct wlr_xdg_toplevel_configure *send_xdg_toplevel_configure(
|
||||||
struct wlr_xdg_toplevel *toplevel);
|
struct wlr_xdg_toplevel *toplevel);
|
||||||
|
|
|
@ -389,6 +389,12 @@ void unmap_xdg_popup(struct wlr_xdg_popup *popup) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroy_xdg_popup(struct wlr_xdg_popup *popup) {
|
||||||
|
wl_list_remove(&popup->link);
|
||||||
|
wl_resource_set_user_data(popup->resource, NULL);
|
||||||
|
free(popup);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_xdg_popup_destroy(struct wlr_xdg_popup *popup) {
|
void wlr_xdg_popup_destroy(struct wlr_xdg_popup *popup) {
|
||||||
if (popup == NULL) {
|
if (popup == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -411,15 +411,11 @@ void reset_xdg_surface(struct wlr_xdg_surface *surface) {
|
||||||
|
|
||||||
switch (surface->role) {
|
switch (surface->role) {
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
wl_resource_set_user_data(surface->toplevel->resource, NULL);
|
destroy_xdg_toplevel(surface->toplevel);
|
||||||
free(surface->toplevel);
|
|
||||||
surface->toplevel = NULL;
|
surface->toplevel = NULL;
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
wl_list_remove(&surface->popup->link);
|
destroy_xdg_popup(surface->popup);
|
||||||
|
|
||||||
wl_resource_set_user_data(surface->popup->resource, NULL);
|
|
||||||
free(surface->popup);
|
|
||||||
surface->popup = NULL;
|
surface->popup = NULL;
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_NONE:
|
case WLR_XDG_SURFACE_ROLE_NONE:
|
||||||
|
|
|
@ -493,6 +493,11 @@ void unmap_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) {
|
||||||
toplevel->requested.minimized = false;
|
toplevel->requested.minimized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) {
|
||||||
|
wl_resource_set_user_data(toplevel->resource, NULL);
|
||||||
|
free(toplevel);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_xdg_toplevel_send_close(struct wlr_xdg_toplevel *toplevel) {
|
void wlr_xdg_toplevel_send_close(struct wlr_xdg_toplevel *toplevel) {
|
||||||
xdg_toplevel_send_close(toplevel->resource);
|
xdg_toplevel_send_close(toplevel->resource);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue