mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland/pointer: Add way to cancel current grab
Previously a grab could suddenly end without the grabber knowing anything about it. Some grabs assume they won't suddenly end without notice, and can use then new 'cancel' vfunc to be notified. Currently a grab is cancelled when a new one is started (i.e. in meta_wayland_pointer_grab_start()), when a non-popup compositor wide event route is initiated, and when the seat looses the pointer capability. https://bugzilla.gnome.org/show_bug.cgi?id=771858
This commit is contained in:
parent
5306d36522
commit
6e7057426e
@ -89,6 +89,9 @@ G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer,
|
|||||||
static void
|
static void
|
||||||
meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer);
|
meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer);
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_pointer_cancel_grab (MetaWaylandPointer *pointer);
|
||||||
|
|
||||||
static MetaWaylandPointerClient *
|
static MetaWaylandPointerClient *
|
||||||
meta_wayland_pointer_client_new (void)
|
meta_wayland_pointer_client_new (void)
|
||||||
{
|
{
|
||||||
@ -226,6 +229,8 @@ sync_focus_surface (MetaWaylandPointer *pointer)
|
|||||||
case META_EVENT_ROUTE_COMPOSITOR_GRAB:
|
case META_EVENT_ROUTE_COMPOSITOR_GRAB:
|
||||||
case META_EVENT_ROUTE_FRAME_BUTTON:
|
case META_EVENT_ROUTE_FRAME_BUTTON:
|
||||||
/* The compositor has a grab, so remove our focus... */
|
/* The compositor has a grab, so remove our focus... */
|
||||||
|
meta_wayland_pointer_cancel_grab (pointer);
|
||||||
|
meta_wayland_pointer_reset_grab (pointer);
|
||||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -498,6 +503,7 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
|||||||
pointer->cursor_surface_destroy_id);
|
pointer->cursor_surface_destroy_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_wayland_pointer_cancel_grab (pointer);
|
||||||
meta_wayland_pointer_reset_grab (pointer);
|
meta_wayland_pointer_reset_grab (pointer);
|
||||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||||
|
|
||||||
@ -862,6 +868,8 @@ meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer,
|
|||||||
{
|
{
|
||||||
const MetaWaylandPointerGrabInterface *interface;
|
const MetaWaylandPointerGrabInterface *interface;
|
||||||
|
|
||||||
|
meta_wayland_pointer_cancel_grab (pointer);
|
||||||
|
|
||||||
pointer->grab = grab;
|
pointer->grab = grab;
|
||||||
interface = pointer->grab->interface;
|
interface = pointer->grab->interface;
|
||||||
grab->pointer = pointer;
|
grab->pointer = pointer;
|
||||||
@ -887,6 +895,13 @@ meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer)
|
|||||||
meta_wayland_pointer_update_cursor_surface (pointer);
|
meta_wayland_pointer_update_cursor_surface (pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_pointer_cancel_grab (MetaWaylandPointer *pointer)
|
||||||
|
{
|
||||||
|
if (pointer->grab->interface->cancel)
|
||||||
|
pointer->grab->interface->cancel (pointer->grab);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer)
|
meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer)
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,7 @@ struct _MetaWaylandPointerGrabInterface
|
|||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
void (*button) (MetaWaylandPointerGrab *grab,
|
void (*button) (MetaWaylandPointerGrab *grab,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
void (*cancel) (MetaWaylandPointerGrab *grab);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaWaylandPointerGrab
|
struct _MetaWaylandPointerGrab
|
||||||
|
Loading…
Reference in New Issue
Block a user