aboutsummaryrefslogtreecommitdiffstats
path: root/xlib.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-07 23:46:06 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-07 23:46:06 -0400
commit65427c6bd766998980fcc3da753f026a56be5332 (patch)
treec587b6943b951162b2659b339f1f869dc67dc0a4 /xlib.c
parent133d3a7c48dc780982622215a3dc0f58abb6cf55 (diff)
downloadrunes-65427c6bd766998980fcc3da753f026a56be5332.tar.gz
runes-65427c6bd766998980fcc3da753f026a56be5332.zip
support _NET_WM_PING
Diffstat (limited to 'xlib.c')
-rw-r--r--xlib.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/xlib.c b/xlib.c
index 02fab41..b0937a0 100644
--- a/xlib.c
+++ b/xlib.c
@@ -6,7 +6,8 @@
#include "runes.h"
static char *atom_names[RUNES_NUM_ATOMS] = {
- "WM_DELETE_WINDOW"
+ "WM_DELETE_WINDOW",
+ "_NET_WM_PING"
};
RunesWindow *runes_window_create()
@@ -110,11 +111,21 @@ static void runes_process_event(uv_work_t *req, int status)
free(buf);
break;
}
- case ClientMessage:
- if ((Atom)e->xclient.data.l[0] == t->w->atoms[RUNES_ATOM_WM_DELETE_WINDOW]) {
+ case ClientMessage: {
+ Atom a = e->xclient.data.l[0];
+ if (a == t->w->atoms[RUNES_ATOM_WM_DELETE_WINDOW]) {
runes_handle_close_window(t);
}
+ else if (a == t->w->atoms[RUNES_ATOM_NET_WM_PING]) {
+ e->xclient.window = DefaultRootWindow(t->w->dpy);
+ XSendEvent(
+ t->w->dpy, e->xclient.window, False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ e
+ );
+ }
break;
+ }
default:
break;
}
@@ -139,7 +150,7 @@ void runes_loop_init(RunesTerm *t, uv_loop_t *loop)
((struct loop_data *)data)->t = t;
XInternAtoms(t->w->dpy, atom_names, RUNES_NUM_ATOMS, False, t->w->atoms);
- XSetWMProtocols(t->w->dpy, t->w->w, &t->w->atoms[RUNES_ATOM_WM_DELETE_WINDOW], 1);
+ XSetWMProtocols(t->w->dpy, t->w->w, t->w->atoms, RUNES_NUM_ATOMS);
uv_queue_work(loop, data, runes_get_next_event, runes_process_event);
}