[Xfce4-commits] r26585 - xfwm4/branches/xfce_4_4/src

Olivier Fourdan olivier at xfce.org
Mon Jan 21 23:39:54 CET 2008


Author: olivier
Date: 2008-01-21 22:39:54 +0000 (Mon, 21 Jan 2008)
New Revision: 26585

Modified:
   xfwm4/branches/xfce_4_4/src/events.c
Log:
Exit on SelectionClear event so that xfwm4 exits even with WM who do not send a ClientMEssage event such as Openbox (bug #2374)

Modified: xfwm4/branches/xfce_4_4/src/events.c
===================================================================
--- xfwm4/branches/xfce_4_4/src/events.c	2008-01-21 22:33:27 UTC (rev 26584)
+++ xfwm4/branches/xfce_4_4/src/events.c	2008-01-21 22:39:54 UTC (rev 26585)
@@ -71,7 +71,7 @@
                                  PointerMotionMask | \
                                  ButtonPressMask | \
                                  ButtonReleaseMask)
-                  
+
 #define MODIFIER_MASK           (ShiftMask | \
                                  ControlMask | \
                                  AltMask | \
@@ -238,7 +238,7 @@
     passdata.ycurrent = passdata.y;
     passdata.clicks = 1;
     passdata.allow_double_click = allow_double_click;
-    passdata.timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, 
+    passdata.timeout = g_timeout_add_full (G_PRIORITY_DEFAULT,
                                            display_info->dbl_click_time,
                                            (GtkFunction) typeOfClick_break,
                                            (gpointer) &passdata, NULL);
@@ -304,9 +304,9 @@
     {
         g_source_remove (raise_timeout);
     }
-    raise_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, 
-                                        screen_info->params->raise_delay, 
-                                        (GtkFunction) raise_cb, 
+    raise_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT,
+                                        screen_info->params->raise_delay,
+                                        (GtkFunction) raise_cb,
                                         NULL, NULL);
 }
 
@@ -487,13 +487,13 @@
                 }
                 break;
             case KEY_POPUP_MENU:
-                /* 
-                   We need to release the events here prior to grabbing 
+                /*
+                   We need to release the events here prior to grabbing
                    the keyboard in gtk menu otherwise we end with a dead lock...
                   */
                 XAllowEvents (display_info->dpy, AsyncKeyboard, CurrentTime);
-                show_window_menu (c, frameX (c) + frameLeft (c), 
-                                     frameY (c) + frameTop (c), 
+                show_window_menu (c, frameX (c) + frameLeft (c),
+                                     frameY (c) + frameTop (c),
                                      Button1, GDK_CURRENT_TIME);
                 /* 'nuff for now */
                 return;
@@ -620,7 +620,7 @@
     }
 }
 
-static int 
+static int
 edgeGetPart (Client *c, XButtonEvent * ev)
 {
     int part, x_corner_pixels, y_corner_pixels, x_distance, y_distance;
@@ -1432,22 +1432,22 @@
             constrained = TRUE;
         }
 
-        /* 
-           Let's say that if the client performs a XRaiseWindow, we show the window if focus 
+        /*
+           Let's say that if the client performs a XRaiseWindow, we show the window if focus
            stealing prevention is not activated, otherwise we just set the "demands attention"
            flag...
          */
         if ((ev->value_mask & CWStackMode) && (wc.stack_mode == Above) && (wc.sibling == None))
         {
             Client *last_raised;
-            
+
             last_raised = clientGetLastRaise (screen_info);
             if (last_raised && (c != last_raised))
             {
                 if ((screen_info->params->prevent_focus_stealing) && (screen_info->params->activate_action == ACTIVATE_ACTION_NONE))
                 {
                     ev->value_mask &= ~(CWSibling | CWStackMode);
-                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
+                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                     clientSetNetState (c);
                 }
@@ -1680,10 +1680,10 @@
     }
 
     if ((ev->window == screen_info->xroot)
-        && ((ev->detail == NotifyDetailNone) 
+        && ((ev->detail == NotifyDetailNone)
             || ((ev->mode == NotifyNormal) && (ev->detail == NotifyInferior))))
     {
-        /* 
+        /*
            Handle unexpected focus transition to root (means that an unknown
            window has vanished and the focus is returned to the root).
          */
@@ -1710,10 +1710,10 @@
         clientUpdateFocus (screen_info, c, FOCUS_SORT);
         if ((user_focus != c) && (user_focus != NULL))
         {
-            /* 
+            /*
                Focus stealing prevention:
-               Some apps tend to focus the window directly. If focus stealing prevention is enabled, 
-               we revert the user set focus to the window that we think has focus and then set the 
+               Some apps tend to focus the window directly. If focus stealing prevention is enabled,
+               we revert the user set focus to the window that we think has focus and then set the
                demand attention flag.
 
                Note that focus stealing prevention is ignored between windows of the same group or
@@ -1725,12 +1725,12 @@
                 !clientSameGroup (c, user_focus) &&
                 !clientIsTransientOrModalFor (c, user_focus))
             {
-                TRACE ("Setting focus back to \"%s\" (0x%lx)", user_focus->name, user_focus->window); 
+                TRACE ("Setting focus back to \"%s\" (0x%lx)", user_focus->name, user_focus->window);
                 clientSetFocus (user_focus->screen_info, user_focus, getXServerTime (display_info), NO_FOCUS_FLAG);
 
                 if (current_focus)
                 {
-                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
+                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                     clientSetNetState (c);
                 }
@@ -1779,7 +1779,7 @@
                 "NotifyDetailNone" :
                 "(unknown)");
 
-    if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab) || 
+    if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab) ||
         (ev->detail == NotifyInferior) || (ev->detail > NotifyNonlinearVirtual))
     {
         /* We're not interested in such notifications */
@@ -1871,19 +1871,19 @@
             if (clientCheckTransientWindow (c, w))
             {
                 c->transient_for = w;
-#if 0                
+#if 0
                 /*
                   Java 1.6 updates the WM_TRANSIENT_FOR properties "on-the-fly"
-                  of its windows to maintain the z-order. 
-                  
-                  If we raise the transient then, we clearly have a race 
-                  condition between the WM and Java... And that breaks 
+                  of its windows to maintain the z-order.
+
+                  If we raise the transient then, we clearly have a race
+                  condition between the WM and Java... And that breaks
                   the z-order. Bug #2483.
-                  
+
                   I still think that raising here makes sense, to ensure
                   that the newly promoted transient window is placed above
                   its parent.
-                  
+
                   Chances are that Java 1.6 won't change any time soon (heh,
                   it's not even released yet), so let's adjust the WM to
                   work with Java 1.6...
@@ -2105,7 +2105,7 @@
                 TRACE ("Time of event received is %u, current XServer time is %u", (unsigned int) ev_time, (unsigned int) current);
                 if ((screen_info->params->prevent_focus_stealing) && TIMESTAMP_IS_BEFORE(ev_time, current))
                 {
-                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); 
+                    TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
                     clientSetNetState (c);
                 }
@@ -2139,10 +2139,10 @@
              (ev->message_type == display_info->atoms[NET_CURRENT_DESKTOP])) && (ev->format == 32))
         {
             TRACE ("root has received a win_workspace or a NET_CURRENT_DESKTOP event %li", ev->data.l[0]);
-            if ((ev->data.l[0] >= 0) && (ev->data.l[0] < screen_info->workspace_count) && 
+            if ((ev->data.l[0] >= 0) && (ev->data.l[0] < screen_info->workspace_count) &&
                 (ev->data.l[0] != screen_info->current_ws))
             {
-                workspaceSwitch (screen_info, ev->data.l[0], NULL, TRUE, 
+                workspaceSwitch (screen_info, ev->data.l[0], NULL, TRUE,
                                  myDisplayGetTime (display_info, (Time) ev->data.l[1]));
             }
         }
@@ -2176,10 +2176,10 @@
         else if ((ev->message_type == display_info->atoms[MANAGER]) && (ev->format == 32))
         {
             Atom selection;
-            
+
             TRACE ("window (0x%lx) has received a MANAGER event", ev->window);
             selection = (Atom) ev->data.l[1];
-            
+
 #ifdef ENABLE_KDE_SYSTRAY_PROXY
             if (selection == screen_info->net_system_tray_selection)
             {
@@ -2202,6 +2202,24 @@
 }
 
 static void
+handleSelectionClear (DisplayInfo *display_info, XSelectionClearEvent * ev)
+{
+    ScreenInfo *screen_info;
+
+    TRACE ("entering handleSelectionClear");
+
+    screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
+    if (screen_info)
+    {
+        if (myScreenCheckWMAtom (screen_info, ev->selection))
+        {
+            TRACE ("root has received a WM_Sn selection event");
+            display_info->quit = TRUE;
+        }
+    }
+}
+
+static void
 handleShape (DisplayInfo *display_info, XShapeEvent * ev)
 {
     Client *c;
@@ -2366,6 +2384,9 @@
         case ClientMessage:
             handleClientMessage (display_info, (XClientMessageEvent *) ev);
             break;
+        case SelectionClear:
+            handleSelectionClear (display_info, (XSelectionClearEvent *) ev);
+            break;
         case ColormapNotify:
             handleColormapNotify (display_info, (XColormapEvent *) ev);
             break;



More information about the Xfce4-commits mailing list