aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-22 04:53:29 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-22 04:53:29 +0000
commitc7302a1fa3fe492d19e5a63ea90bedb5049f6f95 (patch)
tree103aaa7743a27b9ced44b1423e62797b2c05cd29 /main.c
parentd4fde05241ac7f537e338f0be48d986e6adb8b3b (diff)
downloaddzen-c7302a1fa3fe492d19e5a63ea90bedb5049f6f95.tar.gz
dzen-c7302a1fa3fe492d19e5a63ea90bedb5049f6f95.zip
add support for _NET_WM_STRUT_PARTIAL hint, thanks Jason Creighton
git-svn-id: http://dzen.googlecode.com/svn/trunk@108 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'main.c')
-rw-r--r--main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/main.c b/main.c
index 47632cf..25ee5fe 100644
--- a/main.c
+++ b/main.c
@@ -271,6 +271,36 @@ queryscreeninfo(Display *dpy, XRectangle *rect, int screen) {
}
#endif
+static void set_net_wm_strut_partial_for(Display *dpy, Window w) {
+ unsigned long strut[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ XWindowAttributes wa;
+
+ XGetWindowAttributes(dpy, w, &wa);
+
+ if(wa.y == 0) {
+ strut[2] = wa.height;
+ strut[8] = wa.x;
+ strut[9] = wa.x + wa.width - 1;
+ } else if((wa.y + wa.height) == DisplayHeight(dpy, DefaultScreen(dpy))) {
+ strut[3] = wa.height;
+ strut[10] = wa.x;
+ strut[11] = wa.x + wa.width - 1;
+ }
+
+ if(strut[2] != 0 || strut[3] != 0) {
+ XChangeProperty(
+ dpy,
+ w,
+ XInternAtom(dpy, "_NET_WM_STRUT_PARTIAL", False),
+ XInternAtom(dpy, "CARDINAL", False),
+ 32,
+ PropModeReplace,
+ (unsigned char *)&strut,
+ 12
+ );
+ }
+}
+
static void
x_create_windows(void) {
XSetWindowAttributes wa;
@@ -313,6 +343,9 @@ x_create_windows(void) {
dzen.title_win.drawable = XCreatePixmap(dzen.dpy, root, dzen.title_win.width,
dzen.line_height, DefaultDepth(dzen.dpy, dzen.screen));
+ /* set some hints for windowmanagers*/
+ set_net_wm_strut_partial_for(dzen.dpy, dzen.title_win.win);
+
/* TODO: Smarter approach to window creation so we can reduce the
* size of this function.
*/