diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-03 16:35:06 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-09 10:08:43 +1000 |
commit | 59c94887018bdfa578c4371c4275061ca6e71b3e (patch) | |
tree | 62bdaa6ac4777d1fcb292013bddd2043dad7765a /sway/desktop/xdg_shell.c | |
parent | Merge pull request #2115 from RedSoxFan/restore-workspaces (diff) | |
download | sway-59c94887018bdfa578c4371c4275061ca6e71b3e.tar.gz sway-59c94887018bdfa578c4371c4275061ca6e71b3e.tar.zst sway-59c94887018bdfa578c4371c4275061ca6e71b3e.zip |
WIP: Atomic layout updates ground work
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index d2b8822c..f43a0a1b 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <wlr/types/wlr_xdg_shell.h> | 5 | #include <wlr/types/wlr_xdg_shell.h> |
6 | #include <wlr/util/edges.h> | 6 | #include <wlr/util/edges.h> |
7 | #include "log.h" | 7 | #include "log.h" |
8 | #include "sway/desktop/transaction.h" | ||
8 | #include "sway/input/input-manager.h" | 9 | #include "sway/input/input-manager.h" |
9 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
10 | #include "sway/server.h" | 11 | #include "sway/server.h" |
@@ -87,18 +88,14 @@ static const char *get_string_prop(struct sway_view *view, enum sway_view_prop p | |||
87 | } | 88 | } |
88 | } | 89 | } |
89 | 90 | ||
90 | static void configure(struct sway_view *view, double lx, double ly, int width, | 91 | static uint32_t configure(struct sway_view *view, double lx, double ly, |
91 | int height) { | 92 | int width, int height) { |
92 | struct sway_xdg_shell_view *xdg_shell_view = | 93 | struct sway_xdg_shell_view *xdg_shell_view = |
93 | xdg_shell_view_from_view(view); | 94 | xdg_shell_view_from_view(view); |
94 | if (xdg_shell_view == NULL) { | 95 | if (xdg_shell_view == NULL) { |
95 | return; | 96 | return 0; |
96 | } | 97 | } |
97 | 98 | return wlr_xdg_toplevel_set_size(view->wlr_xdg_surface, width, height); | |
98 | xdg_shell_view->pending_width = width; | ||
99 | xdg_shell_view->pending_height = height; | ||
100 | wlr_xdg_toplevel_set_size(view->wlr_xdg_surface, width, height); | ||
101 | view_update_position(view, lx, ly); | ||
102 | } | 99 | } |
103 | 100 | ||
104 | static void set_activated(struct sway_view *view, bool activated) { | 101 | static void set_activated(struct sway_view *view, bool activated) { |
@@ -174,18 +171,12 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
174 | struct sway_xdg_shell_view *xdg_shell_view = | 171 | struct sway_xdg_shell_view *xdg_shell_view = |
175 | wl_container_of(listener, xdg_shell_view, commit); | 172 | wl_container_of(listener, xdg_shell_view, commit); |
176 | struct sway_view *view = &xdg_shell_view->view; | 173 | struct sway_view *view = &xdg_shell_view->view; |
177 | if (view->swayc && container_is_floating(view->swayc)) { | 174 | struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface; |
178 | int width = view->wlr_xdg_surface->geometry.width; | 175 | |
179 | int height = view->wlr_xdg_surface->geometry.height; | 176 | if (view->instructions->length) { |
180 | if (!width && !height) { | 177 | transaction_notify_view_ready(view, xdg_surface->configure_serial); |
181 | width = view->wlr_xdg_surface->surface->current->width; | ||
182 | height = view->wlr_xdg_surface->surface->current->height; | ||
183 | } | ||
184 | view_update_size(view, width, height); | ||
185 | } else { | ||
186 | view_update_size(view, xdg_shell_view->pending_width, | ||
187 | xdg_shell_view->pending_height); | ||
188 | } | 178 | } |
179 | |||
189 | view_update_title(view, false); | 180 | view_update_title(view, false); |
190 | view_damage_from(view); | 181 | view_damage_from(view); |
191 | } | 182 | } |