From 67a7bc89e385cb894c3f3261b752464f6f8339a5 Mon Sep 17 00:00:00 2001 From: gotmor Date: Mon, 26 Jan 2009 14:20:01 +0000 Subject: added WM_CLIENT_MACHINE and _NET_WM_PID properties git-svn-id: http://dzen.googlecode.com/svn/trunk@237 f2baff5b-bf2c-0410-a398-912abdc3d8b2 --- main.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/main.c b/main.c index 0def10c..51d8f6d 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,10 @@ #include #include +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + Dzen dzen = {0}; static int last_cnt = 0; typedef void sigfunc(int); @@ -296,6 +300,32 @@ set_docking_ewmh_info(Display *dpy, Window w, int dock) { XWindowAttributes wa; Atom type; unsigned int desktop; + pid_t cur_pid; + char *host_name; + XTextProperty txt_prop; + + host_name = emalloc(HOST_NAME_MAX); + if( (gethostname(host_name, HOST_NAME_MAX) > -1) && + (cur_pid = getpid()) ) { + + XStringListToTextProperty(&host_name, 1, &txt_prop); + XSetWMClientMachine(dpy, w, &txt_prop); + XFree(txt_prop.value); + + XChangeProperty( + dpy, + w, + XInternAtom(dpy, "_NET_WM_PID", False), + XInternAtom(dpy, "CARDINAL", False), + 32, + PropModeReplace, + (unsigned char *)&cur_pid, + 1 + ); + + } + free(host_name); + XGetWindowAttributes(dpy, w, &wa); @@ -316,25 +346,25 @@ set_docking_ewmh_info(Display *dpy, Window w, int dock) { 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 - ); + dpy, + w, + XInternAtom(dpy, "_NET_WM_STRUT_PARTIAL", False), + XInternAtom(dpy, "CARDINAL", False), + 32, + PropModeReplace, + (unsigned char *)&strut, + 12 + ); XChangeProperty( - dpy, - w, - XInternAtom(dpy, "_NET_WM_STRUT", False), - XInternAtom(dpy, "CARDINAL", False), - 32, - PropModeReplace, - (unsigned char *)&strut, - 4 - ); + dpy, + w, + XInternAtom(dpy, "_NET_WM_STRUT", False), + XInternAtom(dpy, "CARDINAL", False), + 32, + PropModeReplace, + (unsigned char *)&strut, + 4 + ); } if(dock) { @@ -349,7 +379,7 @@ set_docking_ewmh_info(Display *dpy, Window w, int dock) { PropModeReplace, (unsigned char *)&type, 1 - ); + ); desktop = 0xffffffff; @@ -362,7 +392,7 @@ set_docking_ewmh_info(Display *dpy, Window w, int dock) { PropModeReplace, (unsigned char *)&desktop, 1 - ); + ); } } -- cgit v1.2.3