merge r6948-6953 from trunk
authorDana Jansens <danakj@orodu.net>
Sun, 27 May 2007 22:40:41 +0000 (22:40 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 27 May 2007 22:40:41 +0000 (22:40 +0000)
openbox/client.c
openbox/event.c
openbox/frame.c
openbox/screen.c
openbox/xerror.c

index 275742b3d8a39e06f28902aabe6d95476ffd30eb..3f891b5a4712cd0a676fb0ab114da019d342c1e5 100644 (file)
@@ -277,7 +277,7 @@ void client_manage(Window window)
         XFree(wmhint);
     }
 
-    ob_debug("Managing window: %lx\n", window);
+    ob_debug("Managing window: 0x%lx\n", window);
 
     /* choose the events we want to receive on the CLIENT window */
     attrib_set.event_mask = CLIENT_EVENTMASK;
@@ -1534,7 +1534,16 @@ void client_get_colormap(ObClient *self)
 
 void client_update_colormap(ObClient *self, Colormap colormap)
 {
-    self->colormap = colormap;
+    if (colormap == self->colormap) return;
+
+    ob_debug("Setting client %s colormap: 0x%x\n", self->title, colormap);
+
+    if (client_focused(self)) {
+        screen_install_colormap(self, FALSE); /* uninstall old one */
+        self->colormap = colormap;
+        screen_install_colormap(self, FALSE); /* install new one */
+    } else
+        self->colormap = colormap;
 }
 
 void client_update_normal_hints(ObClient *self)
@@ -3463,8 +3472,8 @@ gboolean client_focus(ObClient *self)
     }
 
     ob_debug_type(OB_DEBUG_FOCUS,
-                  "Focusing client \"%s\" at time %u\n",
-                  self->title, event_curtime);
+                  "Focusing client \"%s\" (0x%x) at time %u\n",
+                  self->title, self->window, event_curtime);
 
     /* if there is a grab going on, then we need to cancel it. if we move
        focus during the grab, applications will get NotifyWhileGrabbed events
@@ -3502,6 +3511,7 @@ gboolean client_focus(ObClient *self)
 
     xerror_set_ignore(FALSE);
 
+    ob_debug_type(OB_DEBUG_FOCUS, "Error focusing? %d\n", xerror_occured);
     return !xerror_occured;
 }
 
index 3bfca98e6e28ca344ab1c5296de6b58d18ad1497..ac5919ed8b74985cafc4df819992779d332408e3 100644 (file)
@@ -1455,6 +1455,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_update_sync_request_counter(client);
         }
 #endif
+        break;
     case ColormapNotify:
         client_update_colormap(client, e->xcolormap.colormap);
         break;
index 1e93649d0c7624270779b9ea5ea4890b088806bc..92db14aee6a47a2192de936d2f0600f3c9eeb3f9 100644 (file)
@@ -856,13 +856,11 @@ void frame_grab_client(ObFrame *self)
     /*
       When reparenting the client window, it is usually not mapped yet, since
       this occurs from a MapRequest. However, in the case where Openbox is
-      starting up, the window is already mapped, so we'll see unmap events for
-      it. There are 2 unmap events generated that we see, one with the 'event'
-      member set the root window, and one set to the client, but both get
-      handled and need to be ignored.
+      starting up, the window is already mapped, so we'll see an unmap event
+      for it.
     */
     if (ob_state() == OB_STATE_STARTING)
-        self->client->ignore_unmaps += 2;
+        ++self->client->ignore_unmaps;
 
     /* select the event mask on the client's parent (to receive config/map
        req's) the ButtonPress is to catch clicks on the client border */
index f424ca041c13480c076eea71840da70878bb3649..deaf55ee20dee5910d38a1a2a55f1831dd16f54d 100644 (file)
@@ -1026,17 +1026,16 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
 
 void screen_install_colormap(ObClient *client, gboolean install)
 {
-    if (client == NULL) {
+    if (client == NULL || client->colormap == None) {
         if (install)
             XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
         else
             XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
     } else {
         xerror_set_ignore(TRUE);
-        if (install) {
-            if (client->colormap != None)
-                XInstallColormap(RrDisplay(ob_rr_inst), client->colormap);
-        } else
+        if (install)
+            XInstallColormap(RrDisplay(ob_rr_inst), client->colormap);
+        else
             XUninstallColormap(RrDisplay(ob_rr_inst), client->colormap);
         xerror_set_ignore(FALSE);
     }
index 3de593b8f6765e11bb7a49a8258fa06c2729496d..14c0ecd617759f87cb956898445a1360f355ffd8 100644 (file)
@@ -27,20 +27,22 @@ gboolean xerror_occured = FALSE;
 
 gint xerror_handler(Display *d, XErrorEvent *e)
 {
-    xerror_occured = TRUE;
 #ifdef DEBUG
-    if (!xerror_ignore) {
-        gchar errtxt[128];
+    gchar errtxt[128];
 
-        XGetErrorText(d, e->error_code, errtxt, 127);
+    XGetErrorText(d, e->error_code, errtxt, 127);
+    if (!xerror_ignore) {
         if (e->error_code == BadWindow)
             /*g_message(_("X Error: %s\n"), errtxt)*/;
         else
             g_error(_("X Error: %s"), errtxt);
-    }
+    } else
+        ob_debug("XError code %d '%s'\n", e->error_code, errtxt);
 #else
     (void)d; (void)e;
 #endif
+
+    xerror_occured = TRUE;
     return 0;
 }