summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-02-21 18:16:57 +0300
committerraveit65 <[email protected]>2018-02-26 11:59:38 +0100
commit42410fe72d0ed2c654631e1755526482a80f4fca (patch)
tree639d00ebead4ace9e0b437b09653a199b6b7bebb
parent70d82d3a745651351d1b8d4e315f074bb83fded3 (diff)
downloadmarco-42410fe72d0ed2c654631e1755526482a80f4fca.tar.bz2
marco-42410fe72d0ed2c654631e1755526482a80f4fca.tar.xz
window: add _NET_WM_STATE_FOCUSED hint to _NET_WM_STATE
ported from: https://github.com/GNOME/metacity/commit/4ccb99a50c54f345c4c7d9ac77f1ea76bc6c7c74
-rw-r--r--src/core/atomnames.h1
-rw-r--r--src/core/window.c23
2 files changed, 19 insertions, 5 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index cda2e33a..8e149060 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -158,6 +158,7 @@ item(_NET_WM_ACTION_ABOVE)
item(_NET_WM_ACTION_BELOW)
item(_NET_WM_STATE_STICKY)
item(_NET_WM_FULLSCREEN_MONITORS)
+item(_NET_WM_STATE_FOCUSED)
#if 0
/* We apparently never use: */
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);