X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fdock.c;h=3dda174dbee21e2aeb0feb9e8af97d2dfc433c8e;hb=b1f5555218ecaa3827450125dc47b4bf0d404ee4;hp=e17c8913b8e2f910bd6a75b553b92775bdf3ab63;hpb=f17b225daadb483b8736dc0e57a9def68e770ae9;p=chaz%2Fopenbox diff --git a/openbox/dock.c b/openbox/dock.c index e17c8913..3dda174d 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -28,12 +28,13 @@ void dock_startup() attrib.event_mask = DOCK_EVENT_MASK; attrib.override_redirect = True; dock->frame = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0, - render_depth, InputOutput, render_visual, + RrDepth(ob_rr_inst), InputOutput, + RrVisual(ob_rr_inst), CWOverrideRedirect | CWEventMask, &attrib); - dock->a_frame = appearance_copy(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)); @@ -43,7 +44,7 @@ void dock_startup() void dock_shutdown() { XDestroyWindow(ob_display, dock->frame); - appearance_free(dock->a_frame); + RrAppearanceFree(dock->a_frame); g_hash_table_remove(window_map, &dock->frame); stacking_remove(dock); } @@ -152,19 +153,28 @@ void dock_configure() dock->w = dock->h = spot = 0; + /* get the size */ for (it = dock->dock_apps; it; it = it->next) { struct DockApp *app = it->data; if (config_dock_horz) { - app->x = spot; - app->y = 0; dock->w += app->w; dock->h = MAX(dock->h, app->h); - spot += app->w; } else { - app->x = 0; - app->y = spot; dock->w = MAX(dock->w, app->w); dock->h += app->h; + } + } + + /* position the apps */ + for (it = dock->dock_apps; it; it = it->next) { + struct DockApp *app = it->data; + if (config_dock_horz) { + app->x = spot; + app->y = (dock->h - app->h) / 2; + spot += app->w; + } else { + app->x = (dock->w - app->w) / 2; + app->y = spot; spot += app->h; } @@ -172,8 +182,8 @@ 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; /* calculate position */ switch (config_dock_pos) { @@ -255,39 +265,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; } } @@ -336,22 +346,21 @@ void dock_configure() } /* 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) { - RECT_SET(dock->a_frame->area, 0, 0, dock->w, dock->h); XMoveResizeWindow(ob_display, dock->frame, dock->x, dock->y, dock->w, dock->h); - paint(dock->frame, dock->a_frame); + RrPaint(dock->a_frame, dock->frame, dock->w, dock->h); XMapWindow(ob_display, dock->frame); } else 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(); }