[PATCH 2/2] Do resize anchoring on the client, not the server

Jasper St. Pierre jstpierre at mecheye.net
Mon Feb 10 10:22:35 PST 2014


The client had logic to adjust the dx/dy parameter of the window when
resizing, but it was broken: nothing enabled that code, and it would only
work for the first resize.

To make up for it, desktop-shell had code to flat out ignore the dx/dy
parameters when resizing and anchor it its own way. This is undocumented
and weird, and doesn't match what other compositors and toolkits do.

Remove the code in desktop-shell for this, and fix the client code to
work properly.
---
 clients/window.c      |  3 +--
 desktop-shell/shell.c | 10 ----------
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index fad4793..fa324b2 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1410,8 +1410,6 @@ window_create_main_surface(struct window *window)
 		dy = surface->server_allocation.height -
 			surface->allocation.height;
 
-	window->resize_edges = 0;
-
 	surface_create_surface(surface, dx, dy, flags);
 }
 
@@ -2385,6 +2383,7 @@ frame_handle_status(struct window_frame *frame, struct input *input,
 		input_ungrab(input);
 
 		window->resizing = 1;
+		window->resize_edges = location;
 		xdg_surface_resize(window->xdg_surface,
 				   input_get_seat(input),
 				   window->display->serial,
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a73e8e0..874ab98 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4856,16 +4856,6 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 		float from_x, from_y;
 		float to_x, to_y;
 
-		if (shsurf->resize_edges) {
-			sx = 0;
-			sy = 0;
-		}
-
-		if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
-			sx = shsurf->last_width - es->width;
-		if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
-			sy = shsurf->last_height - es->height;
-
 		shsurf->last_width = es->width;
 		shsurf->last_height = es->height;
 
-- 
1.8.5.3



More information about the wayland-devel mailing list