From c4dff67e000e3d97315610e033ea89b3dbad7c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 24 Apr 2018 08:51:32 +0200 Subject: [PATCH 1/2] layer-shell: use output_damage_{whole,from}_local_surface for popups Reuse what already handles rotation and scaling. This unbreaks popups on rotated or scaled outputs. --- rootston/layer_shell.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 071467e0..7b3e8a9d 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -297,11 +297,10 @@ static void popup_handle_map(struct wl_listener *listener, void *data) { struct roots_layer_surface *layer = popup->parent; struct wlr_output *wlr_output = layer->layer_surface->output; struct roots_output *output = wlr_output->data; - struct wlr_box geom; - memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); - geom.x += layer->geo.x; - geom.y += layer->geo.y; - wlr_output_damage_add_box(output->damage, &geom); + int ox = popup->wlr_popup->geometry.x + layer->geo.x; + int oy = popup->wlr_popup->geometry.y + layer->geo.y; + output_damage_whole_local_surface(output, popup->wlr_popup->base->surface, + ox, oy, 0); } static void popup_handle_unmap(struct wl_listener *listener, void *data) { @@ -309,11 +308,10 @@ static void popup_handle_unmap(struct wl_listener *listener, void *data) { struct roots_layer_surface *layer = popup->parent; struct wlr_output *wlr_output = layer->layer_surface->output; struct roots_output *output = wlr_output->data; - struct wlr_box geom; - memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); - geom.x += layer->geo.x; - geom.y += layer->geo.y; - wlr_output_damage_add_box(output->damage, &geom); + int ox = popup->wlr_popup->geometry.x + layer->geo.x; + int oy = popup->wlr_popup->geometry.y + layer->geo.y; + output_damage_whole_local_surface(output, popup->wlr_popup->base->surface, + ox, oy, 0); } static void popup_handle_commit(struct wl_listener *listener, void *data) { @@ -321,11 +319,10 @@ static void popup_handle_commit(struct wl_listener *listener, void *data) { struct roots_layer_surface *layer = popup->parent; struct wlr_output *wlr_output = layer->layer_surface->output; struct roots_output *output = wlr_output->data; - struct wlr_box geom; - memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); - geom.x += layer->geo.x; - geom.y += layer->geo.y; - wlr_output_damage_add_box(output->damage, &geom); + int ox = popup->wlr_popup->geometry.x + layer->geo.x; + int oy = popup->wlr_popup->geometry.y + layer->geo.y; + output_damage_from_local_surface(output, popup->wlr_popup->base->surface, + ox, oy, 0); } static void popup_handle_destroy(struct wl_listener *listener, void *data) { From 24fa07565d407d95414b803d0490c725dd242901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 24 Apr 2018 13:10:20 +0200 Subject: [PATCH 2/2] layer-shell: use output_damage_{whole,from}_local_surface on map/unmap These handle rotation and scaling --- rootston/layer_shell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 7b3e8a9d..836deb42 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -255,7 +255,8 @@ static void unmap(struct wlr_layer_surface *layer_surface) { struct wlr_output *wlr_output = layer_surface->output; if (wlr_output != NULL) { struct roots_output *output = wlr_output->data; - wlr_output_damage_add_box(output->damage, &layer->geo); + output_damage_whole_local_surface(output, layer_surface->surface, + layer->geo.x, layer->geo.y, 0); } } @@ -282,7 +283,8 @@ static void handle_map(struct wl_listener *listener, void *data) { struct roots_layer_surface *layer = layer_surface->data; struct wlr_output *wlr_output = layer_surface->output; struct roots_output *output = wlr_output->data; - wlr_output_damage_add_box(output->damage, &layer->geo); + output_damage_whole_local_surface(output, layer_surface->surface, + layer->geo.x, layer->geo.y, 0); wlr_surface_send_enter(layer_surface->surface, wlr_output); }