summaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorWilliam McKinnon <[email protected]>2022-04-26 21:44:51 -0400
committerGitHub <[email protected]>2022-04-26 21:44:51 -0400
commit4660771f6a25b93062df0698634059f893ae1999 (patch)
treeb7135d20119a42d8381fb65004f476750d6212fd /sway/tree/view.c
parentccda4dae0f9b77b9760d6fdf178e0f0e2571cde0 (diff)
parent5543acff06981639086bc9a0fc9b608796a23e84 (diff)
Merge pull request #1 from swaywm/v1.7
V1.7
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index ed8c50f8..8b7061ba 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -752,10 +752,29 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
}
struct sway_seat *seat = input_manager_current_seat();
- struct sway_node *node = ws ? seat_get_focus_inactive(seat, &ws->node)
- : seat_get_focus_inactive(seat, &root->node);
- struct sway_container *target_sibling = node->type == N_CONTAINER ?
- node->sway_container : NULL;
+ struct sway_node *node =
+ seat_get_focus_inactive(seat, ws ? &ws->node : &root->node);
+ struct sway_container *target_sibling = NULL;
+ if (node && node->type == N_CONTAINER) {
+ if (container_is_floating(node->sway_container)) {
+ // If we're about to launch the view into the floating container, then
+ // launch it as a tiled view instead.
+ if (ws) {
+ target_sibling = seat_get_focus_inactive_tiling(seat, ws);
+ if (target_sibling) {
+ struct sway_container *con =
+ seat_get_focus_inactive_view(seat, &target_sibling->node);
+ if (con) {
+ target_sibling = con;
+ }
+ }
+ } else {
+ ws = seat_get_last_known_workspace(seat);
+ }
+ } else {
+ target_sibling = node->sway_container;
+ }
+ }
view->foreign_toplevel =
wlr_foreign_toplevel_handle_v1_create(server.foreign_toplevel_manager);
@@ -776,13 +795,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
&view->foreign_minimize);
- // If we're about to launch the view into the floating container, then
- // launch it as a tiled view in the root of the workspace instead.
- if (target_sibling && container_is_floating(target_sibling)) {
- target_sibling = NULL;
- ws = seat_get_last_known_workspace(seat);
- }
-
struct sway_container *container = view->container;
if (target_sibling) {
container_add_sibling(target_sibling, container, 1);
@@ -1129,9 +1141,12 @@ void view_child_init(struct sway_view_child *child,
wl_signal_add(&view->events.unmap, &child->view_unmap);
child->view_unmap.notify = view_child_handle_view_unmap;
- struct sway_workspace *workspace = child->view->container->pending.workspace;
- if (workspace) {
- wlr_surface_send_enter(child->surface, workspace->output->wlr_output);
+ struct sway_container *container = child->view->container;
+ if (container != NULL) {
+ struct sway_workspace *workspace = container->pending.workspace;
+ if (workspace) {
+ wlr_surface_send_enter(child->surface, workspace->output->wlr_output);
+ }
}
view_child_init_subsurfaces(child, surface);