From f704c3d42b80ad28bfd096e5467a5219c0778e3b Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 21 Jan 2018 22:08:38 +0100 Subject: [PATCH] rootston: fix damage tracking for fullscreen xwayland views --- rootston/output.c | 32 ++++++++++++++++++++++++++++---- xwayland/xwm.c | 2 +- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/rootston/output.c b/rootston/output.c index d2ea2ade..644fca92 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -121,8 +121,10 @@ static void view_for_each_surface(struct roots_view *view, view->y, view->rotation, false, iterator, user_data); break; case ROOTS_XWAYLAND_VIEW: - surface_for_each_surface(view->wlr_surface, view->x, view->y, - view->rotation, iterator, user_data); + if (view->wlr_surface != NULL) { + surface_for_each_surface(view->wlr_surface, view->x, view->y, + view->rotation, iterator, user_data); + } break; } } @@ -466,6 +468,28 @@ static void output_damage_whole(struct roots_output *output) { schedule_render(output); } +static bool view_accept_damage(struct roots_output *output, + struct roots_view *view) { + if (output->fullscreen_view == NULL) { + return true; + } + if (output->fullscreen_view == view) { + return true; + } + if (output->fullscreen_view->type == ROOTS_XWAYLAND_VIEW && + view->type == ROOTS_XWAYLAND_VIEW) { + // Special case: accept damage from children + struct wlr_xwayland_surface *xsurface = view->xwayland_surface; + while (xsurface != NULL) { + if (output->fullscreen_view->xwayland_surface == xsurface) { + return true; + } + xsurface = xsurface->parent; + } + } + return false; +} + static void damage_whole_surface(struct wlr_surface *surface, double lx, double ly, float rotation, void *data) { struct roots_output *output = data; @@ -489,7 +513,7 @@ static void damage_whole_surface(struct wlr_surface *surface, void output_damage_whole_view(struct roots_output *output, struct roots_view *view) { - if (output->fullscreen_view != NULL && output->fullscreen_view != view) { + if (!view_accept_damage(output, view)) { return; } @@ -524,7 +548,7 @@ static void damage_from_surface(struct wlr_surface *surface, void output_damage_from_view(struct roots_output *output, struct roots_view *view) { - if (output->fullscreen_view != NULL && output->fullscreen_view != view) { + if (!view_accept_damage(output, view)) { return; } diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 3bbaecfb..b9536d96 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -315,7 +315,7 @@ static void read_surface_parent(struct wlr_xwm *xwm, wl_list_init(&xsurface->parent_link); } - wlr_log(L_DEBUG, "XCB_ATOM_WM_TRANSIENT_FOR: %p", xid); + wlr_log(L_DEBUG, "XCB_ATOM_WM_TRANSIENT_FOR: %p", xsurface->parent); wl_signal_emit(&xsurface->events.set_parent, xsurface); }