From c7302a1fa3fe492d19e5a63ea90bedb5049f6f95 Mon Sep 17 00:00:00 2001 From: gotmor Date: Fri, 22 Jun 2007 04:53:29 +0000 Subject: 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 --- main.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'main.c') 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. */ -- cgit v1.2.3-54-g00ecf