mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
compositor: Remove meta_plugin_begin/end_modal
Amazingly, this is no longer used. This way to let Clutter grab input is no longer necessary. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2100>
This commit is contained in:
parent
527cc51665
commit
b6de66e353
@ -44,14 +44,6 @@ void meta_compositor_remove_window_actor (MetaCompositor *compositor,
|
||||
|
||||
void meta_switch_workspace_completed (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp);
|
||||
void meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
guint32 timestamp);
|
||||
|
||||
MetaPluginManager * meta_compositor_get_plugin_manager (MetaCompositor *compositor);
|
||||
|
||||
int64_t meta_compositor_monotonic_to_high_res_xserver_time (MetaCompositor *compositor,
|
||||
|
@ -146,12 +146,6 @@ static void
|
||||
on_top_window_actor_destroyed (MetaWindowActor *window_actor,
|
||||
MetaCompositor *compositor);
|
||||
|
||||
static gboolean
|
||||
is_modal (MetaDisplay *display)
|
||||
{
|
||||
return display->event_route == META_EVENT_ROUTE_COMPOSITOR_GRAB;
|
||||
}
|
||||
|
||||
static void sync_actor_stacking (MetaCompositor *compositor);
|
||||
|
||||
static void
|
||||
@ -348,32 +342,6 @@ meta_stage_is_focused (MetaDisplay *display)
|
||||
return (display->x11_display->focus_xwindow == window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
grab_devices (MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (meta_get_backend ());
|
||||
|
||||
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
|
||||
{
|
||||
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
|
||||
{
|
||||
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp))
|
||||
goto ungrab_pointer;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
ungrab_pointer:
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
fail:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_grab_begin (MetaCompositor *compositor)
|
||||
{
|
||||
@ -386,86 +354,6 @@ meta_compositor_grab_end (MetaCompositor *compositor)
|
||||
META_COMPOSITOR_GET_CLASS (compositor)->grab_end (compositor);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
/* To some extent this duplicates code in meta_display_begin_grab_op(), but there
|
||||
* are significant differences in how we handle grabs that make it difficult to
|
||||
* merge the two.
|
||||
*/
|
||||
MetaCompositorPrivate *priv =
|
||||
meta_compositor_get_instance_private (compositor);
|
||||
MetaDisplay *display = priv->display;
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (display->grab_op == META_GRAB_OP_WAYLAND_POPUP)
|
||||
{
|
||||
MetaWaylandSeat *seat = meta_wayland_compositor_get_default ()->seat;
|
||||
meta_wayland_pointer_end_popup_grab (seat->pointer);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_modal (display) || display->grab_op != META_GRAB_OP_NONE)
|
||||
return FALSE;
|
||||
|
||||
if (display->x11_display)
|
||||
{
|
||||
/* XXX: why is this needed? */
|
||||
XIUngrabDevice (display->x11_display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
timestamp);
|
||||
XSync (display->x11_display->xdisplay, False);
|
||||
}
|
||||
|
||||
if (!grab_devices (options, timestamp))
|
||||
return FALSE;
|
||||
|
||||
display->grab_op = META_GRAB_OP_COMPOSITOR;
|
||||
display->event_route = META_EVENT_ROUTE_COMPOSITOR_GRAB;
|
||||
display->grab_window = NULL;
|
||||
display->grab_have_pointer = TRUE;
|
||||
display->grab_have_keyboard = TRUE;
|
||||
|
||||
g_signal_emit_by_name (display, "grab-op-begin",
|
||||
display->grab_window, display->grab_op);
|
||||
|
||||
meta_compositor_grab_begin (compositor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaCompositorPrivate *priv =
|
||||
meta_compositor_get_instance_private (compositor);
|
||||
MetaDisplay *display = priv->display;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaWindow *grab_window = display->grab_window;
|
||||
MetaGrabOp grab_op = display->grab_op;
|
||||
|
||||
g_return_if_fail (is_modal (display));
|
||||
|
||||
display->grab_op = META_GRAB_OP_NONE;
|
||||
display->event_route = META_EVENT_ROUTE_NORMAL;
|
||||
display->grab_window = NULL;
|
||||
display->grab_have_pointer = FALSE;
|
||||
display->grab_have_keyboard = FALSE;
|
||||
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
|
||||
|
||||
meta_compositor_grab_end (compositor);
|
||||
|
||||
g_signal_emit_by_name (display, "grab-op-end",
|
||||
grab_window, grab_op);
|
||||
}
|
||||
|
||||
static void
|
||||
redirect_windows (MetaX11Display *x11_display)
|
||||
{
|
||||
|
@ -135,58 +135,6 @@ meta_plugin_destroy_completed (MetaPlugin *plugin,
|
||||
meta_plugin_window_effect_completed (plugin, actor, META_PLUGIN_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_plugin_begin_modal:
|
||||
* @plugin: a #MetaPlugin
|
||||
* @options: flags that modify the behavior of the modal grab
|
||||
* @timestamp: the timestamp used for establishing grabs
|
||||
*
|
||||
* This function is used to grab the keyboard and mouse for the exclusive
|
||||
* use of the plugin. Correct operation requires that both the keyboard
|
||||
* and mouse are grabbed, or thing will break. (In particular, other
|
||||
* passive X grabs in Meta can trigger but not be handled by the normal
|
||||
* keybinding handling code.) However, the plugin can establish the keyboard
|
||||
* and/or mouse grabs ahead of time and pass in the
|
||||
* %META_MODAL_POINTER_ALREADY_GRABBED and/or %META_MODAL_KEYBOARD_ALREADY_GRABBED
|
||||
* options. This facility is provided for two reasons: first to allow using
|
||||
* this function to establish modality after a passive grab, and second to
|
||||
* allow using obscure features of XGrabPointer() and XGrabKeyboard() without
|
||||
* having to add them to this API.
|
||||
*
|
||||
* Return value: whether we successfully grabbed the keyboard and
|
||||
* mouse and made the plugin modal.
|
||||
*/
|
||||
gboolean
|
||||
meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
return meta_begin_modal_for_plugin (priv->compositor, plugin,
|
||||
options, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_plugin_end_modal:
|
||||
* @plugin: a #MetaPlugin
|
||||
* @timestamp: the time used for releasing grabs
|
||||
*
|
||||
* Ends the modal operation begun with meta_plugin_begin_modal(). This
|
||||
* ungrabs both the mouse and keyboard even when
|
||||
* %META_MODAL_POINTER_ALREADY_GRABBED or
|
||||
* %META_MODAL_KEYBOARD_ALREADY_GRABBED were provided as options
|
||||
* when beginnning the modal operation.
|
||||
*/
|
||||
void
|
||||
meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
meta_end_modal_for_plugin (priv->compositor, plugin, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_plugin_get_display:
|
||||
* @plugin: a #MetaPlugin
|
||||
|
@ -332,32 +332,6 @@ void
|
||||
meta_plugin_complete_display_change (MetaPlugin *plugin,
|
||||
gboolean ok);
|
||||
|
||||
/**
|
||||
* MetaModalOptions:
|
||||
* @META_MODAL_POINTER_ALREADY_GRABBED: if set the pointer is already
|
||||
* grabbed by the plugin and should not be grabbed again.
|
||||
* @META_MODAL_KEYBOARD_ALREADY_GRABBED: if set the keyboard is already
|
||||
* grabbed by the plugin and should not be grabbed again.
|
||||
*
|
||||
* Options that can be provided when calling meta_plugin_begin_modal().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
META_MODAL_POINTER_ALREADY_GRABBED = 1 << 0,
|
||||
META_MODAL_KEYBOARD_ALREADY_GRABBED = 1 << 1
|
||||
} MetaModalOptions;
|
||||
|
||||
META_EXPORT
|
||||
gboolean
|
||||
meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp);
|
||||
|
||||
META_EXPORT
|
||||
void
|
||||
meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
guint32 timestamp);
|
||||
|
||||
META_EXPORT
|
||||
MetaDisplay *meta_plugin_get_display (MetaPlugin *plugin);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user