]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
bigtime theme changes. bigtime.
[chaz/openbox] / openbox / frame.c
index 3bceec997a2f2aed40fac936123b125f474517cd..cbb6dfda7d19d08693aac325933c47988166b88a 100644 (file)
@@ -22,6 +22,9 @@ static void layout_title(ObFrame *self);
 static void flash_done(gpointer data);
 static gboolean flash_timeout(gpointer data);
 
+static void set_theme_statics(ObFrame *self);
+static void free_theme_statics(ObFrame *self);
+
 static Window createWindow(Window parent, unsigned long mask,
                           XSetWindowAttributes *attrib)
 {
@@ -88,6 +91,18 @@ ObFrame *frame_new()
     XMapWindow(ob_display, self->rgrip);
     XMapWindow(ob_display, self->label);
 
+    self->max_press = self->close_press = self->desk_press = 
+       self->iconify_press = self->shade_press = FALSE;
+    self->max_hover = self->close_hover = self->desk_hover = 
+       self->iconify_hover = self->shade_hover = FALSE;
+
+    set_theme_statics(self);
+
+    return (ObFrame*)self;
+}
+
+static void set_theme_statics(ObFrame *self)
+{
     /* set colors/appearance/sizes for stuff that doesn't change */
     XSetWindowBorder(ob_display, self->window, ob_rr_theme->b_color->pixel);
     XSetWindowBorder(ob_display, self->title, ob_rr_theme->b_color->pixel);
@@ -125,16 +140,9 @@ ObFrame *frame_new()
         RrAppearanceCopy(ob_rr_theme->a_unfocused_handle);
     self->a_focused_handle = RrAppearanceCopy(ob_rr_theme->a_focused_handle);
     self->a_icon = RrAppearanceCopy(ob_rr_theme->a_icon);
-
-    self->max_press = self->close_press = self->desk_press = 
-       self->iconify_press = self->shade_press = FALSE;
-    self->max_hover = self->close_hover = self->desk_hover = 
-       self->iconify_hover = self->shade_hover = FALSE;
-
-    return (ObFrame*)self;
 }
 
-static void frame_free(ObFrame *self)
+static void free_theme_statics(ObFrame *self)
 {
     RrAppearanceFree(self->a_unfocused_title); 
     RrAppearanceFree(self->a_focused_title);
@@ -143,6 +151,11 @@ static void frame_free(ObFrame *self)
     RrAppearanceFree(self->a_unfocused_handle);
     RrAppearanceFree(self->a_focused_handle);
     RrAppearanceFree(self->a_icon);
+}
+
+static void frame_free(ObFrame *self)
+{
+    free_theme_statics(self);
 
     XDestroyWindow(ob_display, self->window);
 
@@ -166,6 +179,13 @@ void frame_hide(ObFrame *self)
     }
 }
 
+void frame_adjust_theme(ObFrame *self)
+{
+    free_theme_statics(self);
+    set_theme_statics(self);
+    frame_adjust_area(self, TRUE, TRUE, FALSE);
+}
+
 void frame_adjust_shape(ObFrame *self)
 {
 #ifdef SHAPE
@@ -477,7 +497,7 @@ void frame_release_client(ObFrame *self, ObClient *client)
     g_hash_table_remove(window_map, &self->tlresize);
     g_hash_table_remove(window_map, &self->trresize);
 
-    ob_main_loop_timeout_remove(ob_main_loop, flash_timeout);
+    ob_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self);
 
     frame_free(self);
 }
@@ -491,32 +511,32 @@ static void layout_title(ObFrame *self)
     n = d = i = l = m = c = s = FALSE;
 
     /* figure out whats being shown, and the width of the label */
-    self->label_width = self->width - (ob_rr_theme->bevel + 1) * 2;
+    self->label_width = self->width - (ob_rr_theme->padding + 1) * 2;
     for (lc = config_title_layout; *lc != '\0'; ++lc) {
        switch (*lc) {
        case 'N':
             if (n) { *lc = ' '; break; } /* rm duplicates */
            n = TRUE;
            self->label_width -= (ob_rr_theme->button_size + 2 +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        case 'D':
             if (d) { *lc = ' '; break; } /* rm duplicates */
            d = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        case 'S':
             if (s) { *lc = ' '; break; } /* rm duplicates */
            s = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        case 'I':
             if (i) { *lc = ' '; break; } /* rm duplicates */
            i = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        case 'L':
             if (l) { *lc = ' '; break; } /* rm duplicates */
@@ -526,13 +546,13 @@ static void layout_title(ObFrame *self)
             if (m) { *lc = ' '; break; } /* rm duplicates */
            m = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        case 'C':
             if (c) { *lc = ' '; break; } /* rm duplicates */
            c = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
-                                  ob_rr_theme->bevel + 1);
+                                  ob_rr_theme->padding + 1);
            break;
        }
     }
@@ -549,57 +569,57 @@ static void layout_title(ObFrame *self)
     if (!m) XUnmapWindow(ob_display, self->max);
     if (!c) XUnmapWindow(ob_display, self->close);
 
-    x = ob_rr_theme->bevel + 1;
+    x = ob_rr_theme->padding + 1;
     for (lc = config_title_layout; *lc != '\0'; ++lc) {
        switch (*lc) {
        case 'N':
            if (!n) break;
            self->icon_x = x;
            XMapWindow(ob_display, self->icon);
-           XMoveWindow(ob_display, self->icon, x, ob_rr_theme->bevel);
-           x += ob_rr_theme->button_size + 2 + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->icon, x, ob_rr_theme->padding);
+           x += ob_rr_theme->button_size + 2 + ob_rr_theme->padding + 1;
            break;
        case 'D':
            if (!d) break;
            self->desk_x = x;
            XMapWindow(ob_display, self->desk);
-           XMoveWindow(ob_display, self->desk, x, ob_rr_theme->bevel + 1);
-           x += ob_rr_theme->button_size + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->desk, x, ob_rr_theme->padding + 1);
+           x += ob_rr_theme->button_size + ob_rr_theme->padding + 1;
            break;
        case 'S':
            if (!s) break;
            self->shade_x = x;
            XMapWindow(ob_display, self->shade);
-           XMoveWindow(ob_display, self->shade, x, ob_rr_theme->bevel + 1);
-           x += ob_rr_theme->button_size + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->shade, x, ob_rr_theme->padding + 1);
+           x += ob_rr_theme->button_size + ob_rr_theme->padding + 1;
            break;
        case 'I':
            if (!i) break;
            self->iconify_x = x;
            XMapWindow(ob_display, self->iconify);
-           XMoveWindow(ob_display, self->iconify, x, ob_rr_theme->bevel + 1);
-           x += ob_rr_theme->button_size + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display,self->iconify, x, ob_rr_theme->padding + 1);
+           x += ob_rr_theme->button_size + ob_rr_theme->padding + 1;
            break;
        case 'L':
            if (!l) break;
            self->label_x = x;
            XMapWindow(ob_display, self->label);
-           XMoveWindow(ob_display, self->label, x, ob_rr_theme->bevel);
-           x += self->label_width + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->label, x, ob_rr_theme->padding);
+           x += self->label_width + ob_rr_theme->padding + 1;
            break;
        case 'M':
            if (!m) break;
            self->max_x = x;
            XMapWindow(ob_display, self->max);
-           XMoveWindow(ob_display, self->max, x, ob_rr_theme->bevel + 1);
-           x += ob_rr_theme->button_size + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->max, x, ob_rr_theme->padding + 1);
+           x += ob_rr_theme->button_size + ob_rr_theme->padding + 1;
            break;
        case 'C':
            if (!c) break;
            self->close_x = x;
            XMapWindow(ob_display, self->close);
-           XMoveWindow(ob_display, self->close, x, ob_rr_theme->bevel + 1);
-           x += ob_rr_theme->button_size + ob_rr_theme->bevel + 1;
+           XMoveWindow(ob_display, self->close, x, ob_rr_theme->padding + 1);
+           x += ob_rr_theme->button_size + ob_rr_theme->padding + 1;
            break;
        }
     }
This page took 0.0299 seconds and 4 git commands to generate.