diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2022-10-03 19:52:39 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2022-10-03 19:52:39 +0300 |
commit | abcbdcce1e67a7c652a21c7578aba69e1bda08c4 (patch) | |
tree | c6ddc260ed6c66677804a19042fc1823a393a641 /src/core | |
parent | 428fdd2f1f0c64d4e5992579c2c3c2c5fa216362 (diff) | |
download | metacity-abcbdcce1e67a7c652a21c7578aba69e1bda08c4.tar.gz |
window: add meta_window_is_focusable
Based on mutter commits:
https://gitlab.gnome.org/GNOME/mutter/-/commit/43633d6b2f6f602ba87956d5c20ee336b8b56236
https://gitlab.gnome.org/GNOME/mutter/-/commit/58d2a674c466b607e18e6c8e129a6cf1646fde7f
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stack.c | 2 | ||||
-rw-r--r-- | src/core/window-private.h | 2 | ||||
-rw-r--r-- | src/core/window.c | 10 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/core/stack.c b/src/core/stack.c index e16014d1..bc0fa9d3 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -1243,7 +1243,7 @@ get_default_focus_window (MetaStack *stack, if (window->unmanaging) continue; - if (!(window->input || window->take_focus)) + if (!meta_window_is_focusable (window)) continue; if (!meta_window_should_be_showing_on_workspace (window, workspace)) diff --git a/src/core/window-private.h b/src/core/window-private.h index ff1a606c..61cef633 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -593,6 +593,8 @@ gboolean meta_window_client_message (MetaWindow *window, void meta_window_set_focused_internal (MetaWindow *window, gboolean focused); +gboolean meta_window_is_focusable (MetaWindow *self); + void meta_window_set_current_workspace_hint (MetaWindow *window); unsigned long meta_window_get_net_wm_desktop (MetaWindow *window); diff --git a/src/core/window.c b/src/core/window.c index 194f42b7..07886fb5 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2044,7 +2044,7 @@ window_state_on_map (MetaWindow *window, /* don't initially focus windows that are intended to not accept * focus */ - if (!(window->input || window->take_focus)) + if (!meta_window_is_focusable (window)) { *takes_focus = FALSE; return; @@ -4418,7 +4418,7 @@ meta_window_focus (MetaWindow *window, */ if (window->frame && (window->shaded || - !(window->input || window->take_focus))) + !meta_window_is_focusable (window))) { if (window->frame) { @@ -5903,6 +5903,12 @@ meta_window_set_focused_internal (MetaWindow *window, } } +gboolean +meta_window_is_focusable (MetaWindow *self) +{ + return self->input || self->take_focus; +} + static gboolean process_property_notify (MetaWindow *window, XPropertyEvent *event) |