diff options
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 8f1885c1..94682fcd 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -29,9 +29,24 @@ static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | static void set_dimensions(struct sway_view *view, int width, int height) { | 31 | static void set_dimensions(struct sway_view *view, int width, int height) { |
32 | if (assert_xdg(view)) { | 32 | if (!assert_xdg(view)) { |
33 | wlr_xdg_toplevel_v6_set_size(view->wlr_xdg_surface_v6, width, height); | 33 | return; |
34 | } | 34 | } |
35 | view->sway_xdg_surface_v6->pending_width = width; | ||
36 | view->sway_xdg_surface_v6->pending_height = height; | ||
37 | wlr_xdg_toplevel_v6_set_size(view->wlr_xdg_surface_v6, width, height); | ||
38 | } | ||
39 | |||
40 | static void handle_commit(struct wl_listener *listener, void *data) { | ||
41 | struct sway_xdg_surface_v6 *sway_surface = | ||
42 | wl_container_of(listener, sway_surface, commit); | ||
43 | struct sway_view *view = sway_surface->view; | ||
44 | sway_log(L_DEBUG, "xdg surface commit %dx%d", | ||
45 | sway_surface->pending_width, sway_surface->pending_height); | ||
46 | // NOTE: We intentionally discard the view's desired width here | ||
47 | // TODO: Don't do that for floating views | ||
48 | view->width = sway_surface->pending_width; | ||
49 | view->height = sway_surface->pending_height; | ||
35 | } | 50 | } |
36 | 51 | ||
37 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 52 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |
@@ -72,6 +87,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
72 | // - Look up pid and open on appropriate workspace | 87 | // - Look up pid and open on appropriate workspace |
73 | // - Set new view to maximized so it behaves nicely | 88 | // - Set new view to maximized so it behaves nicely |
74 | // - Criteria | 89 | // - Criteria |
90 | |||
91 | sway_surface->commit.notify = handle_commit; | ||
92 | wl_signal_add(&xdg_surface->events.commit, &sway_surface->commit); | ||
75 | 93 | ||
76 | // TODO: actual focus semantics | 94 | // TODO: actual focus semantics |
77 | swayc_t *parent = root_container.children->items[0]; | 95 | swayc_t *parent = root_container.children->items[0]; |