keypress
This commit is contained in:
parent
eceb1d206d
commit
86ee9b11bb
15
dunst.c
15
dunst.c
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
|
||||||
|
#define KEY_MASK ControlMask
|
||||||
|
#define KEY XK_space
|
||||||
|
|
||||||
#define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
|
#define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||||
@ -150,6 +153,13 @@ handleXEvents(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case KeyPress:
|
||||||
|
if (XLookupKeysym(&ev.xkey, 0) == KEY && msgqueuehead != NULL) {
|
||||||
|
msgqueuehead = pop(msgqueuehead);
|
||||||
|
if(msgqueuehead == NULL) {
|
||||||
|
hide_win();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,6 +207,7 @@ setup(void) {
|
|||||||
int x, y, screen = DefaultScreen(dc->dpy);
|
int x, y, screen = DefaultScreen(dc->dpy);
|
||||||
Window root = RootWindow(dc->dpy, screen);
|
Window root = RootWindow(dc->dpy, screen);
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
KeyCode code;
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
int n;
|
int n;
|
||||||
XineramaScreenInfo *info;
|
XineramaScreenInfo *info;
|
||||||
@ -247,6 +258,10 @@ setup(void) {
|
|||||||
|
|
||||||
XMapRaised(dc->dpy, win);
|
XMapRaised(dc->dpy, win);
|
||||||
resizedc(dc, mw, mh);
|
resizedc(dc, mw, mh);
|
||||||
|
|
||||||
|
/* grab keys */
|
||||||
|
code = XKeysymToKeycode(dc->dpy, KEY);
|
||||||
|
XGrabKey(dc->dpy, code, KEY_MASK, root, True, GrabModeAsync, GrabModeAsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user