aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/layer_shell.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-06 11:27:40 -0400
committeremersion <contact@emersion.fr>2018-04-06 11:45:40 -0400
commit516f5454adb3fc7dd2e02258251b7cb6d6949aa3 (patch)
tree22c6bdfa1f79224daca6403162d24acdf611a6f9 /sway/desktop/layer_shell.c
parentd447460c0153a76a0bc484bb9866cef658b3102f (diff)
Simplify damage tracking functions, use them in layer shell
Diffstat (limited to 'sway/desktop/layer_shell.c')
-rw-r--r--sway/desktop/layer_shell.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 663ec7ba..f841e5f1 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -229,33 +229,39 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
wl_container_of(listener, layer, surface_commit);
struct wlr_layer_surface *layer_surface = layer->layer_surface;
struct wlr_output *wlr_output = layer_surface->output;
- if (wlr_output != NULL) {
- struct sway_output *output = wlr_output->data;
- struct wlr_box old_geo = layer->geo;
- arrange_layers(output);
- if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) {
- // TODO DAMAGE apply whole surface from previous and new geos
- } else {
- // TODO DAMAGE from surface damage
- }
- wlr_output_damage_add_box(output->damage, &old_geo);
- wlr_output_damage_add_box(output->damage, &layer->geo);
+ if (wlr_output == NULL) {
+ return;
+ }
+
+ struct sway_output *output = wlr_output->data;
+ struct wlr_box old_geo = layer->geo;
+ arrange_layers(output);
+ if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) {
+ output_damage_surface(output, old_geo.x, old_geo.y,
+ layer_surface->surface, true);
+ output_damage_surface(output, layer->geo.x, layer->geo.y,
+ layer_surface->surface, true);
+ } else {
+ output_damage_surface(output, layer->geo.x, layer->geo.y,
+ layer_surface->surface, false);
}
}
static void unmap(struct sway_layer_surface *sway_layer) {
struct wlr_output *wlr_output = sway_layer->layer_surface->output;
- if (wlr_output != NULL) {
- struct sway_output *output = wlr_output->data;
- wlr_output_damage_add_box(output->damage, &sway_layer->geo);
+ if (wlr_output == NULL) {
+ return;
}
+ 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);
}
static void handle_destroy(struct wl_listener *listener, void *data) {
- struct sway_layer_surface *sway_layer = wl_container_of(listener,
- sway_layer, destroy);
+ struct sway_layer_surface *sway_layer =
+ wl_container_of(listener, sway_layer, destroy);
wlr_log(L_DEBUG, "Layer surface destroyed (%s)",
- sway_layer->layer_surface->namespace);
+ sway_layer->layer_surface->namespace);
if (sway_layer->layer_surface->mapped) {
unmap(sway_layer);
}
@@ -277,7 +283,9 @@ static void handle_map(struct wl_listener *listener, void *data) {
struct sway_layer_surface *sway_layer = wl_container_of(listener,
sway_layer, map);
struct sway_output *output = sway_layer->layer_surface->output->data;
- wlr_output_damage_add_box(output->damage, &sway_layer->geo);
+ output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y,
+ sway_layer->layer_surface->surface, true);
+ // TODO: send enter to subsurfaces and popups
wlr_surface_send_enter(sway_layer->layer_surface->surface,
sway_layer->layer_surface->output);
}