aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-19 11:01:51 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-20 09:23:24 +1000
commit0f6d212629964c6a131b5675fa6c9f4d48da43aa (patch)
tree2dec4ff1e44ede939eb01927425c5da61e41ab5e /sway/tree/layout.c
parentMerge pull request #2493 from RyanDwyer/fix-popup-position (diff)
downloadsway-0f6d212629964c6a131b5675fa6c9f4d48da43aa.tar.gz
sway-0f6d212629964c6a131b5675fa6c9f4d48da43aa.tar.zst
sway-0f6d212629964c6a131b5675fa6c9f4d48da43aa.zip
Send output enter/leave events correctly
Previously we used a reparent event to detect when a view changes parent, then sent an output enter/leave to the surfaces if needed. This worked for tiling views but not floating views, as floating views can intersect another output without changing parent. The solution implemented for floating views also applies cleanly to tiling views, so the previous method has been completely replaced and the reparent event has been removed. This introduces a new function container_discover_outputs. This function compares the container's `current` position to the outputs, sends enter and leave events as needed, and keeps track of which outputs it's intersecting in a new `container->outputs` list. If it has entered a new output with a different scale then the title and marks textures will also be recreated at the new scale. The function is called when a transaction applies. This is convenient as it means we don't have to call it from various places. There is imperfect rendering when a floating view overlaps two outputs with different scales. It renders correctly for the most recently entered output, but there is only one title texture so it renders incorrectly on the old output. Fixes #2482
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 2f22a3dd..ee7d7418 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -75,7 +75,6 @@ void container_insert_child(struct sway_container *parent,
75 list_insert(parent->children, i, child); 75 list_insert(parent->children, i, child);
76 child->parent = parent; 76 child->parent = parent;
77 container_handle_fullscreen_reparent(child, old_parent); 77 container_handle_fullscreen_reparent(child, old_parent);
78 wl_signal_emit(&child->events.reparent, old_parent);
79} 78}
80 79
81struct sway_container *container_add_sibling(struct sway_container *fixed, 80struct sway_container *container_add_sibling(struct sway_container *fixed,
@@ -91,7 +90,6 @@ struct sway_container *container_add_sibling(struct sway_container *fixed,
91 list_insert(parent->children, i + 1, active); 90 list_insert(parent->children, i + 1, active);
92 active->parent = parent; 91 active->parent = parent;
93 container_handle_fullscreen_reparent(active, old_parent); 92 container_handle_fullscreen_reparent(active, old_parent);
94 wl_signal_emit(&active->events.reparent, old_parent);
95 return active->parent; 93 return active->parent;
96} 94}
97 95
@@ -181,8 +179,6 @@ void container_move_to(struct sway_container *container,
181 } 179 }
182 } 180 }
183 181
184 wl_signal_emit(&container->events.reparent, old_parent);
185
186 if (container->type == C_VIEW) { 182 if (container->type == C_VIEW) {
187 ipc_event_window(container, "move"); 183 ipc_event_window(container, "move");
188 } 184 }
@@ -307,7 +303,6 @@ static void workspace_rejigger(struct sway_container *ws,
307 303
308 container_flatten(ws); 304 container_flatten(ws);
309 container_reap_empty_recursive(original_parent); 305 container_reap_empty_recursive(original_parent);
310 wl_signal_emit(&child->events.reparent, original_parent);
311 container_create_notify(new_parent); 306 container_create_notify(new_parent);
312} 307}
313 308
@@ -859,7 +854,6 @@ struct sway_container *container_split(struct sway_container *child,
859 struct sway_container *ws_child = workspace->children->items[0]; 854 struct sway_container *ws_child = workspace->children->items[0];
860 container_remove_child(ws_child); 855 container_remove_child(ws_child);
861 container_add_child(cont, ws_child); 856 container_add_child(cont, ws_child);
862 wl_signal_emit(&ws_child->events.reparent, workspace);
863 } 857 }
864 858
865 container_add_child(workspace, cont); 859 container_add_child(workspace, cont);
@@ -867,11 +861,9 @@ struct sway_container *container_split(struct sway_container *child,
867 workspace->layout = layout; 861 workspace->layout = layout;
868 cont->layout = old_layout; 862 cont->layout = old_layout;
869 } else { 863 } else {
870 struct sway_container *old_parent = child->parent;
871 cont->layout = layout; 864 cont->layout = layout;
872 container_replace_child(child, cont); 865 container_replace_child(child, cont);
873 container_add_child(cont, child); 866 container_add_child(cont, child);
874 wl_signal_emit(&child->events.reparent, old_parent);
875 } 867 }
876 868
877 if (set_focus) { 869 if (set_focus) {