[Xfce4-commits] [xfce/xfwm4] 04/04: compositor: Add support for NET_WM_BYPASS_COMPOSITOR

noreply at xfce.org noreply at xfce.org
Thu Jul 26 07:17:55 CEST 2018


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

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 642275e9d795e9f2cba78df7e3e92485955638a6
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Mon Jul 23 22:45:48 2018 +0200

    compositor: Add support for NET_WM_BYPASS_COMPOSITOR
    
    Bug 12434
    
    This only applies to fullscreen windows.
---
 src/compositor.c | 31 ++++++++++++++++++++++++-------
 src/display.c    |  1 +
 src/display.h    |  1 +
 src/events.c     |  1 -
 src/hints.c      | 20 ++++++++++++++++++++
 src/hints.h      |  3 +++
 6 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 4f936d0..e71f619 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -143,6 +143,7 @@ struct _CWindow
     gint shadow_height;
 
     guint32 opacity;
+    guint32 bypass_compositor;
 };
 
 static CWindow*
@@ -2664,13 +2665,19 @@ map_win (CWindow *cw)
     cw->damaged = FALSE;
 
     /* Check for new windows to un-redirect. */
-    if (WIN_HAS_DAMAGE(cw) && WIN_IS_OVERRIDE(cw) &&
-        WIN_IS_NATIVE_OPAQUE(cw) && WIN_IS_REDIRECTED(cw) && !WIN_IS_SHAPED(cw)
-        && ((screen_info->wins_unredirected > 0) || is_fullscreen (cw)))
+    if (WIN_HAS_DAMAGE(cw) && WIN_IS_NATIVE_OPAQUE(cw) &&
+        WIN_IS_REDIRECTED(cw) && !WIN_IS_SHAPED(cw) &&
+        ((screen_info->wins_unredirected > 0) || is_fullscreen (cw)))
     {
         /* Make those opaque, we don't want them to be transparent */
         cw->opacity = NET_WM_OPAQUE;
-        if (screen_info->params->unredirect_overlays)
+
+        /* For NET_WM_BYPASS_COMPOSITOR, 0 indicates no preference, 1 hints
+         * the compositor to disabling compositing.
+         */
+        if ((cw->bypass_compositor == 1) ||
+            (screen_info->params->unredirect_overlays &&
+             WIN_IS_OVERRIDE(cw) && cw->bypass_compositor == 0))
         {
             TRACE ("unredirecting toplevel window 0x%lx", cw->id);
             unredirect_win (cw);
@@ -2861,6 +2868,7 @@ add_win (DisplayInfo *display_info, Window id, Client *c)
     new->shadow_height = 0;
     new->borderClip = None;
 
+    getBypassCompositor (display_info, id, &new->bypass_compositor);
     init_opacity (new);
     determine_mode (new);
 
@@ -3296,7 +3304,7 @@ compositorHandlePropertyNotify (DisplayInfo *display_info, XPropertyEvent *ev)
         {
             Client *c = cw->c;
 
-            TRACE ("opacity changed for 0x%lx", cw->id);
+            TRACE ("NET_WM_WINDOW_OPACITY changed for 0x%lx", cw->id);
             if (!getOpacity (display_info, cw->id, &cw->opacity))
             {
                 /* The property was removed */
@@ -3321,7 +3329,7 @@ compositorHandlePropertyNotify (DisplayInfo *display_info, XPropertyEvent *ev)
     else if (ev->atom == display_info->atoms[NET_WM_WINDOW_OPACITY_LOCKED])
     {
         CWindow *cw = find_cwindow_in_display (display_info, ev->window);
-        TRACE ("opacity locking property changed for id 0x%lx", ev->window);
+        TRACE ("NET_WM_WINDOW_OPACITY_LOCKED changed for id 0x%lx", ev->window);
 
         if (cw)
         {
@@ -3339,11 +3347,20 @@ compositorHandlePropertyNotify (DisplayInfo *display_info, XPropertyEvent *ev)
             }
         }
     }
+    else if (ev->atom == display_info->atoms[NET_WM_BYPASS_COMPOSITOR])
+    {
+        CWindow *cw = find_cwindow_in_display (display_info, ev->window);
+        TRACE ("NET_WM_BYPASS_COMPOSITOR changed for id 0x%lx", ev->window);
+
+        if (cw)
+        {
+            getBypassCompositor (display_info, cw->id, &cw->bypass_compositor);
+        }
+    }
     else
     {
         TRACE ("no compositor property changed for id 0x%lx", ev->window);
     }
-
 }
 
 static void
diff --git a/src/display.c b/src/display.c
index 95e2e8c..0bb1698 100644
--- a/src/display.c
+++ b/src/display.c
@@ -116,6 +116,7 @@ myDisplayInitAtoms (DisplayInfo *display_info)
         "_NET_WM_ACTION_SHADE",
         "_NET_WM_ACTION_STICK",
         "_NET_WM_ALLOWED_ACTIONS",
+        "_NET_WM_BYPASS_COMPOSITOR",
         "_NET_WM_CONTEXT_HELP",
         "_NET_WM_DESKTOP",
         "_NET_WM_FULLSCREEN_MONITORS",
diff --git a/src/display.h b/src/display.h
index 1d5354a..7fdeb9a 100644
--- a/src/display.h
+++ b/src/display.h
@@ -208,6 +208,7 @@ enum
     NET_WM_ACTION_SHADE,
     NET_WM_ACTION_STICK,
     NET_WM_ALLOWED_ACTIONS,
+    NET_WM_BYPASS_COMPOSITOR,
     NET_WM_CONTEXT_HELP,
     NET_WM_DESKTOP,
     NET_WM_FULLSCREEN_MONITORS,
diff --git a/src/events.c b/src/events.c
index f889edf..ccd820d 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1980,7 +1980,6 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
             TRACE ("client \"%s\" (0x%lx) has received a GTK_SHOW_WINDOW_MENU event", c->name, c->window);
             show_window_menu (c, (gint) ev->data.l[1], (gint) ev->data.l[2], Button3, (Time) myDisplayGetCurrentTime (display_info));
         }
-
     }
     else
     {
diff --git a/src/hints.c b/src/hints.c
index 97f08c5..69a1558 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -373,6 +373,7 @@ setNetSupportedHint (DisplayInfo *display_info, Window root, Window check_win)
     atoms[i++] = display_info->atoms[NET_WM_ACTION_SHADE];
     atoms[i++] = display_info->atoms[NET_WM_ACTION_STICK];
     atoms[i++] = display_info->atoms[NET_WM_ALLOWED_ACTIONS];
+    atoms[i++] = display_info->atoms[NET_WM_BYPASS_COMPOSITOR];
     atoms[i++] = display_info->atoms[NET_WM_CONTEXT_HELP];
     atoms[i++] = display_info->atoms[NET_WM_DESKTOP];
     atoms[i++] = display_info->atoms[NET_WM_FULLSCREEN_MONITORS];
@@ -1144,6 +1145,25 @@ getOpacity (DisplayInfo *display_info, Window window, guint32 *opacity)
 }
 
 gboolean
+getBypassCompositor (DisplayInfo *display_info, Window window, guint32 *bypass)
+{
+    long val;
+
+    g_return_val_if_fail (window != None, FALSE);
+    g_return_val_if_fail (bypass != NULL, FALSE);
+    TRACE ("window 0x%lx", window);
+
+    val = 0;
+    if (getHint (display_info, window, NET_WM_BYPASS_COMPOSITOR, &val))
+    {
+        *bypass = (guint32) val;
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+gboolean
 getOpacityLock (DisplayInfo *display_info, Window window)
 {
     long val;
diff --git a/src/hints.h b/src/hints.h
index e099cba..ac15c5f 100644
--- a/src/hints.h
+++ b/src/hints.h
@@ -267,6 +267,9 @@ gboolean                 getRGBIconData                         (DisplayInfo *,
 gboolean                 getOpacity                             (DisplayInfo *,
                                                                  Window,
                                                                  guint32 *);
+gboolean                 getBypassCompositor                    (DisplayInfo *,
+                                                                 Window,
+                                                                 guint32 *);
 gboolean                 getOpacityLock                         (DisplayInfo *,
                                                                  Window);
 gboolean                 setXAtomManagerOwner                   (DisplayInfo *,

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


More information about the Xfce4-commits mailing list