Hello comrades,
attached is a patch for setting the window properties of svkbd.
It is setting the magic »_NET_WM_WINDOW_TYPE« too, so dwm can
use it.
Sincerely,
Christoph Lohmann
diff -r b49d35af54a9 svkbd.c
--- a/svkbd.c Thu Mar 24 21:02:10 2011 +0100
+++ b/svkbd.c Thu Mar 24 23:34:10 2011 +0100
@@ -20,6 +20,7 @@
/* enums */
enum { ColFG, ColBG, ColLast };
+enum { NetWMWindowType, NetLast };
/* typedefs */
typedef unsigned int uint;
@@ -83,6 +84,7 @@
[Expose] = expose,
[LeaveNotify] = leavenotify,
};
+static Atom netatom[NetLast];
static Display *dpy;
static DC dc;
static Window root, win;
@@ -309,14 +311,21 @@
void
setup(void) {
int i;
+ XSetWindowAttributes wa;
+ XTextProperty str;
+ XClassHint *ch;
XWMHints *wmh;
- XSetWindowAttributes wa;
+ char *name = "svkbd";
+ char *wintype = "_NET_WM_WINDOW_TYPE_TOOLBAR";
/* init screen */
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
initfont(font);
+ /* init atoms */
+ netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE",
False);
+
/* init appearance */
if (!ww)
ww = DisplayWidth(dpy, screen);
@@ -324,7 +333,7 @@
ww = DisplayWidth(dpy, screen) / (ww * -1);
if (wh < 0)
- wh = DisplayHeight(dpy, screen) / (wh * -1);
+ wh = DisplayHeight(dpy, screen) / (wh * -1);
if (wy < 0)
wy = DisplayHeight(dpy, screen) + wy;
@@ -351,11 +360,27 @@
CWOverrideRedirect | CWBorderPixel |
CWBackingPixel, &wa);
XSelectInput(dpy, win, StructureNotifyMask|ButtonReleaseMask|
ButtonPressMask|ExposureMask|LeaveWindowMask);
+
wmh = XAllocWMHints();
wmh->input = False;
wmh->flags = InputHint;
XSetWMHints(dpy, win, wmh);
+ XStringListToTextProperty(&name, 1, &str);
+ ch = XAllocClassHint();
+ ch->res_class = name;
+ ch->res_name = name;
+
+ XSetWMProperties(dpy, win, &str, &str, NULL, 0, NULL, wmh,
+ ch);
+
+ XFree(ch);
XFree(wmh);
+ XFree(str.value);
+
+ XStringListToTextProperty(&wintype, 1, &str);
+ XSetTextProperty(dpy, win, &str, netatom[NetWMWindowType]);
+ XFree(str.value);
+
XMapRaised(dpy, win);
updatekeys();
drawkeyboard();