From 0831b750d5bcb00419d2c6189db53c0cb9de755a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 14 Feb 2013 21:31:44 -0500 Subject: [PATCH] shell: Add back ability to rotate unresponsive surfaces When a surface in deemed unresponsive and we trigger the busy cursor, it's no longer possible to rotate the surface. This is clearly unacceptable. This patch adds handling of right clicks to the busy grab so that we can continue to rotate a surface even if the client is sleeping. https://bugs.freedesktop.org/show_bug.cgi?id=60609 --- src/shell.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/shell.c b/src/shell.c index 831b12568..5aea485d7 100644 --- a/src/shell.c +++ b/src/shell.c @@ -238,6 +238,9 @@ get_shell_surface(struct weston_surface *surface); static struct desktop_shell * shell_surface_get_shell(struct shell_surface *shsurf); +static void +surface_rotate(struct shell_surface *surface, struct wl_seat *seat); + static bool shell_surface_is_top_fullscreen(struct shell_surface *shsurf) { @@ -1234,6 +1237,9 @@ busy_cursor_grab_button(struct wl_pointer_grab *base, if (shsurf && button == BTN_LEFT && state) { activate(shsurf->shell, shsurf->surface, seat); surface_move(shsurf, seat); + } else if (shsurf && button == BTN_RIGHT && state) { + activate(shsurf->shell, shsurf->surface, seat); + surface_rotate(shsurf, &seat->seat); } } @@ -2577,23 +2583,12 @@ static const struct wl_pointer_grab_interface rotate_grab_interface = { }; static void -rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, - void *data) +surface_rotate(struct shell_surface *surface, struct wl_seat *seat) { - struct weston_surface *base_surface = - (struct weston_surface *) seat->pointer->focus; - struct shell_surface *surface; struct rotate_grab *rotate; float dx, dy; float r; - if (base_surface == NULL) - return; - - surface = get_shell_surface(base_surface); - if (!surface || surface->type == SHELL_SURFACE_FULLSCREEN) - return; - rotate = malloc(sizeof *rotate); if (!rotate) return; @@ -2630,6 +2625,24 @@ rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, seat->pointer, DESKTOP_SHELL_CURSOR_ARROW); } +static void +rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button, + void *data) +{ + struct weston_surface *base_surface = + (struct weston_surface *) seat->pointer->focus; + struct shell_surface *surface; + + if (base_surface == NULL) + return; + + surface = get_shell_surface(base_surface); + if (!surface || surface->type == SHELL_SURFACE_FULLSCREEN) + return; + + surface_rotate(surface, seat); +} + static void lower_fullscreen_layer(struct desktop_shell *shell) {