aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-06 22:57:34 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-09 10:11:25 +1000
commitbb66e6d578fdc68fb33d0fde921390d74f20bb31 (patch)
tree99d3763eee97acb870c16a762c0ee40af787c295 /sway/desktop/xdg_shell.c
parentMake main properties be the pending state (diff)
downloadsway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.tar.gz
sway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.tar.zst
sway-bb66e6d578fdc68fb33d0fde921390d74f20bb31.zip
Refactor everything that needs to arrange windows
* The arrange_foo functions are now replaced with arrange_and_commit, or with manually created transactions and arrange_windows x2. * The arrange functions are now only called from the highest level functions rather than from both high level and low level functions. * Due to the previous point, view_set_fullscreen_raw and view_set_fullscreen are both merged into one function again. * Floating and fullscreen are now working with transactions.
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index f43a0a1b..d22c967c 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -5,10 +5,10 @@
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"
9#include "sway/input/input-manager.h" 8#include "sway/input/input-manager.h"
10#include "sway/input/seat.h" 9#include "sway/input/seat.h"
11#include "sway/server.h" 10#include "sway/server.h"
11#include "sway/tree/arrange.h"
12#include "sway/tree/container.h" 12#include "sway/tree/container.h"
13#include "sway/tree/layout.h" 13#include "sway/tree/layout.h"
14#include "sway/tree/view.h" 14#include "sway/tree/view.h"
@@ -210,8 +210,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
210 view->natural_width = view->wlr_xdg_surface->surface->current->width; 210 view->natural_width = view->wlr_xdg_surface->surface->current->width;
211 view->natural_height = view->wlr_xdg_surface->surface->current->height; 211 view->natural_height = view->wlr_xdg_surface->surface->current->height;
212 } 212 }
213
213 view_map(view, view->wlr_xdg_surface->surface); 214 view_map(view, view->wlr_xdg_surface->surface);
214 215
216 if (xdg_surface->toplevel->client_pending.fullscreen) {
217 view_set_fullscreen(view, true);
218 }
219 arrange_and_commit(view->swayc->parent);
220
215 xdg_shell_view->commit.notify = handle_commit; 221 xdg_shell_view->commit.notify = handle_commit;
216 wl_signal_add(&xdg_surface->surface->events.commit, 222 wl_signal_add(&xdg_surface->surface->events.commit,
217 &xdg_shell_view->commit); 223 &xdg_shell_view->commit);
@@ -219,10 +225,6 @@ static void handle_map(struct wl_listener *listener, void *data) {
219 xdg_shell_view->new_popup.notify = handle_new_popup; 225 xdg_shell_view->new_popup.notify = handle_new_popup;
220 wl_signal_add(&xdg_surface->events.new_popup, 226 wl_signal_add(&xdg_surface->events.new_popup,
221 &xdg_shell_view->new_popup); 227 &xdg_shell_view->new_popup);
222
223 if (xdg_surface->toplevel->client_pending.fullscreen) {
224 view_set_fullscreen(view, true);
225 }
226} 228}
227 229
228static void handle_destroy(struct wl_listener *listener, void *data) { 230static void handle_destroy(struct wl_listener *listener, void *data) {
@@ -237,6 +239,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
237 struct wlr_xdg_toplevel_set_fullscreen_event *e = data; 239 struct wlr_xdg_toplevel_set_fullscreen_event *e = data;
238 struct wlr_xdg_surface *xdg_surface = 240 struct wlr_xdg_surface *xdg_surface =
239 xdg_shell_view->view.wlr_xdg_surface; 241 xdg_shell_view->view.wlr_xdg_surface;
242 struct sway_view *view = &xdg_shell_view->view;
240 243
241 if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL, 244 if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL,
242 "xdg_shell requested fullscreen of surface with role %i", 245 "xdg_shell requested fullscreen of surface with role %i",
@@ -247,7 +250,10 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
247 return; 250 return;
248 } 251 }
249 252
250 view_set_fullscreen(&xdg_shell_view->view, e->fullscreen); 253 view_set_fullscreen(view, e->fullscreen);
254
255 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
256 arrange_and_commit(ws);
251} 257}
252 258
253void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { 259void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {