From 42410fe72d0ed2c654631e1755526482a80f4fca Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 21 Feb 2018 18:16:57 +0300 Subject: window: add _NET_WM_STATE_FOCUSED hint to _NET_WM_STATE ported from: https://github.com/GNOME/metacity/commit/4ccb99a50c54f345c4c7d9ac77f1ea76bc6c7c74 --- src/core/window.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/core/window.c') diff --git a/src/core/window.c b/src/core/window.c index 3f6314d6..abd5af4b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1259,7 +1259,7 @@ static void set_net_wm_state (MetaWindow *window) { int i; - unsigned long data[12]; + unsigned long data[13]; i = 0; if (window->shaded) @@ -1322,6 +1322,11 @@ set_net_wm_state (MetaWindow *window) data[i] = window->display->atom__NET_WM_STATE_STICKY; ++i; } + if (window->has_focus) + { + data[i] = window->display->atom__NET_WM_STATE_FOCUSED; + ++i; + } meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i); @@ -5490,6 +5495,15 @@ meta_window_client_message (MetaWindow *window, return FALSE; } +static void +meta_window_appears_focused_changed (MetaWindow *window) +{ + set_net_wm_state (window); + + if (window->frame) + meta_frame_queue_draw (window->frame); +} + gboolean meta_window_notify_focus (MetaWindow *window, XEvent *event) @@ -5599,8 +5613,7 @@ meta_window_notify_focus (MetaWindow *window, window); } - if (window->frame) - meta_frame_queue_draw (window->frame); + meta_window_appears_focused_changed (window); meta_error_trap_push (window->display); XInstallColormap (window->display->xdisplay, @@ -5652,8 +5665,8 @@ meta_window_notify_focus (MetaWindow *window, window->display->focus_window = NULL; window->has_focus = FALSE; - if (window->frame) - meta_frame_queue_draw (window->frame); + + meta_window_appears_focused_changed (window); meta_compositor_set_active_window (window->display->compositor, window->screen, NULL); -- cgit v1.2.1