]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
don't use XPutBackEvent and mess up timestamp order in the event queue
[chaz/openbox] / openbox / client.c
index 2d78040ad4d5db23cf2dc64e6c000688e99bc902..cc691718e8b4cd3179fd3581281fe6c06cacd008 100644 (file)
@@ -203,14 +203,12 @@ void client_manage(Window window, ObPrompt *prompt)
     ObAppSettings *settings;
     gboolean transient = FALSE;
     Rect place;
-    Time launch_time, map_time;
+    Time launch_time;
     guint32 user_time;
     gboolean obplaced;
 
     ob_debug("Managing window: 0x%lx", window);
 
-    map_time = event_get_server_time();
-
     /* choose the events we want to receive on the CLIENT window
        (ObPrompt windows can request events too) */
     attrib_set.event_mask = CLIENT_EVENTMASK |
@@ -272,7 +270,7 @@ void client_manage(Window window, ObPrompt *prompt)
     launch_time = sn_app_started(self->startup_id, self->class, self->name);
 
     if (!OBT_PROP_GET32(self->window, NET_WM_USER_TIME, CARDINAL, &user_time))
-        user_time = map_time;
+        user_time = event_time();
 
     /* do this after we have a frame.. it uses the frame to help determine the
        WM_STATE to apply. */
@@ -441,7 +439,7 @@ void client_manage(Window window, ObPrompt *prompt)
     ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s",
                   activate ? "yes" : "no");
     if (activate) {
-        activate = client_can_steal_focus(self, map_time, launch_time);
+        activate = client_can_steal_focus(self, event_time(), launch_time);
 
         if (!activate) {
             /* if the client isn't stealing focus, then hilite it so the user
@@ -3130,11 +3128,16 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
     /* if it moved between monitors, then this can affect the stacking
        layer of this window or others - for fullscreen windows.
        also if it changed to/from oldschool fullscreen then its layer may
-       change */
-    if (screen_find_monitor(&self->frame->area) !=
-        screen_find_monitor(&oldframe) ||
-        (final && (client_is_oldfullscreen(self, &oldclient) !=
-                   client_is_oldfullscreen(self, &self->area))))
+       change
+
+       watch out tho, don't try change stacking stuff if the window is no
+       longer being managed !
+    */
+    if (self->managed &&
+        (screen_find_monitor(&self->frame->area) !=
+         screen_find_monitor(&oldframe) ||
+         (final && (client_is_oldfullscreen(self, &oldclient) !=
+                    client_is_oldfullscreen(self, &self->area)))))
     {
         client_calc_layer(self);
     }
@@ -3399,7 +3402,7 @@ void client_close(ObClient *self)
     else {
         /* request the client to close with WM_DELETE_WINDOW */
         OBT_PROP_MSG_TO(self->window, self->window, WM_PROTOCOLS,
-                        OBT_PROP_ATOM(WM_DELETE_WINDOW), event_curtime,
+                        OBT_PROP_ATOM(WM_DELETE_WINDOW), event_time(),
                         0, 0, 0, NoEventMask);
 
         /* we're trying to close the window, so see if it is responding. if it
@@ -3853,7 +3856,7 @@ gboolean client_focus(ObClient *self)
 
     ob_debug_type(OB_DEBUG_FOCUS,
                   "Focusing client \"%s\" (0x%x) at time %u",
-                  self->title, self->window, event_curtime);
+                  self->title, self->window, event_time());
 
     /* if using focus_delay, stop the timer now so that focus doesn't
        go moving on us */
@@ -3865,7 +3868,7 @@ gboolean client_focus(ObClient *self)
         /* This can cause a BadMatch error with CurrentTime, or if an app
            passed in a bad time for _NET_WM_ACTIVE_WINDOW. */
         XSetInputFocus(obt_display, self->window, RevertToPointerRoot,
-                       event_curtime);
+                       event_time());
     }
 
     if (self->focus_notify) {
@@ -3876,7 +3879,7 @@ gboolean client_focus(ObClient *self)
         ce.xclient.window = self->window;
         ce.xclient.format = 32;
         ce.xclient.data.l[0] = OBT_PROP_ATOM(WM_TAKE_FOCUS);
-        ce.xclient.data.l[1] = event_curtime;
+        ce.xclient.data.l[1] = event_time();
         ce.xclient.data.l[2] = 0l;
         ce.xclient.data.l[3] = 0l;
         ce.xclient.data.l[4] = 0l;
@@ -3924,7 +3927,7 @@ void client_activate(ObClient *self, gboolean desktop,
     if ((user && (desktop ||
                   self->desktop == DESKTOP_ALL ||
                   self->desktop == screen_desktop)) ||
-        client_can_steal_focus(self, event_curtime, CurrentTime))
+        client_can_steal_focus(self, event_time(), CurrentTime))
     {
         client_present(self, here, raise, unshade);
     }
This page took 0.025304 seconds and 4 git commands to generate.