[Xfce4-commits] r29456 - in xfwm4/trunk: . src

Olivier Fourdan olivier at xfce.org
Sat Feb 7 01:39:29 CET 2009


Author: olivier
Date: 2009-02-07 00:39:28 +0000 (Sat, 07 Feb 2009)
New Revision: 29456

Modified:
   xfwm4/trunk/ChangeLog
   xfwm4/trunk/NEWS
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/focus.c
   xfwm4/trunk/src/mypixmap.c
   xfwm4/trunk/src/mywindow.c
Log:
	* src/events.c, : Fix user time not being taken from the user time
	  window for apps which support that protocol, that was breaking
	  focus stealing prevention for all gtk,
	  src/focus.c: Do not automatically give focus to windows placed on 
	  lower layers, but focus those on upper layers at first map. 
 

Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/ChangeLog	2009-02-07 00:39:28 UTC (rev 29456)
@@ -1,5 +1,13 @@
-2009-05-01	olivier
+2009-02-06	olivier
 
+	* src/events.c, : Fix user time not being taken from the user time
+	  window for apps which support that protocol, that was breaking
+	  focus stealing prevention for all gtk,
+	  src/focus.c: Do not automatically give focus to windows placed on 
+	  lower layers, but focus those on upper layers at first map.
+
+2009-02-05	olivier
+
 	* settings-dialogs/xfwm4-dialog.glade: Set minimum value for 
 	  wrap_resistance and snap_width (0 is not a valid value)
 	  src/settings.c: clamp values to sensible defaults

Modified: xfwm4/trunk/NEWS
===================================================================
--- xfwm4/trunk/NEWS	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/NEWS	2009-02-07 00:39:28 UTC (rev 29456)
@@ -7,6 +7,11 @@
   shortcut than the one being edited.
 - When stealing a shortcut from another shortcuts provider, clear the shortcut
   of that provider first.
+- Fix focus stealing prevention with applications which support the 
+  NET_WM_USER_TIME_WINDOW protocol
+- Do not automatically give focus to windows placed on lower layers, but 
+  focus those on upper layers at first map.
+- Fix compilation failure in debug full without render
 
 4.5.99.1 (Xfce 4.6rc1)
 ======================

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/src/events.c	2009-02-07 00:39:28 UTC (rev 29456)
@@ -1799,7 +1799,12 @@
         else if (ev->atom == display_info->atoms[NET_WM_USER_TIME])
         {
             TRACE ("client \"%s\" (0x%lx) has received a NET_WM_USER_TIME notify", c->name, c->window);
-            if (getNetWMUserTime (display_info, c->window, &c->user_time) && (c->user_time != 0))
+            /*
+             * We can use "c->user_time_win" safely here because this will be
+             * the same as "c->window" if the app does not support the protocol
+             * NET_WM_USER_TIME_WINDOW
+             */
+            if (getNetWMUserTime (display_info, c->user_time_win, &c->user_time) && (c->user_time != 0))
             {
                 myDisplaySetLastUserTime (display_info, c->user_time);
                 FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);

Modified: xfwm4/trunk/src/focus.c
===================================================================
--- xfwm4/trunk/src/focus.c	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/src/focus.c	2009-02-07 00:39:28 UTC (rev 29456)
@@ -164,17 +164,32 @@
     }
     else if ((client_focus) && (prevent_focus_stealing))
     {
-        if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME) && (c->user_time == CurrentTime))
+        if (client_focus->win_layer > c->win_layer)
         {
-            TRACE ("Given startup time is 0, not focusing");
+            TRACE ("Not focusing \"%s\" because the current focused window is on a upper layer", c->name);
             give_focus = FALSE;
             prevented = TRUE;
         }
+        else if (client_focus->win_layer < c->win_layer)
+        {
+            /* We short don't use focus stealing prevention against upper layers */
+            TRACE ("Ignoring startup prevention because the current focused window is on a lower layer");
+            give_focus = TRUE;
+            prevented = FALSE;
+        }
+        else if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME) && (c->user_time == CurrentTime))
+        {
+            TRACE ("Given startup time is nil, not focusing \"%s\"", c->name);
+            give_focus = FALSE;
+            prevented = TRUE;
+        }
         else if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME | CLIENT_FLAG_HAS_USER_TIME))
         {
             if (TIMESTAMP_IS_BEFORE (c->user_time, client_focus->user_time))
             {
-                TRACE ("Current %u, new %u", (unsigned int) client_focus->user_time, (unsigned int) c->user_time);
+                TRACE ("Current time is %u, new time is %u, not focusing \"%s\" \n",
+                       (unsigned int) client_focus->user_time,
+                       (unsigned int) c->user_time, c->name);
                 give_focus = FALSE;
                 prevented = TRUE;
             }
@@ -201,11 +216,6 @@
 
         if ((c2 != NULL) && (c2->win_layer == c->win_layer))
         {
-            if (prevented)
-            {
-                TRACE ("clientFocusNew: Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
-                FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
-            }
             clientSortRing(c);
             clientLower (c, c2->frame);
             clientSortRing(c2);
@@ -217,6 +227,12 @@
             clientSortRing(c);
         }
 
+        if (prevented)
+        {
+            TRACE ("clientFocusNew: Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
+            FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
+        }
+
         clientShow (c, TRUE);
         clientGrabMouseButton (c);
         clientSetNetState (c);

Modified: xfwm4/trunk/src/mypixmap.c
===================================================================
--- xfwm4/trunk/src/mypixmap.c	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/src/mypixmap.c	2009-02-07 00:39:28 UTC (rev 29456)
@@ -705,10 +705,10 @@
     return pixbuf;
 }
 
+#ifdef HAVE_RENDER
 static void
 xfwmPixmapRefreshPict (xfwmPixmap * pm)
 {
-#ifdef HAVE_RENDER
     ScreenInfo * screen_info;
 
     screen_info = pm->screen_info;
@@ -729,8 +729,8 @@
         pm->pict = XRenderCreatePicture (myScreenGetXDisplay (screen_info),
                                          pm->pixmap, pm->pict_format, 0, NULL);
     }
+}
 #endif
-}
 
 static GdkPixbuf *
 xfwmPixmapCompose (GdkPixbuf *pixbuf, const gchar * dir, const gchar * file)

Modified: xfwm4/trunk/src/mywindow.c
===================================================================
--- xfwm4/trunk/src/mywindow.c	2009-02-05 13:21:12 UTC (rev 29455)
+++ xfwm4/trunk/src/mywindow.c	2009-02-07 00:39:28 UTC (rev 29456)
@@ -261,10 +261,10 @@
     xfwmWindowSetVisual (win, visual, depth);
 }
 
+#ifdef HAVE_RENDER
 static gboolean
 xfwmWindowCopyComposite (xfwmWindow * win, xfwmPixmap * pix)
 {
-#ifdef HAVE_RENDER
     if (myDisplayHaveRender (win->screen_info->display_info))
     {
         Picture pict;
@@ -309,9 +309,9 @@
         XFreePixmap (myScreenGetXDisplay (win->screen_info), temp);
         return TRUE;
     }
-#endif
     return FALSE;
 }
+#endif
 
 void
 xfwmWindowSetBG (xfwmWindow * win, xfwmPixmap * pix)




More information about the Xfce4-commits mailing list