]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
watch for windows with titlecounts changing their title and getting an incorrect...
[chaz/openbox] / openbox / client.c
index c6f43063147864111b1332e220f4fffb819e37a3..fe23f05df94f017af187122ac5a4da59b6f254f2 100644 (file)
@@ -660,6 +660,8 @@ static void client_get_all(ObClient *self)
     client_get_state(self);
     client_get_shaped(self);
 
+    g_message("self->iconic %d", self->iconic);
+
     client_get_mwm_hints(self);
     client_get_type(self);/* this can change the mwmhints for special cases */
 
@@ -749,10 +751,6 @@ static void client_get_state(ObClient *self)
     guint32 *state;
     guint num;
   
-    self->modal = self->shaded = self->max_horz = self->max_vert =
-       self->fullscreen = self->above = self->below = self->iconic =
-       self->skip_taskbar = self->skip_pager = FALSE;
-
     if (PROP_GETA32(self->window, net_wm_state, atom, &state, &num)) {
        gulong i;
        for (i = 0; i < num; ++i) {
@@ -812,7 +810,11 @@ void client_update_transient_for(ObClient *self)
             target = g_hash_table_lookup(window_map, &t);
             /* if this happens then we need to check for it*/
             g_assert(target != self);
-            g_assert(!target || WINDOW_IS_CLIENT(target));
+            if (target && !WINDOW_IS_CLIENT(target)) {
+                /* this can happen when a dialog is a child of
+                   a dockapp, for example */
+                target = NULL;
+            }
             
             if (!target && self->group) {
                 /* not transient to a client, see if it is transient for a
@@ -1306,10 +1308,11 @@ void client_update_title(ObClient *self)
     GList *it;
     guint32 nums;
     guint i;
-    char *data = NULL;
+    gchar *data = NULL;
     gboolean read_title;
+    gchar *old_title;
 
-    g_free(self->title);
+    old_title = self->title;
      
     /* try netwm */
     if (!PROP_GETS(self->window, net_wm_name, utf8, &data))
@@ -1317,6 +1320,10 @@ void client_update_title(ObClient *self)
        if (!PROP_GETS(self->window, wm_name, locale, &data))
            data = g_strdup("Unnamed Window");
 
+    /* did the title change? then reset the title_count */
+    if (old_title && 0 != strncmp(old_title, data, strlen(data)))
+        self->title_count = 1;
+
     /* look for duplicates and append a number */
     nums = 0;
     for (it = client_list; it; it = it->next)
@@ -1334,12 +1341,10 @@ void client_update_title(ObClient *self)
         }
     /* dont display the number for the first window */
     if (self->title_count > 1) {
-        char *vdata, *ndata;
-        ndata = g_strdup_printf(" - [%u]", self->title_count);
-        vdata = g_strconcat(data, ndata, NULL);
-        g_free(ndata);
+        char *ndata;
+        ndata = g_strdup_printf("%s - [%u]", data, self->title_count);
         g_free(data);
-        data = vdata;
+        data = ndata;
     }
 
     PROP_SETS(self->window, net_wm_visible_name, data);
@@ -1349,6 +1354,8 @@ 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);
@@ -1708,6 +1715,7 @@ static void client_apply_startup_state(ObClient *self)
 {
     /* these are in a carefully crafted order.. */
 
+    g_message("self->iconic %d", self->iconic);
     if (self->iconic) {
        self->iconic = FALSE;
        client_iconify(self, TRUE, FALSE);
@@ -2501,12 +2509,17 @@ gboolean client_focus(ObClient *self)
         return FALSE;
     }
 
-    if (self->can_focus)
+    if (self->can_focus) {
         /* RevertToPointerRoot causes much more headache than RevertToNone, so
            I choose to use it always, hopefully to find errors quicker, if any
-           are left. (I hate X. I hate focus events.) */
-       XSetInputFocus(ob_display, self->window, RevertToPointerRoot,
+           are left. (I hate X. I hate focus events.)
+           
+           Update: Changing this to RevertToNone fixed a bug with mozilla (bug
+           #799. So now it is RevertToNone again.
+        */
+       XSetInputFocus(ob_display, self->window, RevertToNone,
                        event_lasttime);
+    }
 
     if (self->focus_notify) {
        XEvent ce;
This page took 0.023116 seconds and 4 git commands to generate.