[PATCH weston v2 19/24] xwm: split out weston_wm_window_set_pending_state_OR()

Pekka Paalanen ppaalanen at gmail.com
Wed Dec 21 14:40:17 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

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 <pekka.paalanen at collabora.co.uk>
---
 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 faeb9dd..4127fa9 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1215,27 +1215,38 @@ weston_wm_window_do_repaint(void *data)
 }
 
 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;
 	}
 
-- 
2.10.2



More information about the wayland-devel mailing list