]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
add a window between the frame and the plate for drawing the client border. this...
[chaz/openbox] / openbox / frame.c
index 5383f7a379f5a7458de03628df8ae0023e311ce2..4d32064c3d9c0aea05bb501074a201c733821f94 100644 (file)
@@ -102,18 +102,16 @@ ObFrame *frame_new(ObClient *client)
     attrib.event_mask = FRAME_EVENTMASK;
     self->window = createWindow(RootWindow(ob_display, ob_screen), visual,
                                 mask, &attrib);
-    mask &= ~CWEventMask;
-    self->plate = createWindow(self->window, visual, mask, &attrib);
 
     /* create the visible decor windows */
 
-    mask = CWEventMask;
     if (visual) {
         /* client has a 32-bit visual */
         mask |= CWColormap | CWBackPixel | CWBorderPixel;
         attrib.colormap = RrColormap(ob_rr_inst);
     }
     attrib.event_mask = ELEMENT_EVENTMASK;
+    self->inner = createWindow(self->window, NULL, mask, &attrib);
     self->title = createWindow(self->window, NULL, mask, &attrib);
 
     mask |= CWCursor;
@@ -140,10 +138,16 @@ ObFrame *frame_new(ObClient *client)
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
     self->rgrip = createWindow(self->handle, NULL, mask, &attrib); 
 
+    /* create the plate window which holds the client */
+
+    mask &= ~(CWEventMask | CWCursor);
+    self->plate = createWindow(self->inner, visual, mask, &attrib);
+
     self->focused = FALSE;
 
     /* the other stuff is shown based on decor settings */
     XMapWindow(ob_display, self->plate);
+    XMapWindow(ob_display, self->inner);
     XMapWindow(ob_display, self->lgrip);
     XMapWindow(ob_display, self->rgrip);
     XMapWindow(ob_display, self->label);
@@ -238,28 +242,18 @@ void frame_show(ObFrame *self)
         self->visible = TRUE;
         XMapWindow(ob_display, self->client->window);
         XMapWindow(ob_display, self->window);
-        self->firstmap = TRUE;
     }
 }
 
 void frame_hide(ObFrame *self)
 {
-    if (self->visible || self->firstmap == FALSE) {
-        if (self->visible) {
-            self->visible = FALSE;
-            self->client->ignore_unmaps += 1;
-            /* we unmap the client itself so that we can get MapRequest
-               events, and because the ICCCM tells us to! */
-            XUnmapWindow(ob_display, self->window);
-            XUnmapWindow(ob_display, self->client->window);
-        } else {
-            /* the frame wasn't visible, but the frame is being hidden now.
-               so we don't need to unmap the frame, but we do need to unmap
-               the client. */
-            self->client->ignore_unmaps += 1;
-            XUnmapWindow(ob_display, self->client->window);
-        }
-        self->firstmap = TRUE;
+    if (self->visible) {
+        self->visible = FALSE;
+        self->client->ignore_unmaps += 1;
+        /* we unmap the client itself so that we can get MapRequest
+           events, and because the ICCCM tells us to! */
+        XUnmapWindow(ob_display, self->window);
+        XUnmapWindow(ob_display, self->client->window);
     }
 }
 
@@ -431,15 +425,24 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             } else
                 XUnmapWindow(ob_display, self->handle);
 
-            /* move and resize the plate */
-            XMoveResizeWindow(ob_display, self->plate,
+            /* move and resize the inner border window which contains the plate
+             */
+            XMoveResizeWindow(ob_display, self->inner,
                               self->innersize.left - self->cbwidth_x,
                               self->innersize.top - self->cbwidth_y,
-                              self->client->area.width + self->cbwidth_x * 2,
-                              self->client->area.height + self->cbwidth_y * 2);
+                              self->client->area.width +
+                              self->cbwidth_x * 2,
+                              self->client->area.height +
+                              self->cbwidth_y * 2);
+
+            /* move and resize the plate */
+            XMoveResizeWindow(ob_display, self->plate,
+                              self->cbwidth_x,
+                              self->cbwidth_y,
+                              self->client->area.width,
+                              self->client->area.height);
             /* when the client has StaticGravity, it likes to move around. */
-            XMoveWindow(ob_display, self->client->window,
-                        self->cbwidth_x, self->cbwidth_y);
+            XMoveWindow(ob_display, self->client->window, 0, 0);
         }
 
         STRUT_SET(self->size,
@@ -508,6 +511,7 @@ void frame_adjust_focus(ObFrame *self, gboolean hilite)
 {
     self->focused = hilite;
     framerender_frame(self);
+    XFlush(ob_display);
 }
 
 void frame_adjust_title(ObFrame *self)
@@ -549,6 +553,7 @@ void frame_grab_client(ObFrame *self, ObClient *client)
     /* set all the windows for the frame in the window_map */
     g_hash_table_insert(window_map, &self->window, client);
     g_hash_table_insert(window_map, &self->plate, client);
+    g_hash_table_insert(window_map, &self->inner, client);
     g_hash_table_insert(window_map, &self->title, client);
     g_hash_table_insert(window_map, &self->label, client);
     g_hash_table_insert(window_map, &self->max, client);
@@ -603,6 +608,7 @@ void frame_release_client(ObFrame *self, ObClient *client)
     /* remove all the windows for the frame from the window_map */
     g_hash_table_remove(window_map, &self->window);
     g_hash_table_remove(window_map, &self->plate);
+    g_hash_table_remove(window_map, &self->inner);
     g_hash_table_remove(window_map, &self->title);
     g_hash_table_remove(window_map, &self->label);
     g_hash_table_remove(window_map, &self->max);
@@ -823,22 +829,23 @@ ObFrameContext frame_context(ObClient *client, Window win)
         return OB_FRAME_CONTEXT_CLIENT;
     }
 
-    if (win == self->window)   return OB_FRAME_CONTEXT_FRAME;
-    if (win == self->title)    return OB_FRAME_CONTEXT_TITLEBAR;
-    if (win == self->label)    return OB_FRAME_CONTEXT_TITLEBAR;
-    if (win == self->handle)   return OB_FRAME_CONTEXT_HANDLE;
-    if (win == self->lgrip)    return OB_FRAME_CONTEXT_BLCORNER;
-    if (win == self->rgrip)    return OB_FRAME_CONTEXT_BRCORNER;
+    if (win == self->window)    return OB_FRAME_CONTEXT_FRAME;
+    if (win == self->inner)     return OB_FRAME_CONTEXT_FRAME;
+    if (win == self->title)     return OB_FRAME_CONTEXT_TITLEBAR;
+    if (win == self->label)     return OB_FRAME_CONTEXT_TITLEBAR;
+    if (win == self->handle)    return OB_FRAME_CONTEXT_HANDLE;
+    if (win == self->lgrip)     return OB_FRAME_CONTEXT_BLCORNER;
+    if (win == self->rgrip)     return OB_FRAME_CONTEXT_BRCORNER;
     if (win == self->tltresize) return OB_FRAME_CONTEXT_TLCORNER;
     if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER;
     if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER;
     if (win == self->trrresize) return OB_FRAME_CONTEXT_TRCORNER;
-    if (win == self->max)      return OB_FRAME_CONTEXT_MAXIMIZE;
-    if (win == self->iconify)  return OB_FRAME_CONTEXT_ICONIFY;
-    if (win == self->close)    return OB_FRAME_CONTEXT_CLOSE;
-    if (win == self->icon)     return OB_FRAME_CONTEXT_ICON;
-    if (win == self->desk)     return OB_FRAME_CONTEXT_ALLDESKTOPS;
-    if (win == self->shade)    return OB_FRAME_CONTEXT_SHADE;
+    if (win == self->max)       return OB_FRAME_CONTEXT_MAXIMIZE;
+    if (win == self->iconify)   return OB_FRAME_CONTEXT_ICONIFY;
+    if (win == self->close)     return OB_FRAME_CONTEXT_CLOSE;
+    if (win == self->icon)      return OB_FRAME_CONTEXT_ICON;
+    if (win == self->desk)      return OB_FRAME_CONTEXT_ALLDESKTOPS;
+    if (win == self->shade)     return OB_FRAME_CONTEXT_SHADE;
 
     return OB_FRAME_CONTEXT_NONE;
 }
@@ -987,6 +994,7 @@ void frame_flash_start(ObFrame *self)
                                  G_USEC_PER_SEC * 0.6,
                                  flash_timeout,
                                  self,
+                                 g_direct_equal,
                                  flash_done);
     g_get_current_time(&self->flash_end);
     g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5);
This page took 0.028648 seconds and 4 git commands to generate.