diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-13 21:01:02 +0200 |
---|---|---|
committer | Rouven Czerwinski <rouven@czerwinskis.de> | 2018-10-16 15:47:02 +0200 |
commit | 892446a0b6eba9d14cdf7462c86565a7a60d12ae (patch) | |
tree | 1740c18381767afad7e13703d1cfa7b2e7f013dd /sway/tree/view.c | |
parent | 8dadfd42dff1531f793ad2f2c237a05c05f6d180 (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/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 26 |
1 files changed, 21 insertions, 5 deletions
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) { return len == 0; } -void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { +void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, + bool fullscreen, bool decoration) { if (!sway_assert(view->surface == NULL, "cannot map mapped view")) { return; } @@ -586,13 +587,28 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { } } - if (should_focus(view)) { - input_manager_set_focus(input_manager, &view->container->node); - } - view_update_title(view, false); container_update_representation(view->container); view_execute_criteria(view); + + if (decoration) { + view_update_csd_from_client(view, decoration); + } + + if (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); + } + } + + if (should_focus(view)) { + input_manager_set_focus(input_manager, &view->container->node); + } } void view_unmap(struct sway_view *view) { |