core: Change meta_display_get_grab_op() to has_grab()

Make this public API check just return a boolean about whether
there is an existing grab, instead of exposing MetaGrabOp.

It is desirable to avoid exposing details like
META_GRAB_OP_WAYLAND_POPUP, so that MetaDisplay and wayland
grabs can port to ClutterGrab at their own pace, but also
this further information is unused.

This is likely to be temporary API anyways, after both
MetaDisplay and wayland grabs port to Clutter, it will be
possible to check the ClutterStage for all of them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-09-29 14:12:42 +02:00 committed by Marge Bot
parent 1e289e8d81
commit 1e990ad823
2 changed files with 7 additions and 8 deletions

View File

@ -2065,18 +2065,17 @@ meta_display_end_grab_op (MetaDisplay *display,
} }
/** /**
* meta_display_get_grab_op: * meta_display_is_grabbed:
* @display: The #MetaDisplay that the window is on * @display: The #MetaDisplay that the window is on
* Gets the current grab operation, if any. * Returns %TRUE if there is an ongoing grab operation.
* *
* Return value: the current grab operation, or %META_GRAB_OP_NONE if * Return value: Whether there is an active display grab operation.
* Mutter doesn't currently have a grab.
*/ */
MetaGrabOp gboolean
meta_display_get_grab_op (MetaDisplay *display) meta_display_is_grabbed (MetaDisplay *display)
{ {
return display->grab_op; return display->grab_op != META_GRAB_OP_NONE;
} }
void void

View File

@ -148,7 +148,7 @@ void meta_display_end_grab_op (MetaDisplay *display,
guint32 timestamp); guint32 timestamp);
META_EXPORT META_EXPORT
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display); gboolean meta_display_is_grabbed (MetaDisplay *display);
META_EXPORT META_EXPORT
guint meta_display_add_keybinding (MetaDisplay *display, guint meta_display_add_keybinding (MetaDisplay *display,