X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fdock.c;h=4166ba220b032d3cb3fa2defa7dae68b239a7d65;hb=34e819738b344a992a1dbfd6cdd165e0c8ddb3a9;hp=3fb9c78d8914b9fc175e2ba815d8e965e83c12f9;hpb=a4a0cb78294bb1809b836ea1e86e9d7294bb2929;p=chaz%2Fopenbox diff --git a/openbox/dock.c b/openbox/dock.c index 3fb9c78d..4166ba22 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -32,9 +32,9 @@ void dock_startup() RrVisual(ob_rr_inst), CWOverrideRedirect | CWEventMask, &attrib); - dock->a_frame = RrAppearanceCopy(theme_a_unfocused_title); - XSetWindowBorder(ob_display, dock->frame, theme_b_color->pixel); - XSetWindowBorderWidth(ob_display, dock->frame, theme_bwidth); + dock->a_frame = RrAppearanceCopy(ob_rr_theme->a_unfocused_title); + XSetWindowBorder(ob_display, dock->frame, ob_rr_theme->b_color->pixel); + XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->bwidth); g_hash_table_insert(window_map, &dock->frame, dock); stacking_add(DOCK_AS_WINDOW(dock)); @@ -150,8 +150,12 @@ void dock_configure() GList *it; int spot; int gravity; + int minw, minh; + Rect *a; - dock->w = dock->h = spot = 0; + RrMinsize(dock->a_frame, &minw, &minh); + + dock->w = dock->h = 0; /* get the size */ for (it = dock->dock_apps; it; it = it->next) { @@ -165,6 +169,8 @@ void dock_configure() } } + spot = (config_dock_horz ? minw : minh) / 2; + /* position the apps */ for (it = dock->dock_apps; it; it = it->next) { struct DockApp *app = it->data; @@ -182,8 +188,10 @@ void dock_configure() } /* used for calculating offsets */ - dock->w += theme_bwidth * 2; - dock->h += theme_bwidth * 2; + dock->w += ob_rr_theme->bwidth * 2; + dock->h += ob_rr_theme->bwidth * 2; + + a = screen_physical_area(); /* calculate position */ switch (config_dock_pos) { @@ -198,38 +206,38 @@ void dock_configure() gravity = NorthWestGravity; break; case DockPos_Top: - dock->x = screen_physical_size.width / 2; + dock->x = a->width / 2; dock->y = 0; gravity = NorthGravity; break; case DockPos_TopRight: - dock->x = screen_physical_size.width; + dock->x = a->width; dock->y = 0; gravity = NorthEastGravity; break; case DockPos_Left: dock->x = 0; - dock->y = screen_physical_size.height / 2; + dock->y = a->height / 2; gravity = WestGravity; break; case DockPos_Right: - dock->x = screen_physical_size.width; - dock->y = screen_physical_size.height / 2; + dock->x = a->width; + dock->y = a->height / 2; gravity = EastGravity; break; case DockPos_BottomLeft: dock->x = 0; - dock->y = screen_physical_size.height; + dock->y = a->height; gravity = SouthWestGravity; break; case DockPos_Bottom: - dock->x = screen_physical_size.width / 2; - dock->y = screen_physical_size.height; + dock->x = a->width / 2; + dock->y = a->height; gravity = SouthGravity; break; case DockPos_BottomRight: - dock->x = screen_physical_size.width; - dock->y = screen_physical_size.height; + dock->x = a->width; + dock->y = a->height; gravity = SouthEastGravity; break; } @@ -265,39 +273,39 @@ void dock_configure() break; case DockPos_TopLeft: if (config_dock_horz) - dock->y -= dock->h - theme_bwidth; + dock->y -= dock->h - ob_rr_theme->bwidth; else - dock->x -= dock->w - theme_bwidth; + dock->x -= dock->w - ob_rr_theme->bwidth; break; case DockPos_Top: - dock->y -= dock->h - theme_bwidth; + dock->y -= dock->h - ob_rr_theme->bwidth; break; case DockPos_TopRight: if (config_dock_horz) - dock->y -= dock->h - theme_bwidth; + dock->y -= dock->h - ob_rr_theme->bwidth; else - dock->x += dock->w - theme_bwidth; + dock->x += dock->w - ob_rr_theme->bwidth; break; case DockPos_Left: - dock->x -= dock->w - theme_bwidth; + dock->x -= dock->w - ob_rr_theme->bwidth; break; case DockPos_Right: - dock->x += dock->w - theme_bwidth; + dock->x += dock->w - ob_rr_theme->bwidth; break; case DockPos_BottomLeft: if (config_dock_horz) - dock->y += dock->h - theme_bwidth; + dock->y += dock->h - ob_rr_theme->bwidth; else - dock->x -= dock->w - theme_bwidth; + dock->x -= dock->w - ob_rr_theme->bwidth; break; case DockPos_Bottom: - dock->y += dock->h - theme_bwidth; + dock->y += dock->h - ob_rr_theme->bwidth; break; case DockPos_BottomRight: if (config_dock_horz) - dock->y += dock->h - theme_bwidth; + dock->y += dock->h - ob_rr_theme->bwidth; else - dock->x += dock->w - theme_bwidth; + dock->x += dock->w - ob_rr_theme->bwidth; break; } } @@ -345,9 +353,12 @@ void dock_configure() break; } + dock->w += minw; + dock->h += minh; + /* not used for actually sizing shit */ - dock->w -= theme_bwidth * 2; - dock->h -= theme_bwidth * 2; + dock->w -= ob_rr_theme->bwidth * 2; + dock->h -= ob_rr_theme->bwidth * 2; if (dock->w > 0 && dock->h > 0) { XMoveResizeWindow(ob_display, dock->frame, @@ -359,10 +370,10 @@ void dock_configure() XUnmapWindow(ob_display, dock->frame); /* but they are useful outside of this function! */ - dock->w += theme_bwidth * 2; - dock->h += theme_bwidth * 2; + dock->w += ob_rr_theme->bwidth * 2; + dock->h += ob_rr_theme->bwidth * 2; - screen_update_struts(); + screen_update_areas(); } void dock_app_configure(DockApp *app, int w, int h)