From b17a26a5c9259c52f81d95bcdac4a0df5c6a5854 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 8 Apr 2014 00:36:47 -0400 Subject: handle most of the rest of the wm properties --- xlib.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'xlib.c') diff --git a/xlib.c b/xlib.c index 171ba12..88ee81f 100644 --- a/xlib.c +++ b/xlib.c @@ -1,16 +1,49 @@ #include #include #include +#include #include +#include +#include #include "runes.h" static char *atom_names[RUNES_NUM_ATOMS] = { "WM_DELETE_WINDOW", - "_NET_WM_PING" + "_NET_WM_PING", + "_NET_WM_PID", + "_NET_WM_ICON_NAME", + "_NET_WM_NAME", + "UTF8_STRING" }; -RunesWindow *runes_window_create() +static void runes_init_wm_properties(RunesWindow *w, int argc, char *argv[]) +{ + pid_t pid; + XClassHint class_hints = { "runes", "runes" }; + XWMHints wm_hints; + XSizeHints normal_hints; + + wm_hints.flags = InputHint | StateHint; + wm_hints.input = True; + wm_hints.initial_state = NormalState; + + /* XXX */ + normal_hints.flags = 0; + + XInternAtoms(w->dpy, atom_names, RUNES_NUM_ATOMS, False, w->atoms); + XSetWMProtocols(w->dpy, w->w, w->atoms, RUNES_NUM_PROTOCOL_ATOMS); + + Xutf8SetWMProperties(w->dpy, w->w, "runes", "runes", argv, argc, &normal_hints, &wm_hints, &class_hints); + + pid = getpid(); + XChangeProperty(w->dpy, w->w, w->atoms[RUNES_ATOM_NET_WM_PID], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1); + + XChangeProperty(w->dpy, w->w, w->atoms[RUNES_ATOM_NET_WM_ICON_NAME], w->atoms[RUNES_ATOM_UTF8_STRING], 8, PropModeReplace, (unsigned char *)"runes", 5); + XChangeProperty(w->dpy, w->w, w->atoms[RUNES_ATOM_NET_WM_NAME], w->atoms[RUNES_ATOM_UTF8_STRING], 8, PropModeReplace, (unsigned char *)"runes", 5); +} + +RunesWindow *runes_window_create(int argc, char *argv[]) { RunesWindow *w; unsigned long white; @@ -53,8 +86,7 @@ RunesWindow *runes_window_create() exit(1); } - XInternAtoms(w->dpy, atom_names, RUNES_NUM_ATOMS, False, w->atoms); - XSetWMProtocols(w->dpy, w->w, w->atoms, RUNES_NUM_ATOMS); + runes_init_wm_properties(w, argc, argv); return w; } -- cgit v1.2.3-54-g00ecf