From 69100790a1c720ef6af70d0879145969172ba4c5 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Thu, 13 Sep 2018 18:04:26 +0300 Subject: [PATCH] Do not wake up on focus events Focus events do not mark any change in state of the notifications so calling wake_up as a response is a wake of CPU cycles. Instead treat them like PropertyNotify and only redraw if we need to change monitors. --- src/x11/x.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/x11/x.c b/src/x11/x.c index 21eed84..b80f4fb 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -326,22 +326,16 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer wake_up(); } 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 FocusIn: + case FocusOut: case PropertyNotify: - LOG_D("XEvent: processing 'PropertyNotify'"); + LOG_D("XEvent: Checking for active sceen changes"); fullscreen_now = have_fullscreen_window(); scr = get_active_screen();