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.
This commit is contained in:
Guido Günther 2018-04-24 08:51:32 +02:00
parent c0831344aa
commit c4dff67e00

View file

@ -297,11 +297,10 @@ static void popup_handle_map(struct wl_listener *listener, void *data) {
struct roots_layer_surface *layer = popup->parent; struct roots_layer_surface *layer = popup->parent;
struct wlr_output *wlr_output = layer->layer_surface->output; struct wlr_output *wlr_output = layer->layer_surface->output;
struct roots_output *output = wlr_output->data; struct roots_output *output = wlr_output->data;
struct wlr_box geom; int ox = popup->wlr_popup->geometry.x + layer->geo.x;
memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); int oy = popup->wlr_popup->geometry.y + layer->geo.y;
geom.x += layer->geo.x; output_damage_whole_local_surface(output, popup->wlr_popup->base->surface,
geom.y += layer->geo.y; ox, oy, 0);
wlr_output_damage_add_box(output->damage, &geom);
} }
static void popup_handle_unmap(struct wl_listener *listener, void *data) { 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 roots_layer_surface *layer = popup->parent;
struct wlr_output *wlr_output = layer->layer_surface->output; struct wlr_output *wlr_output = layer->layer_surface->output;
struct roots_output *output = wlr_output->data; struct roots_output *output = wlr_output->data;
struct wlr_box geom; int ox = popup->wlr_popup->geometry.x + layer->geo.x;
memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); int oy = popup->wlr_popup->geometry.y + layer->geo.y;
geom.x += layer->geo.x; output_damage_whole_local_surface(output, popup->wlr_popup->base->surface,
geom.y += layer->geo.y; ox, oy, 0);
wlr_output_damage_add_box(output->damage, &geom);
} }
static void popup_handle_commit(struct wl_listener *listener, void *data) { 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 roots_layer_surface *layer = popup->parent;
struct wlr_output *wlr_output = layer->layer_surface->output; struct wlr_output *wlr_output = layer->layer_surface->output;
struct roots_output *output = wlr_output->data; struct roots_output *output = wlr_output->data;
struct wlr_box geom; int ox = popup->wlr_popup->geometry.x + layer->geo.x;
memcpy(&geom, &popup->wlr_popup->geometry, sizeof(struct wlr_box)); int oy = popup->wlr_popup->geometry.y + layer->geo.y;
geom.x += layer->geo.x; output_damage_from_local_surface(output, popup->wlr_popup->base->surface,
geom.y += layer->geo.y; ox, oy, 0);
wlr_output_damage_add_box(output->damage, &geom);
} }
static void popup_handle_destroy(struct wl_listener *listener, void *data) { static void popup_handle_destroy(struct wl_listener *listener, void *data) {