Log XEvents by their written names

All XEvents only got logged with their IDs. It makes more sense to write
out the XEvent's name. Also, writing that we received an XEvent and then
logging again, that we ignored it, makes no sense.
This commit is contained in:
Benedikt Heine 2018-07-09 01:21:13 +02:00
parent 3c69e1f263
commit 368182f4d7
2 changed files with 15 additions and 4 deletions

View File

@ -144,10 +144,13 @@ static int autodetect_dpi(screen_info *scr)
void screen_check_event(XEvent event) void screen_check_event(XEvent event)
{ {
if (event.type == randr_event_base + RRScreenChangeNotify) if (event.type == randr_event_base + RRScreenChangeNotify) {
LOG_D("XEvent: processing 'RRScreenChangeNotify'");
randr_update(); randr_update();
else
LOG_D("XEvent: Ignored '%d'", event.type); } else {
LOG_D("XEvent: Ignoring '%d'", event.type);
}
} }
void xinerama_update(void) void xinerama_update(void)

View File

@ -274,21 +274,23 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer
unsigned int state; unsigned int state;
while (XPending(xctx.dpy) > 0) { while (XPending(xctx.dpy) > 0) {
XNextEvent(xctx.dpy, &ev); XNextEvent(xctx.dpy, &ev);
LOG_D("XEvent: processing '%d'", ev.type);
switch (ev.type) { switch (ev.type) {
case Expose: case Expose:
LOG_D("XEvent: processing 'Expose'");
if (ev.xexpose.count == 0 && win->visible) { if (ev.xexpose.count == 0 && win->visible) {
draw(); draw();
} }
break; break;
case ButtonRelease: case ButtonRelease:
LOG_D("XEvent: processing 'ButtonRelease'");
if (ev.xbutton.window == win->xwin) { if (ev.xbutton.window == win->xwin) {
x_handle_click(ev); x_handle_click(ev);
wake_up(); wake_up();
} }
break; break;
case KeyPress: case KeyPress:
LOG_D("XEvent: processing 'KeyPress'");
state = ev.xkey.state; state = ev.xkey.state;
/* NumLock is also encoded in the state. Remove it. */ /* NumLock is also encoded in the state. Remove it. */
state &= ~x_numlock_mod(); state &= ~x_numlock_mod();
@ -325,15 +327,21 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer
} }
break; break;
case FocusIn: case FocusIn:
LOG_D("XEvent: processing 'FocusIn'");
wake_up();
break;
case FocusOut: case FocusOut:
LOG_D("XEvent: processing 'FocusOut'");
wake_up(); wake_up();
break; break;
case CreateNotify: case CreateNotify:
LOG_D("XEvent: processing 'CreateNotify'");
if (win->visible && if (win->visible &&
ev.xcreatewindow.override_redirect == 0) ev.xcreatewindow.override_redirect == 0)
XRaiseWindow(xctx.dpy, win->xwin); XRaiseWindow(xctx.dpy, win->xwin);
break; break;
case PropertyNotify: case PropertyNotify:
LOG_D("XEvent: processing 'PropertyNotify'");
fullscreen_now = have_fullscreen_window(); fullscreen_now = have_fullscreen_window();
scr = get_active_screen(); scr = get_active_screen();