]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
more handling time wraparounds
[chaz/openbox] / openbox / client.c
index 0feed299e8f76724a06171ede004373ff7cf8c62..6866e8d8da8749cabbd7a5801c65b556b736cd1c 100644 (file)
@@ -220,13 +220,14 @@ void client_manage(Window window)
 
     grab_server(TRUE);
 
-    /* check if it has already been unmapped by the time we started mapping
+    /* check if it has already been unmapped by the time we started mapping.
        the grab does a sync so we don't have to here */
     if (XCheckTypedWindowEvent(ob_display, window, DestroyNotify, &e) ||
         XCheckTypedWindowEvent(ob_display, window, UnmapNotify, &e))
     {
         XPutBackEvent(ob_display, &e);
 
+        ob_debug("Trying to manage unmapped window. Aborting that.\n");
         grab_server(FALSE);
         return; /* don't manage it */
     }
@@ -393,6 +394,8 @@ void client_manage(Window window)
        won't be all wacko!!
        also, this moves the window to the position where it has been placed
     */
+    ob_debug("placing window 0x%x at %d, %d with size %d x %d\n",
+             self->window, newx, newy, self->area.width, self->area.height);
     client_apply_startup_state(self, newx, newy);
 
     keyboard_grab_for_client(self, TRUE);
@@ -411,8 +414,11 @@ void client_manage(Window window)
         else
         {
             /* If time stamp is old, don't steal focus */
-            if (self->user_time && self->user_time < client_last_user_time)
+            if (self->user_time &&
+                !event_time_after(self->user_time, client_last_user_time))
+            {
                 activate = FALSE;
+            }
             /* Don't steal focus from globally active clients.
                I stole this idea from KWin. It seems nice.
              */
@@ -1643,20 +1649,16 @@ void client_update_wmhints(ObClient *self)
 
 void client_update_title(ObClient *self)
 {
-    GList *it;
-    guint32 nums;
-    guint i;
     gchar *data = NULL;
-    gchar *old_title;
 
-    old_title = self->title;
+    g_free(self->title);
      
     /* try netwm */
     if (!PROP_GETS(self->window, net_wm_name, utf8, &data)) {
         /* try old x stuff */
         if (!(PROP_GETS(self->window, wm_name, locale, &data)
               || PROP_GETS(self->window, wm_name, utf8, &data))) {
-            if (self->transient != NULL) {
+            if (self->transient) {
                 /*
                   GNOME alert windows are not given titles:
                   http://developer.gnome.org/projects/gup/hig/draft_hig_new/windows-alert.html
@@ -1673,8 +1675,6 @@ void client_update_title(ObClient *self)
     if (self->frame)
         frame_adjust_title(self->frame);
 
-    g_free(old_title);
-
     /* update the icon title */
     data = NULL;
     g_free(self->icon_title);
@@ -1868,7 +1868,10 @@ void client_update_user_time(ObClient *self, gboolean new_event)
         if (new_event)
             client_last_user_time = time;
 
-        /*ob_debug("window 0x%x user time %u\n", self->window, time);*/
+        /*
+        ob_debug("window %s user time %u\n", self->title, time);
+        ob_debug("last user time %u\n", client_last_user_time);
+        */
     }
 }
 
@@ -3031,9 +3034,11 @@ void client_activate(ObClient *self, gboolean here, gboolean user)
              "source=%s\n",
              self->window, event_curtime, client_last_user_time,
              (user ? "user" : "application"));
-    if (!user && event_curtime && event_curtime < client_last_user_time)
+    if (!user && event_curtime &&
+        !event_time_after(event_curtime, client_last_user_time))
+    {
         client_hilite(self, TRUE);
-    else {
+    else {
         if (client_normal(self) && screen_showing_desktop)
             screen_show_desktop(FALSE);
         if (self->iconic)
This page took 0.025395 seconds and 4 git commands to generate.