[Xfce4-commits] [xfce/xfwm4] 01/02: Add support for NET_WM_STATE_FOCUSED

noreply at xfce.org noreply at xfce.org
Fri Dec 5 13:55:38 CET 2014


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit c7aa46f499467b888117c17c789a3083a99bf341
Author: John Lindgren <john.lindgren at aol.com>
Date:   Fri Dec 5 13:44:16 2014 +0100

    Add support for NET_WM_STATE_FOCUSED
    
    Bug: 11067
    
    GTK3 applications (and client-side decorations in
    particular) rely on NET_WM_STATE_FOCUSED property.
    
    Signed-off-by: John Lindgren <john.lindgren at aol.com>
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/display.c |    1 +
 src/display.h |    1 +
 src/focus.c   |    4 +++-
 src/hints.c   |    1 +
 src/netwm.c   |    5 +++++
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/display.c b/src/display.c
index 42b8bfe..d6dd894 100644
--- a/src/display.c
+++ b/src/display.c
@@ -126,6 +126,7 @@ myDisplayInitAtoms (DisplayInfo *display_info)
         "_NET_WM_STATE_ABOVE",
         "_NET_WM_STATE_BELOW",
         "_NET_WM_STATE_DEMANDS_ATTENTION",
+        "_NET_WM_STATE_FOCUSED",
         "_NET_WM_STATE_FULLSCREEN",
         "_NET_WM_STATE_HIDDEN",
         "_NET_WM_STATE_MAXIMIZED_HORZ",
diff --git a/src/display.h b/src/display.h
index 8797237..2ec8993 100644
--- a/src/display.h
+++ b/src/display.h
@@ -221,6 +221,7 @@ enum
     NET_WM_STATE_ABOVE,
     NET_WM_STATE_BELOW,
     NET_WM_STATE_DEMANDS_ATTENTION,
+    NET_WM_STATE_FOCUSED,
     NET_WM_STATE_FULLSCREEN,
     NET_WM_STATE_HIDDEN,
     NET_WM_STATE_MAXIMIZED_HORZ,
diff --git a/src/focus.c b/src/focus.c
index c1f870c..11723b9 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -462,6 +462,7 @@ clientFocusNone (ScreenInfo *screen_info, Client *previous, guint32 timestamp)
 
     if (previous)
     {
+        clientSetNetState (previous);
         frameQueueDraw (previous, FALSE);
         if (previous->screen_info != screen_info)
         {
@@ -497,6 +498,7 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
     client_focus = c;
     if (c2)
     {
+        clientSetNetState (c2);
         clientAdjustFullscreenLayer (c2, FALSE);
         frameQueueDraw (c2, FALSE);
         clientUpdateOpacity (c2);
@@ -513,8 +515,8 @@ clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
         {
             TRACE ("Un-setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
             FLAG_UNSET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
-            clientSetNetState (c);
         }
+        clientSetNetState (c);
         clientAdjustFullscreenLayer (c, TRUE);
         frameQueueDraw (c, FALSE);
         clientUpdateOpacity (c);
diff --git a/src/hints.c b/src/hints.c
index 45c243c..8bc5c4b 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -389,6 +389,7 @@ setNetSupportedHint (DisplayInfo *display_info, Window root, Window check_win)
     atoms[i++] = display_info->atoms[NET_WM_STATE_ABOVE];
     atoms[i++] = display_info->atoms[NET_WM_STATE_BELOW];
     atoms[i++] = display_info->atoms[NET_WM_STATE_DEMANDS_ATTENTION];
+    atoms[i++] = display_info->atoms[NET_WM_STATE_FOCUSED];
     atoms[i++] = display_info->atoms[NET_WM_STATE_FULLSCREEN];
     atoms[i++] = display_info->atoms[NET_WM_STATE_HIDDEN];
     atoms[i++] = display_info->atoms[NET_WM_STATE_MAXIMIZED_HORZ];
diff --git a/src/netwm.c b/src/netwm.c
index 1352f08..de4b0d6 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -130,6 +130,11 @@ clientSetNetState (Client * c)
         TRACE ("clientSetNetState : demands_attention");
         data[i++] = display_info->atoms[NET_WM_STATE_DEMANDS_ATTENTION];
     }
+    if (c == clientGetFocus ())
+    {
+        TRACE ("clientSetNetState : focused");
+        data[i++] = display_info->atoms[NET_WM_STATE_FOCUSED];
+    }
     XChangeProperty (display_info->dpy, c->window,
                      display_info->atoms[NET_WM_STATE], XA_ATOM, 32,
                      PropModeReplace, (unsigned char *) data, i);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list