From 7a166a383805f7693e0800f3bf693e3736463a0d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 16 May 2003 19:15:56 +0000 Subject: [PATCH] give the dock a strut and use it --- openbox/dock.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ openbox/dock.h | 5 ++++- openbox/screen.c | 4 ++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/openbox/dock.c b/openbox/dock.c index b25c7e49..02c6d8e7 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -11,11 +11,15 @@ static Dock *dock; +Strut dock_strut; + void dock_startup() { XSetWindowAttributes attrib; int i; + STRUT_SET(dock_strut, 0, 0, 0, 0); + dock = g_new0(struct Dock, 1); dock->obwin.type = Window_Dock; @@ -273,6 +277,49 @@ void dock_configure() } } + /* set the strut */ + switch (config_dock_pos) { + case DockPos_Floating: + STRUT_SET(dock_strut, 0, 0, 0, 0); + break; + case DockPos_TopLeft: + if (config_dock_horz) + STRUT_SET(dock_strut, 0, dock->h, 0, 0); + else + STRUT_SET(dock_strut, dock->w, 0, 0, 0); + break; + case DockPos_Top: + STRUT_SET(dock_strut, 0, dock->h, 0, 0); + break; + case DockPos_TopRight: + if (config_dock_horz) + STRUT_SET(dock_strut, 0, dock->h, 0, 0); + else + STRUT_SET(dock_strut, 0, 0, dock->w, 0); + break; + case DockPos_Left: + STRUT_SET(dock_strut, dock->w, 0, 0, 0); + break; + case DockPos_Right: + STRUT_SET(dock_strut, 0, 0, dock->w, 0); + break; + case DockPos_BottomLeft: + if (config_dock_horz) + STRUT_SET(dock_strut, 0, 0, 0, dock->h); + else + STRUT_SET(dock_strut, dock->w, 0, 0, 0); + break; + case DockPos_Bottom: + STRUT_SET(dock_strut, 0, 0, 0, dock->h); + break; + case DockPos_BottomRight: + if (config_dock_horz) + STRUT_SET(dock_strut, 0, 0, 0, dock->h); + else + STRUT_SET(dock_strut, 0, 0, dock->w, 0); + break; + } + /* not used for actually sizing shit */ dock->w -= theme_bwidth * 2; dock->h -= theme_bwidth * 2; @@ -290,6 +337,8 @@ void dock_configure() /* but they are useful outside of this function! */ dock->w += theme_bwidth * 2; dock->h += theme_bwidth * 2; + + screen_update_struts(); } void dock_app_configure(DockApp *app, int w, int h) diff --git a/openbox/dock.h b/openbox/dock.h index fdfaaf05..14411499 100644 --- a/openbox/dock.h +++ b/openbox/dock.h @@ -2,9 +2,10 @@ #define __dock_h #include "timer.h" -#include "render/render.h" #include "window.h" #include "stacking.h" +#include "geom.h" +#include "render/render.h" #include #include @@ -51,6 +52,8 @@ typedef struct DockApp { int h; } DockApp; +extern Strut dock_strut; + void dock_startup(); void dock_shutdown(); diff --git a/openbox/screen.c b/openbox/screen.c index 0c80827f..fd624466 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -497,6 +497,10 @@ void screen_update_struts() /* apply to the 'all desktops' strut */ STRUT_ADD(strut[screen_num_desktops], c->strut); } + + for (i = 0; i < screen_num_desktops; ++i) + STRUT_ADD(strut[i], dock_strut); + screen_update_area(); } -- 2.44.0