shell: Drop shell_global_begin/end_modal()

These are no longer used nor necessary, we now use have ClutterGrab()
which notify the internals about the changes in event handling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2046>
This commit is contained in:
Carlos Garnacho 2021-11-19 14:36:53 +01:00
parent d92b71d2b2
commit 643e8aec5f
2 changed files with 1 additions and 85 deletions

View File

@ -80,7 +80,6 @@ struct _ShellGlobal {
GHashTable *save_ops;
gboolean has_modal;
gboolean frame_timestamps;
gboolean frame_finish_timestamp;
@ -707,9 +706,6 @@ focus_window_changed (MetaDisplay *display,
{
ShellGlobal *global = user_data;
if (global->has_modal)
return;
/* If the stage window became unfocused, drop the key focus
* on Clutter's side. */
if (!meta_stage_is_focused (global->meta_display))
@ -736,9 +732,6 @@ sync_stage_window_focus (ShellGlobal *global)
{
ClutterActor *actor;
if (global->has_modal)
return;
actor = get_key_focused_actor (global);
/* An actor got key focus and the stage needs to be focused. */
@ -767,9 +760,6 @@ sync_input_region (ShellGlobal *global)
MetaDisplay *display = global->meta_display;
MetaX11Display *x11_display = meta_display_get_x11_display (display);
if (global->has_modal)
meta_x11_display_set_stage_input_region (x11_display, None);
else
meta_x11_display_set_stage_input_region (x11_display, global->input_region);
}
@ -1076,74 +1066,6 @@ _shell_global_get_gjs_context (ShellGlobal *global)
return global->js_context;
}
/**
* shell_global_begin_modal:
* @global: a #ShellGlobal
*
* Grabs the keyboard and mouse to the stage window. The stage will
* receive all keyboard and mouse events until shell_global_end_modal()
* is called. This is used to implement "modes" for the shell, such as the
* overview mode or the "looking glass" debug overlay, that block
* application and normal key shortcuts.
*
* Returns: %TRUE if we successfully entered the mode. %FALSE if we couldn't
* enter the mode. Failure may occur because an application has the pointer
* or keyboard grabbed, because Mutter is in a mode itself like moving a
* window or alt-Tab window selection, or because shell_global_begin_modal()
* was previously called.
*/
gboolean
shell_global_begin_modal (ShellGlobal *global,
guint32 timestamp,
MetaModalOptions options)
{
if (!meta_display_get_compositor (global->meta_display))
return FALSE;
/* Make it an error to call begin_modal while we already
* have a modal active. */
if (global->has_modal)
return FALSE;
global->has_modal = meta_plugin_begin_modal (global->plugin, options, timestamp);
if (!meta_is_wayland_compositor ())
sync_input_region (global);
return global->has_modal;
}
/**
* shell_global_end_modal:
* @global: a #ShellGlobal
*
* Undoes the effect of shell_global_begin_modal().
*/
void
shell_global_end_modal (ShellGlobal *global,
guint32 timestamp)
{
if (!meta_display_get_compositor (global->meta_display))
return;
if (!global->has_modal)
return;
meta_plugin_end_modal (global->plugin, timestamp);
global->has_modal = FALSE;
/* If the stage window is unfocused, ensure that there's no
* actor focused on Clutter's side. */
if (!meta_stage_is_focused (global->meta_display))
clutter_stage_set_key_focus (global->stage, NULL);
/* An actor dropped key focus. Focus the default window. */
else if (get_key_focused_actor (global) && meta_stage_is_focused (global->meta_display))
meta_display_focus_default_window (global->meta_display,
get_current_time_maybe_roundtrip (global));
if (!meta_is_wayland_compositor ())
sync_input_region (global);
}
/* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
*
* Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering

View File

@ -23,12 +23,6 @@ guint32 shell_global_get_current_time (ShellGlobal *global);
/* Input/event handling */
gboolean shell_global_begin_modal (ShellGlobal *global,
guint32 timestamp,
MetaModalOptions options);
void shell_global_end_modal (ShellGlobal *global,
guint32 timestamp);
void shell_global_set_stage_input_region (ShellGlobal *global,
GSList *rectangles);