aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 7cdd97c8..7c417891 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -1,4 +1,3 @@
1#define _POSIX_C_SOURCE 199309L
2#include <float.h> 1#include <float.h>
3#include <stdbool.h> 2#include <stdbool.h>
4#include <stdlib.h> 3#include <stdlib.h>
@@ -36,6 +35,7 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
36 wl_list_remove(&popup->new_popup.link); 35 wl_list_remove(&popup->new_popup.link);
37 wl_list_remove(&popup->destroy.link); 36 wl_list_remove(&popup->destroy.link);
38 wl_list_remove(&popup->surface_commit.link); 37 wl_list_remove(&popup->surface_commit.link);
38 wl_list_remove(&popup->reposition.link);
39 wlr_scene_node_destroy(&popup->scene_tree->node); 39 wlr_scene_node_destroy(&popup->scene_tree->node);
40 free(popup); 40 free(popup);
41} 41}
@@ -71,6 +71,11 @@ static void popup_handle_surface_commit(struct wl_listener *listener, void *data
71 } 71 }
72} 72}
73 73
74static void popup_handle_reposition(struct wl_listener *listener, void *data) {
75 struct sway_xdg_popup *popup = wl_container_of(listener, popup, reposition);
76 popup_unconstrain(popup);
77}
78
74static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup, 79static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
75 struct sway_view *view, struct wlr_scene_tree *parent) { 80 struct sway_view *view, struct wlr_scene_tree *parent) {
76 struct wlr_xdg_surface *xdg_surface = wlr_popup->base; 81 struct wlr_xdg_surface *xdg_surface = wlr_popup->base;
@@ -97,8 +102,11 @@ static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
97 return NULL; 102 return NULL;
98 } 103 }
99 104
105 popup->desc.relative = &view->content_tree->node;
106 popup->desc.view = view;
107
100 if (!scene_descriptor_assign(&popup->scene_tree->node, 108 if (!scene_descriptor_assign(&popup->scene_tree->node,
101 SWAY_SCENE_DESC_POPUP, popup)) { 109 SWAY_SCENE_DESC_POPUP, &popup->desc)) {
102 sway_log(SWAY_ERROR, "Failed to allocate a popup scene descriptor"); 110 sway_log(SWAY_ERROR, "Failed to allocate a popup scene descriptor");
103 wlr_scene_node_destroy(&popup->scene_tree->node); 111 wlr_scene_node_destroy(&popup->scene_tree->node);
104 free(popup); 112 free(popup);
@@ -114,6 +122,8 @@ static struct sway_xdg_popup *popup_create(struct wlr_xdg_popup *wlr_popup,
114 popup->surface_commit.notify = popup_handle_surface_commit; 122 popup->surface_commit.notify = popup_handle_surface_commit;
115 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); 123 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
116 popup->new_popup.notify = popup_handle_new_popup; 124 popup->new_popup.notify = popup_handle_new_popup;
125 wl_signal_add(&wlr_popup->events.reposition, &popup->reposition);
126 popup->reposition.notify = popup_handle_reposition;
117 wl_signal_add(&wlr_popup->events.destroy, &popup->destroy); 127 wl_signal_add(&wlr_popup->events.destroy, &popup->destroy);
118 popup->destroy.notify = popup_handle_destroy; 128 popup->destroy.notify = popup_handle_destroy;
119 129
@@ -279,6 +289,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
279 } 289 }
280 // XXX: https://github.com/swaywm/sway/issues/2176 290 // XXX: https://github.com/swaywm/sway/issues/2176
281 wlr_xdg_surface_schedule_configure(xdg_surface); 291 wlr_xdg_surface_schedule_configure(xdg_surface);
292 // TODO: wlr_xdg_toplevel_set_bounds()
282 return; 293 return;
283 } 294 }
284 295
@@ -337,6 +348,7 @@ static void handle_set_app_id(struct wl_listener *listener, void *data) {
337 struct sway_xdg_shell_view *xdg_shell_view = 348 struct sway_xdg_shell_view *xdg_shell_view =
338 wl_container_of(listener, xdg_shell_view, set_app_id); 349 wl_container_of(listener, xdg_shell_view, set_app_id);
339 struct sway_view *view = &xdg_shell_view->view; 350 struct sway_view *view = &xdg_shell_view->view;
351 view_update_app_id(view);
340 view_execute_criteria(view); 352 view_execute_criteria(view);
341} 353}
342 354
@@ -563,4 +575,7 @@ void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data) {
563 wlr_scene_xdg_surface_create(xdg_shell_view->view.content_tree, xdg_toplevel->base); 575 wlr_scene_xdg_surface_create(xdg_shell_view->view.content_tree, xdg_toplevel->base);
564 576
565 xdg_toplevel->base->data = xdg_shell_view; 577 xdg_toplevel->base->data = xdg_shell_view;
578
579 wlr_xdg_toplevel_set_wm_capabilities(xdg_toplevel,
580 XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
566} 581}