From ed56883970b89ffb11756d22be26d206f7e4a780 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 20 Dec 2016 14:05:03 +0200 Subject: [PATCH] xwm: split out weston_wm_window_set_pending_state_OR() Having it in a separate function makes it more clear what it is, and allows it to be called from elsewhere. This really is the set_pending_state() alternative for override-redirect windows, because OR windows do not get a frame window created. Also OR windows will never hit the normal set_pending_state() because weston_wm_window_schedule_repaint() special-cased windows without a frame window and returned early without scheduling. Signed-off-by: Pekka Paalanen Reviewed-by: Daniel Stone --- xwayland/window-manager.c | 43 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index e876de62..a2ce7821 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -1216,28 +1216,39 @@ weston_wm_window_do_repaint(void *data) weston_wm_window_set_pending_state(window); } +static void +weston_wm_window_set_pending_state_OR(struct weston_wm_window *window) +{ + int width, height; + + /* for override-redirect windows */ + assert(window->frame_id == XCB_WINDOW_NONE); + + if (!window->surface) + return; + + weston_wm_window_get_frame_size(window, &width, &height); + pixman_region32_fini(&window->surface->pending.opaque); + if (window->has_alpha) { + pixman_region32_init(&window->surface->pending.opaque); + } else { + pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0, + width, height); + } +} + static void weston_wm_window_schedule_repaint(struct weston_wm_window *window) { struct weston_wm *wm = window->wm; - int width, height; if (window->frame_id == XCB_WINDOW_NONE) { - if (window->surface != NULL) { - /* Override-redirect windows go through here, but we - * cannot assert(window->override_redirect); because - * we do not deal with changing OR flag yet. - * XXX: handle OR flag changes in message handlers - */ - weston_wm_window_get_frame_size(window, &width, &height); - pixman_region32_fini(&window->surface->pending.opaque); - if (window->has_alpha) { - pixman_region32_init(&window->surface->pending.opaque); - } else { - pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0, - width, height); - } - } + /* Override-redirect windows go through here, but we + * cannot assert(window->override_redirect); because + * we do not deal with changing OR flag yet. + * XXX: handle OR flag changes in message handlers + */ + weston_wm_window_set_pending_state_OR(window); return; }