diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-17 15:57:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-17 15:57:13 +0200 |
commit | 765c80e5f7c36df77e9475a662648a0d87b93606 (patch) | |
tree | 21f28277ff5109d9f8ec196a12fc74bbb5dfd994 /sway/tree/view.c | |
parent | 8d56269d9c9f2a5914aeb8f37f5877eb05000906 (diff) | |
parent | 1f0aeae33591fb46b3f8a91ca91975daf2a8bbf9 (diff) |
Merge pull request #2820 from Emantor/fix-mouse-warping-container
Fix mouse warping container
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 1104af36..85998547 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -544,7 +544,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; } @@ -595,13 +596,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) { @@ -630,7 +646,16 @@ void view_unmap(struct sway_view *view) { struct sway_seat *seat; wl_list_for_each(seat, &input_manager->seats, link) { - cursor_send_pointer_motion(seat->cursor, 0, true); + if (config->mouse_warping == WARP_CONTAINER) { + struct sway_node *node = seat_get_focus(seat); + if (node && node->type == N_CONTAINER) { + cursor_warp_to_container(seat->cursor, node->sway_container); + } else if (node && node->type == N_WORKSPACE) { + cursor_warp_to_workspace(seat->cursor, node->sway_workspace); + } + } else { + cursor_send_pointer_motion(seat->cursor, 0, true); + } } transaction_commit_dirty(); |