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:
parent
5df8ecac5d
commit
57e090746e
23
src/shell.c
23
src/shell.c
@ -266,6 +266,9 @@ destroy_shell_grab_shsurf(struct wl_listener *listener, void *data)
|
|||||||
grab->shsurf = NULL;
|
grab->shsurf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
popup_grab_end(struct wl_pointer *pointer);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shell_grab_start(struct shell_grab *grab,
|
shell_grab_start(struct shell_grab *grab,
|
||||||
const struct wl_pointer_grab_interface *interface,
|
const struct wl_pointer_grab_interface *interface,
|
||||||
@ -275,6 +278,8 @@ shell_grab_start(struct shell_grab *grab,
|
|||||||
{
|
{
|
||||||
struct desktop_shell *shell = shsurf->shell;
|
struct desktop_shell *shell = shsurf->shell;
|
||||||
|
|
||||||
|
popup_grab_end(pointer);
|
||||||
|
|
||||||
grab->grab.interface = interface;
|
grab->grab.interface = interface;
|
||||||
grab->shsurf = shsurf;
|
grab->shsurf = shsurf;
|
||||||
grab->shsurf_destroy_listener.notify = destroy_shell_grab_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 &&
|
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
|
||||||
(shsurf->popup.initial_up ||
|
(shsurf->popup.initial_up ||
|
||||||
time - shsurf->popup.seat->pointer->grab_time > 500)) {
|
time - shsurf->popup.seat->pointer->grab_time > 500)) {
|
||||||
wl_shell_surface_send_popup_done(&shsurf->resource);
|
popup_grab_end(grab->pointer);
|
||||||
wl_pointer_end_grab(grab->pointer);
|
|
||||||
shsurf->popup.grab.pointer = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == WL_POINTER_BUTTON_STATE_RELEASED)
|
if (state == WL_POINTER_BUTTON_STATE_RELEASED)
|
||||||
@ -1842,6 +1845,20 @@ static const struct wl_pointer_grab_interface popup_grab_interface = {
|
|||||||
popup_grab_button,
|
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
|
static void
|
||||||
shell_map_popup(struct shell_surface *shsurf)
|
shell_map_popup(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user