]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
add partial struts tho they arent useful eyt
[chaz/openbox] / openbox / frame.c
index 1c9913a121276e0776a863973424e46de3417d5b..7e82788a41141122475fa79f5492dee91afd26d5 100644 (file)
@@ -2,6 +2,7 @@
 #include "client.h"
 #include "openbox.h"
 #include "extensions.h"
+#include "config.h"
 #include "framerender.h"
 #include "render/theme.h"
 
@@ -62,7 +63,11 @@ ObFrame *frame_new()
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHWEST);
     self->lgrip = createWindow(self->handle, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
-    self->rgrip = createWindow(self->handle, mask, &attrib);
+    self->rgrip = createWindow(self->handle, mask, &attrib); 
+    attrib.cursor = ob_cursor(OB_CURSOR_NORTHWEST);
+    self->tlresize = createWindow(self->title, mask, &attrib);
+    attrib.cursor = ob_cursor(OB_CURSOR_NORTHEAST);
+    self->trresize = createWindow(self->title, mask, &attrib);
 
     self->focused = FALSE;
 
@@ -71,6 +76,8 @@ ObFrame *frame_new()
     XMapWindow(ob_display, self->lgrip);
     XMapWindow(ob_display, self->rgrip);
     XMapWindow(ob_display, self->label);
+    XMapWindow(ob_display, self->tlresize);
+    XMapWindow(ob_display, self->trresize);
 
     /* set colors/appearance/sizes for stuff that doesn't change */
     XSetWindowBorder(ob_display, self->window, ob_rr_theme->b_color->pixel);
@@ -94,6 +101,10 @@ ObFrame *frame_new()
                   ob_rr_theme->grip_width, ob_rr_theme->handle_height);
     XResizeWindow(ob_display, self->rgrip,
                   ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+    XResizeWindow(ob_display, self->tlresize,
+                  ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+    XResizeWindow(ob_display, self->trresize,
+                  ob_rr_theme->grip_width, ob_rr_theme->handle_height);
 
     /* set up the dynamic appearances */
     self->a_unfocused_title = RrAppearanceCopy(ob_rr_theme->a_unfocused_title);
@@ -207,12 +218,12 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
         g_assert(self->width > 0);
 
         /* set border widths */
-        XSetWindowBorderWidth(ob_display, self->plate,  self->cbwidth);
-        XSetWindowBorderWidth(ob_display, self->window, self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->title,  self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->handle, self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->lgrip,  self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->rgrip,  self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->plate,    self->cbwidth);
+        XSetWindowBorderWidth(ob_display, self->window,   self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->title,    self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->handle,   self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->lgrip,    self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->rgrip,    self->bwidth);
   
         /* position/size and map/unmap all the windows */
 
@@ -232,6 +243,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
             self->innersize.top += ob_rr_theme->title_height + self->bwidth;
             XMapWindow(ob_display, self->title);
 
+            XMoveWindow(ob_display, self->tlresize, 0, 0);
+            XMoveWindow(ob_display, self->trresize,
+                        self->width - ob_rr_theme->grip_width, 0);
+
             /* layout the title bar elements */
             layout_title(self);
         } else
@@ -265,9 +280,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
             */
         } else
             XUnmapWindow(ob_display, self->handle);
-    }
 
-    if (resized) {
         /* move and resize the plate */
         XMoveResizeWindow(ob_display, self->plate,
                           self->innersize.left - self->cbwidth,
@@ -276,9 +289,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
                           self->client->area.height);
         /* when the client has StaticGravity, it likes to move around. */
         XMoveWindow(ob_display, self->client->window, 0, 0);
-    }
 
-    if (resized) {
         STRUT_SET(self->size,
                   self->innersize.left + self->bwidth,
                   self->innersize.top + self->bwidth,
@@ -290,7 +301,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
     RECT_SET_SIZE(self->area,
                  self->client->area.width +
                  self->size.left + self->size.right,
-                 (self->client->shaded ? ob_rr_theme->title_height + self->bwidth*2:
+                 (self->client->shaded ?
+                   ob_rr_theme->title_height + self->bwidth*2:
                    self->client->area.height +
                    self->size.top + self->size.bottom));
 
@@ -299,8 +311,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
            frame_client_gravity. */
         self->area.x = self->client->area.x;
         self->area.y = self->client->area.y;
-        frame_client_gravity((ObFrame*)self,
-                             &self->area.x, &self->area.y);
+        frame_client_gravity(self, &self->area.x, &self->area.y);
     }
 
     /* move and resize the top level frame.
@@ -378,6 +389,8 @@ void frame_grab_client(ObFrame *self, ObClient *client)
     g_hash_table_insert(window_map, &self->handle, client);
     g_hash_table_insert(window_map, &self->lgrip, client);
     g_hash_table_insert(window_map, &self->rgrip, client);
+    g_hash_table_insert(window_map, &self->tlresize, client);
+    g_hash_table_insert(window_map, &self->trresize, client);
 }
 
 void frame_release_client(ObFrame *self, ObClient *client)
@@ -419,6 +432,8 @@ void frame_release_client(ObFrame *self, ObClient *client)
     g_hash_table_remove(window_map, &self->handle);
     g_hash_table_remove(window_map, &self->lgrip);
     g_hash_table_remove(window_map, &self->rgrip);
+    g_hash_table_remove(window_map, &self->tlresize);
+    g_hash_table_remove(window_map, &self->trresize);
 
     frame_free(self);
 }
@@ -433,7 +448,7 @@ static void layout_title(ObFrame *self)
 
     /* figure out whats being shown, and the width of the label */
     self->label_width = self->width - (ob_rr_theme->bevel + 1) * 2;
-    for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) {
+    for (lc = config_title_layout; *lc != '\0'; ++lc) {
        switch (*lc) {
        case 'N':
             if (n) { *lc = ' '; break; } /* rm duplicates */
@@ -491,7 +506,7 @@ static void layout_title(ObFrame *self)
     if (!c) XUnmapWindow(ob_display, self->close);
 
     x = ob_rr_theme->bevel + 1;
-    for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) {
+    for (lc = config_title_layout; *lc != '\0'; ++lc) {
        switch (*lc) {
        case 'N':
            if (!n) break;
@@ -558,6 +573,10 @@ ObFrameContext frame_context_from_string(char *name)
         return OB_FRAME_CONTEXT_HANDLE;
     else if (!g_ascii_strcasecmp("frame", name))
         return OB_FRAME_CONTEXT_FRAME;
+    else if (!g_ascii_strcasecmp("tlcorner", name))
+        return OB_FRAME_CONTEXT_TLCORNER;
+    else if (!g_ascii_strcasecmp("trcorner", name))
+        return OB_FRAME_CONTEXT_TRCORNER;
     else if (!g_ascii_strcasecmp("blcorner", name))
         return OB_FRAME_CONTEXT_BLCORNER;
     else if (!g_ascii_strcasecmp("brcorner", name))
@@ -586,19 +605,21 @@ ObFrameContext frame_context(ObClient *client, Window win)
     if (win == client->window) return OB_FRAME_CONTEXT_CLIENT;
 
     self = client->frame;
-    if (win == self->window) return OB_FRAME_CONTEXT_FRAME;
-    if (win == self->plate)  return OB_FRAME_CONTEXT_CLIENT;
-    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->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->window)   return OB_FRAME_CONTEXT_FRAME;
+    if (win == self->plate)    return OB_FRAME_CONTEXT_CLIENT;
+    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->tlresize) return OB_FRAME_CONTEXT_TLCORNER;
+    if (win == self->trresize) 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;
 
     return OB_FRAME_CONTEXT_NONE;
 }
@@ -687,16 +708,16 @@ void frame_frame_gravity(ObFrame *self, int *x, int *y)
     switch (self->client->gravity) {
     default:
     case NorthWestGravity:
-    case WestGravity:
-    case SouthWestGravity:
-       break;
     case NorthGravity:
+    case NorthEastGravity:
+       break;
+    case WestGravity:
     case CenterGravity:
-    case SouthGravity:
+    case EastGravity:
        *y += (self->size.top + self->size.bottom) / 2;
        break;
-    case NorthEastGravity:
-    case EastGravity:
+    case SouthWestGravity:
+    case SouthGravity:
     case SouthEastGravity:
        *y += self->size.top + self->size.bottom;
        break;
This page took 0.025474 seconds and 4 git commands to generate.