summaryrefslogtreecommitdiffstats
path: root/sway
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
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')
-rw-r--r--sway/desktop/xdg_shell.c20
-rw-r--r--sway/desktop/xdg_shell_v6.c23
-rw-r--r--sway/desktop/xwayland.c12
-rw-r--r--sway/tree/view.c26
4 files changed, 34 insertions, 47 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
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e613ac0b..bdd5f830 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -535,7 +535,8 @@ static bool should_focus(struct sway_view *view) {
535 return len == 0; 535 return len == 0;
536} 536}
537 537
538void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { 538void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
539 bool fullscreen, bool decoration) {
539 if (!sway_assert(view->surface == NULL, "cannot map mapped view")) { 540 if (!sway_assert(view->surface == NULL, "cannot map mapped view")) {
540 return; 541 return;
541 } 542 }
@@ -586,13 +587,28 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
586 } 587 }
587 } 588 }
588 589
589 if (should_focus(view)) {
590 input_manager_set_focus(input_manager, &view->container->node);
591 }
592
593 view_update_title(view, false); 590 view_update_title(view, false);
594 container_update_representation(view->container); 591 container_update_representation(view->container);
595 view_execute_criteria(view); 592 view_execute_criteria(view);
593
594 if (decoration) {
595 view_update_csd_from_client(view, decoration);
596 }
597
598 if (fullscreen) {
599 container_set_fullscreen(view->container, true);
600 arrange_workspace(view->container->workspace);
601 } else {
602 if (view->container->parent) {
603 arrange_container(view->container->parent);
604 } else if (view->container->workspace) {
605 arrange_workspace(view->container->workspace);
606 }
607 }
608
609 if (should_focus(view)) {
610 input_manager_set_focus(input_manager, &view->container->node);
611 }
596} 612}
597 613
598void view_unmap(struct sway_view *view) { 614void view_unmap(struct sway_view *view) {