diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-10-30 14:07:27 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-10-30 14:09:36 -0400 |
commit | 57e090746e45b941cc313d464f99b7826fdf7ba5 (patch) | |
tree | e84f1dee2b2f605135125ae9e63541e543eda775 | |
parent | 5df8ecac5d31467122a9d8bda6241d5957ae6848 (diff) | |
download | weston-57e090746e45b941cc313d464f99b7826fdf7ba5.tar.gz |
shell: End popups if we trigger a shell grab
Clicking outside popups closes them except in case of a shell grab
(move, resize or rotate), in which case we move the parent window away
from under the popup. Instead, just end the popup in those cases.
https://bugs.freedesktop.org/show_bug.cgi?id=55674
-rw-r--r-- | src/shell.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/shell.c b/src/shell.c index cef4011d..b28353ee 100644 --- a/src/shell.c +++ b/src/shell.c @@ -267,6 +267,9 @@ destroy_shell_grab_shsurf(struct wl_listener *listener, void *data) } static void +popup_grab_end(struct wl_pointer *pointer); + +static void shell_grab_start(struct shell_grab *grab, const struct wl_pointer_grab_interface *interface, struct shell_surface *shsurf, @@ -275,6 +278,8 @@ shell_grab_start(struct shell_grab *grab, { struct desktop_shell *shell = shsurf->shell; + popup_grab_end(pointer); + grab->grab.interface = interface; grab->shsurf = shsurf; grab->shsurf_destroy_listener.notify = destroy_shell_grab_shsurf; @@ -1827,9 +1832,7 @@ popup_grab_button(struct wl_pointer_grab *grab, } else if (state == WL_POINTER_BUTTON_STATE_RELEASED && (shsurf->popup.initial_up || time - shsurf->popup.seat->pointer->grab_time > 500)) { - wl_shell_surface_send_popup_done(&shsurf->resource); - wl_pointer_end_grab(grab->pointer); - shsurf->popup.grab.pointer = NULL; + popup_grab_end(grab->pointer); } if (state == WL_POINTER_BUTTON_STATE_RELEASED) @@ -1843,6 +1846,20 @@ static const struct wl_pointer_grab_interface popup_grab_interface = { }; static void +popup_grab_end(struct wl_pointer *pointer) +{ + struct wl_pointer_grab *grab = pointer->grab; + struct shell_surface *shsurf = + container_of(grab, struct shell_surface, popup.grab); + + if (pointer->grab->interface == &popup_grab_interface) { + wl_shell_surface_send_popup_done(&shsurf->resource); + wl_pointer_end_grab(grab->pointer); + shsurf->popup.grab.pointer = NULL; + } +} + +static void shell_map_popup(struct shell_surface *shsurf) { struct wl_seat *seat = shsurf->popup.seat; |