diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-08 15:25:14 +0100 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2023-02-10 20:36:15 +0100 |
commit | 1cab17ada243385798b3340f88144f64ac33ee63 (patch) | |
tree | efb573543dc226d9f35a26ff21481d61ad6ae717 /sway/tree/container.c | |
parent | Clarify documentation for window_rect (diff) | |
download | sway-1cab17ada243385798b3340f88144f64ac33ee63.tar.gz sway-1cab17ada243385798b3340f88144f64ac33ee63.tar.zst sway-1cab17ada243385798b3340f88144f64ac33ee63.zip |
Introduce surface_{enter,leave}_output()
We can centralize all output-related surface events from there.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index fa76dd6a..20701081 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "sway/ipc-server.h" | 18 | #include "sway/ipc-server.h" |
19 | #include "sway/output.h" | 19 | #include "sway/output.h" |
20 | #include "sway/server.h" | 20 | #include "sway/server.h" |
21 | #include "sway/surface.h" | ||
21 | #include "sway/tree/arrange.h" | 22 | #include "sway/tree/arrange.h" |
22 | #include "sway/tree/view.h" | 23 | #include "sway/tree/view.h" |
23 | #include "sway/tree/workspace.h" | 24 | #include "sway/tree/workspace.h" |
@@ -1265,14 +1266,14 @@ bool container_is_fullscreen_or_child(struct sway_container *container) { | |||
1265 | 1266 | ||
1266 | static void surface_send_enter_iterator(struct wlr_surface *surface, | 1267 | static void surface_send_enter_iterator(struct wlr_surface *surface, |
1267 | int x, int y, void *data) { | 1268 | int x, int y, void *data) { |
1268 | struct wlr_output *wlr_output = data; | 1269 | struct sway_output *output = data; |
1269 | wlr_surface_send_enter(surface, wlr_output); | 1270 | surface_enter_output(surface, output); |
1270 | } | 1271 | } |
1271 | 1272 | ||
1272 | static void surface_send_leave_iterator(struct wlr_surface *surface, | 1273 | static void surface_send_leave_iterator(struct wlr_surface *surface, |
1273 | int x, int y, void *data) { | 1274 | int x, int y, void *data) { |
1274 | struct wlr_output *wlr_output = data; | 1275 | struct sway_output *output = data; |
1275 | wlr_surface_send_leave(surface, wlr_output); | 1276 | surface_leave_output(surface, output); |
1276 | } | 1277 | } |
1277 | 1278 | ||
1278 | void container_discover_outputs(struct sway_container *con) { | 1279 | void container_discover_outputs(struct sway_container *con) { |
@@ -1298,7 +1299,7 @@ void container_discover_outputs(struct sway_container *con) { | |||
1298 | sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output); | 1299 | sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output); |
1299 | if (con->view) { | 1300 | if (con->view) { |
1300 | view_for_each_surface(con->view, | 1301 | view_for_each_surface(con->view, |
1301 | surface_send_enter_iterator, output->wlr_output); | 1302 | surface_send_enter_iterator, output); |
1302 | if (con->view->foreign_toplevel) { | 1303 | if (con->view->foreign_toplevel) { |
1303 | wlr_foreign_toplevel_handle_v1_output_enter( | 1304 | wlr_foreign_toplevel_handle_v1_output_enter( |
1304 | con->view->foreign_toplevel, output->wlr_output); | 1305 | con->view->foreign_toplevel, output->wlr_output); |
@@ -1310,7 +1311,7 @@ void container_discover_outputs(struct sway_container *con) { | |||
1310 | sway_log(SWAY_DEBUG, "Container %p left output %p", con, output); | 1311 | sway_log(SWAY_DEBUG, "Container %p left output %p", con, output); |
1311 | if (con->view) { | 1312 | if (con->view) { |
1312 | view_for_each_surface(con->view, | 1313 | view_for_each_surface(con->view, |
1313 | surface_send_leave_iterator, output->wlr_output); | 1314 | surface_send_leave_iterator, output); |
1314 | if (con->view->foreign_toplevel) { | 1315 | if (con->view->foreign_toplevel) { |
1315 | wlr_foreign_toplevel_handle_v1_output_leave( | 1316 | wlr_foreign_toplevel_handle_v1_output_leave( |
1316 | con->view->foreign_toplevel, output->wlr_output); | 1317 | con->view->foreign_toplevel, output->wlr_output); |