aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2018-10-13 21:01:02 +0200
committerRouven Czerwinski <rouven@czerwinskis.de>2018-10-16 15:47:02 +0200
commit892446a0b6eba9d14cdf7462c86565a7a60d12ae (patch)
tree1740c18381767afad7e13703d1cfa7b2e7f013dd /sway/desktop
parent8dadfd42dff1531f793ad2f2c237a05c05f6d180 (diff)
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) {
view->natural_height = view->wlr_xdg_surface->surface->current.height;
}
- view_map(view, view->wlr_xdg_surface->surface);
+ bool csd = false;
if (!view->xdg_decoration) {
struct sway_server_decoration *deco =
- decoration_from_surface(xdg_surface->surface);
- bool csd = !deco || deco->wlr_server_decoration->mode ==
+ decoration_from_surface(xdg_surface->surface);
+ csd = !deco || deco->wlr_server_decoration->mode ==
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
- view_update_csd_from_client(view, csd);
- }
- if (xdg_surface->toplevel->client_pending.fullscreen) {
- container_set_fullscreen(view->container, true);
- arrange_workspace(view->container->workspace);
- } else {
- if (view->container->parent) {
- arrange_container(view->container->parent);
- } else if (view->container->workspace) {
- arrange_workspace(view->container->workspace);
- }
}
+ view_map(view, view->wlr_xdg_surface->surface,
+ xdg_surface->toplevel->client_pending.fullscreen, csd);
+
transaction_commit_dirty();
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) {
view->natural_width = view->wlr_xdg_surface_v6->surface->current.width;
view->natural_height = view->wlr_xdg_surface_v6->surface->current.height;
}
+ struct sway_server_decoration *deco =
+ decoration_from_surface(xdg_surface->surface);
+ bool csd = !deco || deco->wlr_server_decoration->mode
+ == WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
- view_map(view, view->wlr_xdg_surface_v6->surface);
+ view_map(view, view->wlr_xdg_surface_v6->surface,
+ xdg_surface->toplevel->client_pending.fullscreen, csd);
- struct sway_server_decoration *deco =
- decoration_from_surface(xdg_surface->surface);
- bool csd = !deco || deco->wlr_server_decoration->mode ==
- WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
- view_update_csd_from_client(view, csd);
-
- if (xdg_surface->toplevel->client_pending.fullscreen) {
- container_set_fullscreen(view->container, true);
- arrange_workspace(view->container->workspace);
- } else {
- if (view->container->parent) {
- arrange_container(view->container->parent);
- } else if (view->container->workspace) {
- arrange_workspace(view->container->workspace);
- }
- }
transaction_commit_dirty();
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) {
xwayland_view->commit.notify = handle_commit;
// Put it back into the tree
- view_map(view, xsurface->surface);
+ view_map(view, xsurface->surface, xsurface->fullscreen, false);
- if (xsurface->fullscreen) {
- container_set_fullscreen(view->container, true);
- arrange_workspace(view->container->workspace);
- } else {
- if (view->container->parent) {
- arrange_container(view->container->parent);
- } else if (view->container->workspace) {
- arrange_workspace(view->container->workspace);
- }
- }
transaction_commit_dirty();
}