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
This commit is contained in:
Kristian Høgsberg 2012-10-30 14:07:27 -04:00
parent 5df8ecac5d
commit 57e090746e

View File

@ -266,6 +266,9 @@ destroy_shell_grab_shsurf(struct wl_listener *listener, void *data)
grab->shsurf = NULL;
}
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,
@ -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)
@ -1842,6 +1845,20 @@ static const struct wl_pointer_grab_interface popup_grab_interface = {
popup_grab_button,
};
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)
{