[PATCH weston v3 05/13] shell: enable moving and resizing of a surface when clicking on a subsurface

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 25 03:57:45 PDT 2013


From: Giulio Camuffo <giuliocamuffo at gmail.com>

[pq: changed to weston_surface_get_main_surface(), and used a temporary
variable to clean up the expressions.]

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/shell.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 99949b7..86bdd84 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1108,10 +1108,16 @@ shell_surface_move(struct wl_client *client, struct wl_resource *resource,
 {
 	struct weston_seat *ws = seat_resource->data;
 	struct shell_surface *shsurf = resource->data;
+	struct weston_surface *focus;
+	struct weston_surface *surface;
+
+	focus = container_of(ws->seat.pointer->focus,
+			     struct weston_surface, surface);
+	surface = weston_surface_get_main_surface(focus);
 
 	if (ws->seat.pointer->button_count == 0 ||
 	    ws->seat.pointer->grab_serial != serial ||
-	    ws->seat.pointer->focus != &shsurf->surface->surface)
+	    surface != shsurf->surface)
 		return;
 
 	if (surface_move(shsurf, ws) < 0)
@@ -1232,13 +1238,19 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
 {
 	struct weston_seat *ws = seat_resource->data;
 	struct shell_surface *shsurf = resource->data;
+	struct weston_surface *focus;
+	struct weston_surface *surface;
+
+	focus = container_of(ws->seat.pointer->focus,
+			     struct weston_surface, surface);
+	surface = weston_surface_get_main_surface(focus);
 
 	if (shsurf->type == SHELL_SURFACE_FULLSCREEN)
 		return;
 
 	if (ws->seat.pointer->button_count == 0 ||
 	    ws->seat.pointer->grab_serial != serial ||
-	    ws->seat.pointer->focus != &shsurf->surface->surface)
+	    surface != shsurf->surface)
 		return;
 
 	if (surface_resize(shsurf, ws, edges) < 0)
-- 
1.8.1.5



More information about the wayland-devel mailing list