X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=engines%2Fopenbox%2Fopenbox.c;h=f9ac31d4c3f2c5a5f5770c8e19d2e0df08884f9d;hb=39946832001bd205f764a36fbdae17bc53d1fb35;hp=c488efbaf4dbef8cd6e8a92591dec74df6dc9c36;hpb=db75d406ce6194dd85c142616071e55f9b831f60;p=chaz%2Fopenbox diff --git a/engines/openbox/openbox.c b/engines/openbox/openbox.c index c488efba..f9ac31d4 100644 --- a/engines/openbox/openbox.c +++ b/engines/openbox/openbox.c @@ -3,7 +3,7 @@ #include "../../kernel/screen.h" #include "../../kernel/extensions.h" #include "../../kernel/dispatch.h" -#include "../../kernel/themerc.h" +#include "../../kernel/config.h" #include "../../kernel/frame.h" #include "../../render/render.h" #include "../../render/color.h" @@ -177,7 +177,7 @@ gboolean startup() a_unfocused_title = appearance_new(Surface_Planar, 0); a_focused_label = appearance_new(Surface_Planar, 1); a_unfocused_label = appearance_new(Surface_Planar, 1); - a_icon = appearance_new(Surface_Planar, 0);//1); + a_icon = appearance_new(Surface_Planar, 0);/*1);*/ a_focused_handle = appearance_new(Surface_Planar, 0); a_unfocused_handle = appearance_new(Surface_Planar, 0); @@ -407,7 +407,7 @@ void frame_adjust_shape(ObFrame *self) #endif } -void frame_adjust_size(ObFrame *self) +void frame_adjust_area(ObFrame *self) { if (self->frame.client->decorations & Decor_Border) { self->bwidth = s_bwidth; @@ -461,20 +461,28 @@ void frame_adjust_size(ObFrame *self) XMapWindow(ob_display, self->handle); } else XUnmapWindow(ob_display, self->handle); - - XResizeWindow(ob_display, self->frame.window, self->width, - (self->frame.client->shaded ? TITLE_HEIGHT : - self->innersize.top + self->innersize.bottom + - self->frame.client->area.height)); - - /* do this in two steps because clients whose gravity is set to - 'Static' don't end up getting moved at all with an XMoveResizeWindow */ - XMoveWindow(ob_display, self->frame.plate, - self->innersize.left - self->cbwidth, - self->innersize.top - self->cbwidth); - XResizeWindow(ob_display, self->frame.plate, - self->frame.client->area.width, - self->frame.client->area.height); + + /* find the new coordinates */ + self->frame.area.x = self->frame.client->area.x; + self->frame.area.y = self->frame.client->area.y; + frame_client_gravity((Frame*)self, + &self->frame.area.x, &self->frame.area.y); + /* move and resize the top level frame */ + XMoveResizeWindow(ob_display, self->frame.window, + self->frame.area.x, self->frame.area.y, + self->width, + (self->frame.client->shaded ? TITLE_HEIGHT : + self->innersize.top + self->innersize.bottom + + self->frame.client->area.height)); + + /* move and resize the plate */ + XMoveResizeWindow(ob_display, self->frame.plate, + self->innersize.left - self->cbwidth, + self->innersize.top - self->cbwidth, + self->frame.client->area.width, + self->frame.client->area.height); + /* when the client has StaticGravity, it likes to move around. */ + XMoveWindow(ob_display, self->frame.client->window, 0, 0); STRUT_SET(self->frame.size, self->innersize.left + self->bwidth, @@ -489,18 +497,8 @@ void frame_adjust_size(ObFrame *self) self->frame.size.top + self->frame.size.bottom); render(self); - - frame_adjust_shape(self); -} -void frame_adjust_position(ObFrame *self) -{ - self->frame.area.x = self->frame.client->area.x; - self->frame.area.y = self->frame.client->area.y; - frame_client_gravity((Frame*)self, - &self->frame.area.x, &self->frame.area.y); - XMoveWindow(ob_display, self->frame.window, - self->frame.area.x, self->frame.area.y); + frame_adjust_shape(self); } void frame_adjust_state(ObFrame *self) @@ -548,8 +546,7 @@ void frame_grab_client(ObFrame *self, Client *client) /* map the client so it maps when the frame does */ XMapWindow(ob_display, client->window); - frame_adjust_size(self); - frame_adjust_position(self); + frame_adjust_area(self); /* set all the windows for the frame in the client_map */ g_hash_table_insert(client_map, (gpointer)self->frame.window, client); @@ -608,12 +605,18 @@ static void layout_title(ObFrame *self) const char *lc; int x; gboolean n, d, i, l, m ,c; + ConfigValue layout; n = d = i = l = m = c = FALSE; + if (!config_get("titlebar.layout", Config_String, &layout)) { + layout.string = "NDLIMC"; + config_set("titlebar.layout", Config_String, layout); + } + /* figure out whats being shown, and the width of the label */ self->label_width = self->width - (s_bevel + 1) * 2; - for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) { + for (lc = layout.string; *lc != '\0'; ++lc) { switch (*lc) { case 'N': if (!(self->frame.client->decorations & Decor_Icon)) break; @@ -681,7 +684,7 @@ static void layout_title(ObFrame *self) } x = s_bevel + 1; - for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) { + for (lc = layout.string; *lc != '\0'; ++lc) { switch (*lc) { case 'N': if (!n) break;