window: Move keys_grabbed to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
This commit is contained in:
parent
b6802e1f00
commit
de2a24b313
5 changed files with 21 additions and 9 deletions
|
@ -46,7 +46,7 @@
|
||||||
#include "meta/prefs.h"
|
#include "meta/prefs.h"
|
||||||
#include "mtk/mtk-x11.h"
|
#include "mtk/mtk-x11.h"
|
||||||
#include "x11/meta-x11-display-private.h"
|
#include "x11/meta-x11-display-private.h"
|
||||||
#include "x11/window-x11.h"
|
#include "x11/window-x11-private.h"
|
||||||
|
|
||||||
#ifdef HAVE_NATIVE_BACKEND
|
#ifdef HAVE_NATIVE_BACKEND
|
||||||
#include "backends/native/meta-backend-native.h"
|
#include "backends/native/meta-backend-native.h"
|
||||||
|
@ -1601,20 +1601,22 @@ meta_window_grab_keys (MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = window->display;
|
MetaDisplay *display = window->display;
|
||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
|
MetaWindowX11Private *priv;
|
||||||
|
|
||||||
if (meta_is_wayland_compositor ())
|
if (meta_is_wayland_compositor ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||||
if (window->type == META_WINDOW_DOCK
|
if (window->type == META_WINDOW_DOCK
|
||||||
|| window->override_redirect)
|
|| window->override_redirect)
|
||||||
{
|
{
|
||||||
if (window->keys_grabbed)
|
if (priv->keys_grabbed)
|
||||||
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
||||||
window->keys_grabbed = FALSE;
|
priv->keys_grabbed = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->keys_grabbed)
|
if (priv->keys_grabbed)
|
||||||
{
|
{
|
||||||
if (window->frame && !window->grab_on_frame)
|
if (window->frame && !window->grab_on_frame)
|
||||||
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
||||||
|
@ -1629,14 +1631,21 @@ meta_window_grab_keys (MetaWindow *window)
|
||||||
meta_window_x11_get_toplevel_xwindow (window),
|
meta_window_x11_get_toplevel_xwindow (window),
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
window->keys_grabbed = TRUE;
|
priv->keys_grabbed = TRUE;
|
||||||
window->grab_on_frame = window->frame != NULL;
|
window->grab_on_frame = window->frame != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_ungrab_keys (MetaWindow *window)
|
meta_window_ungrab_keys (MetaWindow *window)
|
||||||
{
|
{
|
||||||
if (!meta_is_wayland_compositor () && window->keys_grabbed)
|
MetaWindowX11Private *priv;
|
||||||
|
|
||||||
|
if (meta_is_wayland_compositor ())
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||||
|
|
||||||
|
if (priv->keys_grabbed)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = window->display;
|
MetaDisplay *display = window->display;
|
||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
|
@ -1647,7 +1656,7 @@ meta_window_ungrab_keys (MetaWindow *window)
|
||||||
else if (!window->grab_on_frame)
|
else if (!window->grab_on_frame)
|
||||||
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
||||||
|
|
||||||
window->keys_grabbed = FALSE;
|
priv->keys_grabbed = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -507,7 +507,6 @@ struct _MetaWindow
|
||||||
guint constructing : 1;
|
guint constructing : 1;
|
||||||
|
|
||||||
/* Used by keybindings.c */
|
/* Used by keybindings.c */
|
||||||
guint keys_grabbed : 1; /* normal keybindings grabbed */
|
|
||||||
guint grab_on_frame : 1; /* grabs are on the frame */
|
guint grab_on_frame : 1; /* grabs are on the frame */
|
||||||
|
|
||||||
/* Set if the reason for unmanaging the window is that
|
/* Set if the reason for unmanaging the window is that
|
||||||
|
|
|
@ -1059,7 +1059,6 @@ meta_window_constructed (GObject *object)
|
||||||
window->placed = ((window->mapped && !window->hidden) || window->override_redirect);
|
window->placed = ((window->mapped && !window->hidden) || window->override_redirect);
|
||||||
window->denied_focus_and_not_transient = FALSE;
|
window->denied_focus_and_not_transient = FALSE;
|
||||||
window->unmanaging = FALSE;
|
window->unmanaging = FALSE;
|
||||||
window->keys_grabbed = FALSE;
|
|
||||||
window->grab_on_frame = FALSE;
|
window->grab_on_frame = FALSE;
|
||||||
window->withdrawn = FALSE;
|
window->withdrawn = FALSE;
|
||||||
window->initial_workspace_set = FALSE;
|
window->initial_workspace_set = FALSE;
|
||||||
|
|
|
@ -91,6 +91,9 @@ struct _MetaWindowX11Private
|
||||||
MetaGroup *group;
|
MetaGroup *group;
|
||||||
|
|
||||||
MetaSyncCounter sync_counter;
|
MetaSyncCounter sync_counter;
|
||||||
|
|
||||||
|
/* Used by keybindings.c */
|
||||||
|
gboolean keys_grabbed; /* normal keybindings grabbed */
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11);
|
MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11);
|
||||||
|
|
|
@ -2087,6 +2087,8 @@ meta_window_x11_constructed (GObject *object)
|
||||||
priv->border_width = attrs.border_width;
|
priv->border_width = attrs.border_width;
|
||||||
priv->xclient_leader = None;
|
priv->xclient_leader = None;
|
||||||
|
|
||||||
|
priv->keys_grabbed = FALSE;
|
||||||
|
|
||||||
g_signal_connect (window, "notify::decorated",
|
g_signal_connect (window, "notify::decorated",
|
||||||
G_CALLBACK (meta_window_x11_update_input_region),
|
G_CALLBACK (meta_window_x11_update_input_region),
|
||||||
window);
|
window);
|
||||||
|
|
Loading…
Reference in a new issue