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/desktop | |
parent | 8e4b6595786edf307623b9f1fcf3c7e5c8fa3833 (diff) |
Introduce surface_{enter,leave}_output()
We can centralize all output-related surface events from there.
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/layer_shell.c | 6 | ||||
-rw-r--r-- | sway/desktop/surface.c | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 6e3cc0e2..795eb4cd 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -13,6 +13,7 @@ #include "sway/layers.h" #include "sway/output.h" #include "sway/server.h" +#include "sway/surface.h" #include "sway/tree/arrange.h" #include "sway/tree/workspace.h" @@ -382,8 +383,7 @@ static void handle_map(struct wl_listener *listener, void *data) { struct sway_output *output = wlr_output->data; output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, sway_layer->layer_surface->surface, true); - wlr_surface_send_enter(sway_layer->layer_surface->surface, - sway_layer->layer_surface->output); + surface_enter_output(sway_layer->layer_surface->surface, output); cursor_rebase_all(); } @@ -510,7 +510,7 @@ static void popup_handle_map(struct wl_listener *listener, void *data) { struct sway_layer_surface *layer = popup_get_layer(popup); struct wlr_output *wlr_output = layer->layer_surface->output; sway_assert(wlr_output, "wlr_layer_surface_v1 has null output"); - wlr_surface_send_enter(popup->wlr_popup->base->surface, wlr_output); + surface_enter_output(popup->wlr_popup->base->surface, wlr_output->data); popup_damage(popup, true); } diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c index 1d7b536d..a5a18917 100644 --- a/sway/desktop/surface.c +++ b/sway/desktop/surface.c @@ -4,6 +4,7 @@ #include <wlr/types/wlr_compositor.h> #include "sway/server.h" #include "sway/surface.h" +#include "sway/output.h" static void handle_destroy(struct wl_listener *listener, void *data) { struct sway_surface *surface = wl_container_of(listener, surface, destroy); @@ -44,3 +45,13 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) { wl_resource_post_no_memory(wlr_surface->resource); } } + +void surface_enter_output(struct wlr_surface *surface, + struct sway_output *output) { + wlr_surface_send_enter(surface, output->wlr_output); +} + +void surface_leave_output(struct wlr_surface *surface, + struct sway_output *output) { + wlr_surface_send_leave(surface, output->wlr_output); +} |