From 368182f4d751c033d8a6e281e6a13ebeef753c44 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 9 Jul 2018 01:21:13 +0200 Subject: [PATCH] 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. --- src/x11/screen.c | 9 ++++++--- src/x11/x.c | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/x11/screen.c b/src/x11/screen.c index 1dfb4d2..185a607 100644 --- a/src/x11/screen.c +++ b/src/x11/screen.c @@ -144,10 +144,13 @@ static int autodetect_dpi(screen_info *scr) 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(); - else - LOG_D("XEvent: Ignored '%d'", event.type); + + } else { + LOG_D("XEvent: Ignoring '%d'", event.type); + } } void xinerama_update(void) diff --git a/src/x11/x.c b/src/x11/x.c index 60649d0..8e94598 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -274,21 +274,23 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer unsigned int state; while (XPending(xctx.dpy) > 0) { XNextEvent(xctx.dpy, &ev); - LOG_D("XEvent: processing '%d'", ev.type); switch (ev.type) { case Expose: + LOG_D("XEvent: processing 'Expose'"); if (ev.xexpose.count == 0 && win->visible) { draw(); } break; case ButtonRelease: + LOG_D("XEvent: processing 'ButtonRelease'"); if (ev.xbutton.window == win->xwin) { x_handle_click(ev); wake_up(); } break; case KeyPress: + LOG_D("XEvent: processing 'KeyPress'"); state = ev.xkey.state; /* NumLock is also encoded in the state. Remove it. */ state &= ~x_numlock_mod(); @@ -325,15 +327,21 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer } break; case FocusIn: + LOG_D("XEvent: processing 'FocusIn'"); + wake_up(); + break; case FocusOut: + LOG_D("XEvent: processing 'FocusOut'"); wake_up(); break; case CreateNotify: + LOG_D("XEvent: processing 'CreateNotify'"); if (win->visible && ev.xcreatewindow.override_redirect == 0) XRaiseWindow(xctx.dpy, win->xwin); break; case PropertyNotify: + LOG_D("XEvent: processing 'PropertyNotify'"); fullscreen_now = have_fullscreen_window(); scr = get_active_screen();