]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
add the template file
[chaz/openbox] / openbox / frame.c
index 423ff802faf74fed732ea226523b24a156f8c91d..d905e75294516af783d1736cf79209f88498eac5 100644 (file)
@@ -190,8 +190,6 @@ ObFrame *frame_new(ObClient *client)
 
 static void set_theme_statics(ObFrame *self)
 {
-    gint handle_height;
-
     /* set colors/appearance/sizes for stuff that doesn't change */
     XResizeWindow(ob_display, self->max,
                   ob_rr_theme->button_size, ob_rr_theme->button_size);
@@ -297,18 +295,20 @@ void frame_adjust_shape(ObFrame *self)
 
         num = 0;
         if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
-            xrect[0].x = -ob_rr_theme->fbwidth;
-            xrect[0].y = -ob_rr_theme->fbwidth;
-            xrect[0].width = self->width + self->bwidth * 2;
+            xrect[0].x = 0;
+            xrect[0].y = 0;
+            xrect[0].width = self->area.width;
             xrect[0].height = ob_rr_theme->title_height +
-                self->bwidth * 2;
+                self->bwidth + self->rbwidth;
             ++num;
         }
 
-        if (self->decorations & OB_FRAME_DECOR_HANDLE) {
-            xrect[1].x = -ob_rr_theme->fbwidth;
+        if (self->decorations & OB_FRAME_DECOR_HANDLE &&
+            ob_rr_theme->handle_height > 0)
+        {
+            xrect[1].x = 0;
             xrect[1].y = FRAME_HANDLE_Y(self);
-            xrect[1].width = self->width + self->bwidth * 2;
+            xrect[1].width = self->area.width;
             xrect[1].height = ob_rr_theme->handle_height +
                 self->bwidth * 2;
             ++num;
@@ -340,26 +340,29 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             self->bwidth = self->cbwidth_x = self->cbwidth_y = 0;
         }
         self->rbwidth = self->bwidth;
+        self->leftb = self->rightb = TRUE;
 
-        if (self->max_horz)
+        if (self->max_horz) {
+            self->leftb = self->rightb = FALSE;
             self->cbwidth_x = 0;
+        }
 
         self->width = self->client->area.width + self->cbwidth_x * 2;
         self->width = MAX(self->width, 1); /* no lower than 1 */
 
         STRUT_SET(self->size,
-                  self->cbwidth_x + self->bwidth,
+                  self->cbwidth_x + (self->leftb ? self->bwidth : 0),
                   self->cbwidth_y + self->bwidth,
-                  self->cbwidth_x + self->bwidth,
+                  self->cbwidth_x + (self->rightb ? self->bwidth : 0),
                   self->cbwidth_y + self->bwidth);
 
         if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
-            self->size.top += ob_rr_theme->title_height + self->bwidth +
-                (self->bwidth - self->bwidth);
+            self->size.top += ob_rr_theme->title_height + self->rbwidth;
         if (self->decorations & OB_FRAME_DECOR_HANDLE &&
             ob_rr_theme->handle_height > 0)
-            self->size.bottom += ob_rr_theme->handle_height +
-                self->bwidth + (self->bwidth - self->bwidth);
+        {
+            self->size.bottom += ob_rr_theme->handle_height + self->bwidth;
+        }
   
         /* position/size and map/unmap all the windows */
 
@@ -382,16 +385,21 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                                   0,
                                   ob_rr_theme->grip_width + self->bwidth,
                                   self->bwidth);
+
                 XMoveResizeWindow(ob_display, self->titleleft,
                                   0, self->bwidth,
                                   self->bwidth,
-                                  ob_rr_theme->grip_width);
+                                  (self->leftb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.top - self->bwidth));
                 XMoveResizeWindow(ob_display, self->titleright,
                                   self->client->area.width +
                                   self->cbwidth_x * 2 + self->bwidth,
                                   self->bwidth,
                                   self->bwidth,
-                                  ob_rr_theme->grip_width);
+                                  (self->rightb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.top - self->bwidth));
 
                 XMapWindow(ob_display, self->titletop);
                 XMapWindow(ob_display, self->titletopleft);
@@ -399,18 +407,22 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                 XMapWindow(ob_display, self->titleleft);
                 XMapWindow(ob_display, self->titleright);
 
-                if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
+                if (self->decorations & OB_FRAME_DECOR_TITLEBAR &&
+                    self->rbwidth)
+                {
                     XMoveResizeWindow(ob_display, self->titlebottom,
                                       self->bwidth,
                                       ob_rr_theme->title_height + self->bwidth,
                                       self->client->area.width +
                                       self->cbwidth_x * 2,
-                                      self->bwidth);
+                                      self->rbwidth);
 
                     XMapWindow(ob_display, self->titlebottom);
                 } else
                     XUnmapWindow(ob_display, self->titlebottom);
             } else {
+                XUnmapWindow(ob_display, self->titlebottom);
+
                 XUnmapWindow(ob_display, self->titletop);
                 XUnmapWindow(ob_display, self->titletopleft);
                 XUnmapWindow(ob_display, self->titletopright);
@@ -475,17 +487,25 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                                   0,
                                   self->size.top + self->client->area.height +
                                   self->size.bottom -
-                                  ob_rr_theme->grip_width,
+                                  (self->leftb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.bottom),
                                   self->bwidth,
-                                  ob_rr_theme->grip_width);
+                                  (self->leftb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.bottom));
                 XMoveResizeWindow(ob_display, self->rgripright,
                                   self->size.left + self->client->area.width +
                                   self->size.right - self->bwidth,
                                   self->size.top + self->client->area.height +
                                   self->size.bottom -
-                                  ob_rr_theme->grip_width,
+                                  (self->leftb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.bottom),
                                   self->bwidth,
-                                  ob_rr_theme->grip_width);
+                                  (self->rightb ?
+                                   ob_rr_theme->grip_width :
+                                   self->size.bottom));
 
                 XMoveResizeWindow(ob_display, self->lgripbottom,
                                   self->bwidth,
@@ -563,6 +583,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                 } else
                     XUnmapWindow(ob_display, self->handletop);
             } else {
+                XUnmapWindow(ob_display, self->handletop);
+
                 XUnmapWindow(ob_display, self->handlebottom);
                 XUnmapWindow(ob_display, self->lgripleft);
                 XUnmapWindow(ob_display, self->rgripright);
@@ -629,13 +651,16 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                               0,
                               self->size.top - self->cbwidth_y,
                               self->client->area.width +
-                              self->cbwidth_x * 2 + self->bwidth * 2,
+                              self->cbwidth_x * 2 +
+                              (self->leftb ? self->bwidth : 0) +
+                              (self->rightb ? self->bwidth : 0),
                               self->client->area.height +
                               self->cbwidth_y * 2);
 
             /* move the plate */
             XMoveWindow(ob_display, self->plate,
-                        self->bwidth + self->cbwidth_x, self->cbwidth_y);
+                        (self->leftb ? self->bwidth : 0) + self->cbwidth_x,
+                        self->cbwidth_y);
 
             /* when the client has StaticGravity, it likes to move around. */
             XMoveWindow(ob_display, self->client->window, 0, 0);
This page took 0.027311 seconds and 4 git commands to generate.