aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2018-10-13 21:01:02 +0200
committerLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2018-10-16 15:47:02 +0200
commit892446a0b6eba9d14cdf7462c86565a7a60d12ae (patch)
tree1740c18381767afad7e13703d1cfa7b2e7f013dd /sway/desktop
parentMerge pull request #2817 from trmendes/libinput-disable-touchscreen-support (diff)
downloadsway-892446a0b6eba9d14cdf7462c86565a7a60d12ae.tar.gz
sway-892446a0b6eba9d14cdf7462c86565a7a60d12ae.tar.zst
sway-892446a0b6eba9d14cdf7462c86565a7a60d12ae.zip
view: move arrange_workspace into view_map
For mouse_warping cursor to correctly work on newly spawned containers, the workspace needs to be arranged before the cursor is warped. The shell functions each implement their own fullscreen and arrange checks, move them into the view_map function and pass their states via boolean arguments. Fixes #2819
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xdg_shell.c20
-rw-r--r--sway/desktop/xdg_shell_v6.c23
-rw-r--r--sway/desktop/xwayland.c12
3 files changed, 13 insertions, 42 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 46582204..1ed45a6b 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -406,27 +406,19 @@ static void handle_map(struct wl_listener *listener, void *data) {
406 view->natural_height = view->wlr_xdg_surface->surface->current.height; 406 view->natural_height = view->wlr_xdg_surface->surface->current.height;
407 } 407 }
408 408
409 view_map(view, view->wlr_xdg_surface->surface); 409 bool csd = false;
410 410
411 if (!view->xdg_decoration) { 411 if (!view->xdg_decoration) {
412 struct sway_server_decoration *deco = 412 struct sway_server_decoration *deco =
413 decoration_from_surface(xdg_surface->surface); 413 decoration_from_surface(xdg_surface->surface);
414 bool csd = !deco || deco->wlr_server_decoration->mode == 414 csd = !deco || deco->wlr_server_decoration->mode ==
415 WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; 415 WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
416 view_update_csd_from_client(view, csd);
417 }
418 416
419 if (xdg_surface->toplevel->client_pending.fullscreen) {
420 container_set_fullscreen(view->container, true);
421 arrange_workspace(view->container->workspace);
422 } else {
423 if (view->container->parent) {
424 arrange_container(view->container->parent);
425 } else if (view->container->workspace) {
426 arrange_workspace(view->container->workspace);
427 }
428 } 417 }
429 418
419 view_map(view, view->wlr_xdg_surface->surface,
420 xdg_surface->toplevel->client_pending.fullscreen, csd);
421
430 transaction_commit_dirty(); 422 transaction_commit_dirty();
431 423
432 xdg_shell_view->commit.notify = handle_commit; 424 xdg_shell_view->commit.notify = handle_commit;
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 165cc7eb..eb8ba853 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -402,25 +402,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
402 view->natural_width = view->wlr_xdg_surface_v6->surface->current.width; 402 view->natural_width = view->wlr_xdg_surface_v6->surface->current.width;
403 view->natural_height = view->wlr_xdg_surface_v6->surface->current.height; 403 view->natural_height = view->wlr_xdg_surface_v6->surface->current.height;
404 } 404 }
405 struct sway_server_decoration *deco =
406 decoration_from_surface(xdg_surface->surface);
407 bool csd = !deco || deco->wlr_server_decoration->mode
408 == WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
405 409
406 view_map(view, view->wlr_xdg_surface_v6->surface); 410 view_map(view, view->wlr_xdg_surface_v6->surface,
411 xdg_surface->toplevel->client_pending.fullscreen, csd);
407 412
408 struct sway_server_decoration *deco =
409 decoration_from_surface(xdg_surface->surface);
410 bool csd = !deco || deco->wlr_server_decoration->mode ==
411 WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
412 view_update_csd_from_client(view, csd);
413
414 if (xdg_surface->toplevel->client_pending.fullscreen) {
415 container_set_fullscreen(view->container, true);
416 arrange_workspace(view->container->workspace);
417 } else {
418 if (view->container->parent) {
419 arrange_container(view->container->parent);
420 } else if (view->container->workspace) {
421 arrange_workspace(view->container->workspace);
422 }
423 }
424 transaction_commit_dirty(); 413 transaction_commit_dirty();
425 414
426 xdg_shell_v6_view->commit.notify = handle_commit; 415 xdg_shell_v6_view->commit.notify = handle_commit;
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index ebf2131e..066556b8 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -405,18 +405,8 @@ static void handle_map(struct wl_listener *listener, void *data) {
405 xwayland_view->commit.notify = handle_commit; 405 xwayland_view->commit.notify = handle_commit;
406 406
407 // Put it back into the tree 407 // Put it back into the tree
408 view_map(view, xsurface->surface); 408 view_map(view, xsurface->surface, xsurface->fullscreen, false);
409 409
410 if (xsurface->fullscreen) {
411 container_set_fullscreen(view->container, true);
412 arrange_workspace(view->container->workspace);
413 } else {
414 if (view->container->parent) {
415 arrange_container(view->container->parent);
416 } else if (view->container->workspace) {
417 arrange_workspace(view->container->workspace);
418 }
419 }
420 transaction_commit_dirty(); 410 transaction_commit_dirty();
421} 411}
422 412