[PATCH weston 11/11] XWayland: Move surfaces through X when we reconfigure

Daniel Stone daniel at fooishbar.org
Tue Nov 6 22:51:45 PST 2012


When we're resizing from the top or left, send the new window size
through the X server as well, so it can handle the move and resize with
one atomic attach.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/xwayland/window-manager.c |   39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 3ceff63..bdc1c4e 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -538,7 +538,6 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
 	xcb_configure_notify_event_t *configure_notify = 
 		(xcb_configure_notify_event_t *) event;
 	struct weston_wm_window *window;
-	int x, y;
 
 	window = hash_table_lookup(wm->window_hash, configure_notify->window);
 
@@ -547,14 +546,6 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
 		configure_notify->window,
 		configure_notify->x, configure_notify->y,
 		configure_notify->width, configure_notify->height);
-
-	/* resize falls here */
-	if (configure_notify->window != window->id)
-		return;
-
-	weston_wm_window_get_child_position(window, &x, &y);
-	window->x = configure_notify->x - x;
-	window->y = configure_notify->y - y;
 }
 
 static void
@@ -1576,10 +1567,14 @@ weston_wm_window_configure(void *data)
 			     values);
 
 	weston_wm_window_get_frame_size(window, &width, &height);
-	values[0] = width;
-	values[1] = height;
+	values[0] = window->x;
+	values[1] = window->y;
+	values[2] = width;
+	values[3] = height;
 	xcb_configure_window(wm->conn,
 			     window->frame_id,
+			     XCB_CONFIG_WINDOW_X |
+			     XCB_CONFIG_WINDOW_Y |
 			     XCB_CONFIG_WINDOW_WIDTH |
 			     XCB_CONFIG_WINDOW_HEIGHT,
 			     values);
@@ -1596,16 +1591,30 @@ send_configure(struct weston_surface *surface,
 	struct weston_wm_window *window = get_wm_window(surface);
 	struct weston_wm *wm = window->wm;
 	struct theme *t = window->wm->theme;
+	int new_width, new_height;
+	int old_x = window->x, old_y = window->y;
 
 	if (window->decorate) {
-		window->width = width - 2 * (t->margin + t->width);
-		window->height = height - 2 * t->margin -
+		new_width = width - 2 * (t->margin + t->width);
+		new_height = height - 2 * t->margin -
 			t->titlebar_height - t->width;
 	} else {
-		window->width = width - 2 * t->margin;
-		window->height = height - 2 * t->margin;
+		new_width = width - 2 * t->margin;
+		new_height = height - 2 * t->margin;
 	}
 
+	if (edges == THEME_LOCATION_RESIZING_LEFT ||
+	    edges == THEME_LOCATION_RESIZING_TOP_LEFT ||
+	    edges == THEME_LOCATION_RESIZING_BOTTOM_LEFT)
+		window->x -= (new_width - window->width);
+	if (edges == THEME_LOCATION_RESIZING_TOP ||
+	    edges == THEME_LOCATION_RESIZING_TOP_LEFT ||
+	    edges == THEME_LOCATION_RESIZING_TOP_RIGHT)
+		window->y -= (new_height - window->height);
+
+	window->width = new_width;
+	window->height = new_height;
+
 	if (window->configure_source)
 		return;
 
-- 
1.7.10.4



More information about the wayland-devel mailing list