[Xfce4-commits] [xfce/xfwm4] 03/03: netwm: reset decoration on netwm type change

noreply at xfce.org noreply at xfce.org
Thu Nov 26 11:39:48 CET 2015


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

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

commit a64b74377d7e472cd40b227349308cb3853e1d6b
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Thu Nov 26 09:22:54 2015 +0100

    netwm: reset decoration on netwm type change
    
    Bug: 10413
    
    Some applications may temporarily set a transient relationship betwen
    their toplevel windows to maintain a stacking order, in which case we
    would change the decorations (as transients may not have all buttons
    available).
    
    However, we ought to restore the controls when this transient
    relationship is removed by the application, otherwise we leave the
    toplevels with reduced controls.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/client.c |   57 +++++++++++++++++++++++++++++++++++++++------------------
 src/client.h |    4 +++-
 src/events.c |    9 ++++++---
 src/netwm.c  |    2 ++
 4 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/src/client.c b/src/client.c
index 2d13f4a..652a75e 100644
--- a/src/client.c
+++ b/src/client.c
@@ -952,7 +952,27 @@ clientMoveResizeWindow (Client *c, XWindowChanges * wc, unsigned long mask)
 }
 
 void
-clientGetMWMHints (Client *c, gboolean update)
+clientGetMWMHints (Client *c)
+{
+    ScreenInfo *screen_info;
+    DisplayInfo *display_info;
+
+    g_return_if_fail (c != NULL);
+    g_return_if_fail (c->window != None);
+
+    TRACE ("entering clientGetMWMHints client \"%s\" (0x%lx)", c->name, c->window);
+    screen_info = c->screen_info;
+    display_info = screen_info->display_info;
+
+    if (c->mwm_hints)
+    {
+        g_free (c->mwm_hints);
+    }
+    c->mwm_hints = getMotifHints (display_info, c->window);
+}
+
+void
+clientApplyMWMHints (Client *c, gboolean update)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -962,29 +982,28 @@ clientGetMWMHints (Client *c, gboolean update)
     g_return_if_fail (c != NULL);
     g_return_if_fail (c->window != None);
 
-    TRACE ("entering clientGetMWMHints client \"%s\" (0x%lx)", c->name,
+    TRACE ("entering clientApplyMWMHints client \"%s\" (0x%lx)", c->name,
         c->window);
 
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-    mwm_hints = getMotifHints (display_info, c->window);
-    if (mwm_hints)
+    if (c->mwm_hints)
     {
-        if ((mwm_hints->flags & MWM_HINTS_DECORATIONS))
+        if ((c->mwm_hints->flags & MWM_HINTS_DECORATIONS))
         {
             if (!FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
             {
-                if (mwm_hints->decorations & MWM_DECOR_ALL)
+                if (c->mwm_hints->decorations & MWM_DECOR_ALL)
                 {
                     FLAG_SET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
                 }
                 else
                 {
                     FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
-                    FLAG_SET (c->xfwm_flags, (mwm_hints-> decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER))
+                    FLAG_SET (c->xfwm_flags, (c->mwm_hints-> decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER))
                                              ? XFWM_FLAG_HAS_BORDER : 0);
-                    FLAG_SET (c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MENU))
+                    FLAG_SET (c->xfwm_flags, (c->mwm_hints->decorations & (MWM_DECOR_MENU))
                                              ? XFWM_FLAG_HAS_MENU : 0);
                     /*
                        FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
@@ -996,9 +1015,9 @@ clientGetMWMHints (Client *c, gboolean update)
             }
         }
         /* The following is from Metacity : */
-        if (mwm_hints->flags & MWM_HINTS_FUNCTIONS)
+        if (c->mwm_hints->flags & MWM_HINTS_FUNCTIONS)
         {
-            if (!(mwm_hints->functions & MWM_FUNC_ALL))
+            if (!(c->mwm_hints->functions & MWM_FUNC_ALL))
             {
                 FLAG_UNSET (c->xfwm_flags,
                     XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE |
@@ -1013,28 +1032,27 @@ clientGetMWMHints (Client *c, gboolean update)
                     XFWM_FLAG_HAS_RESIZE);
             }
 
-            if (mwm_hints->functions & MWM_FUNC_CLOSE)
+            if (c->mwm_hints->functions & MWM_FUNC_CLOSE)
             {
                 FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_CLOSE);
             }
-            if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
+            if (c->mwm_hints->functions & MWM_FUNC_MINIMIZE)
             {
                 FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
             }
-            if (mwm_hints->functions & MWM_FUNC_MAXIMIZE)
+            if (c->mwm_hints->functions & MWM_FUNC_MAXIMIZE)
             {
                 FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE);
             }
-            if (mwm_hints->functions & MWM_FUNC_RESIZE)
+            if (c->mwm_hints->functions & MWM_FUNC_RESIZE)
             {
                 FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_RESIZE);
             }
-            if (mwm_hints->functions & MWM_FUNC_MOVE)
+            if (c->mwm_hints->functions & MWM_FUNC_MOVE)
             {
                 FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MOVE);
             }
         }
-        g_free (mwm_hints);
     }
 
     if (update)
@@ -1337,6 +1355,10 @@ clientFree (Client *c)
     {
         XFree (c->wmhints);
     }
+    if (c->mwm_hints)
+    {
+        g_free (c->mwm_hints);
+    }
     if ((c->ncmap > 0) && (c->cmap_windows))
     {
         XFree (c->cmap_windows);
@@ -1659,7 +1681,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
 #endif /* HAVE_LIBSTARTUP_NOTIFICATION */
 
     clientGetWMNormalHints (c, FALSE);
-
+    clientGetMWMHints (c);
     c->size->x = c->x;
     c->size->y = c->y;
     c->size->width = c->width;
@@ -1761,7 +1783,6 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
     FLAG_SET (c->wm_flags, HINTS_ACCEPT_INPUT (c->wmhints) ? WM_FLAG_INPUT : 0);
 
     clientGetWMProtocols (c);
-    clientGetMWMHints (c, FALSE);
     c->win_layer = WIN_LAYER_NORMAL;
     c->fullscreen_old_layer = c->win_layer;
 
diff --git a/src/client.h b/src/client.h
index 8b2080e..fd8b730 100644
--- a/src/client.h
+++ b/src/client.h
@@ -300,6 +300,7 @@ struct _Client
     XClassHint class;
     Client *next;
     Client *prev;
+    PropMwmHints *mwm_hints;
     netWindowType type;
     gint x;
     gint y;
@@ -395,7 +396,8 @@ void                     clientReconfigure                      (Client *,
 void                     clientMoveResizeWindow                 (Client *,
                                                                  XWindowChanges *,
                                                                  unsigned long);
-void                     clientGetMWMHints                      (Client *,
+void                     clientGetMWMHints                      (Client *);
+void                     clientApplyMWMHints                    (Client *,
                                                                  gboolean);
 void                     clientGetWMNormalHints                 (Client *,
                                                                  gboolean);
diff --git a/src/events.c b/src/events.c
index 50303b0..8aa0f0a 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1704,7 +1704,8 @@ handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev)
         else if (ev->atom == display_info->atoms[MOTIF_WM_HINTS])
         {
             TRACE ("client \"%s\" (0x%lx) has received a MOTIF_WM_HINTS notify", c->name, c->window);
-            clientGetMWMHints (c, TRUE);
+            clientGetMWMHints (c);
+            clientApplyMWMHints (c, TRUE);
         }
         else if (ev->atom == XA_WM_HINTS)
         {
@@ -2112,13 +2113,15 @@ handleShape (DisplayInfo *display_info, XShapeEvent * ev)
             {
                 update = TRUE;
                 FLAG_SET (c->flags, CLIENT_FLAG_HAS_SHAPE);
-                clientGetMWMHints (c, update);
+                clientGetMWMHints (c);
+                clientApplyMWMHints (c, TRUE);
             }
             else if (!(ev->shaped) && FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
             {
                 update = TRUE;
                 FLAG_UNSET (c->flags, CLIENT_FLAG_HAS_SHAPE);
-                clientGetMWMHints (c, update);
+                clientGetMWMHints (c);
+                clientApplyMWMHints (c, TRUE);
             }
         }
         if (!update)
diff --git a/src/netwm.c b/src/netwm.c
index 51490e5..f779bc8 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -1195,6 +1195,8 @@ clientWindowType (Client * c)
 
     old_type = c->type;
     c->initial_layer = c->win_layer;
+    clientApplyMWMHints (c, FALSE);
+
     if (c->type_atom != None)
     {
         if (c->type_atom == display_info->atoms[NET_WM_WINDOW_TYPE_DESKTOP])

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


More information about the Xfce4-commits mailing list