Do not redraw window on PropertyChange

When receiving a PropertyChange XEvent, it's mostly because the focus of
another window changed to another window. This isn't actually neccessary
for dunst. We need the event only, to know, when the screens have
switched.

As redrawing the screen became more expensive with the drop of GTK3, we
have to ignore this event and only really redraw the window, when the
focus has moved to another screen.
This commit is contained in:
Benedikt Heine 2017-12-22 22:23:17 +01:00
parent a5d722799e
commit 8f5afaafb6
2 changed files with 11 additions and 1 deletions

View File

@ -730,6 +730,7 @@ static void x_win_move(int width, int height)
int x, y; int x, y;
screen_info *scr = get_active_screen(); screen_info *scr = get_active_screen();
xctx.cur_screen = scr->scr;
/* calculate window position */ /* calculate window position */
if (xctx.geometry.mask & XNegative) { if (xctx.geometry.mask & XNegative) {
x = (scr->dim.x + (scr->dim.w - width)) + xctx.geometry.x; x = (scr->dim.x + (scr->dim.w - width)) + xctx.geometry.x;
@ -908,7 +909,15 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer
break; break;
case FocusIn: case FocusIn:
case FocusOut: case FocusOut:
wake_up();
break;
case PropertyNotify: case PropertyNotify:
/* Ignore PropertyNotify, when we're still on the
* same screen. PropertyNotify is only neccessary
* to detect a focus change to another screen
*/
if( settings.f_mode != FOLLOW_NONE
&& get_active_screen()->scr != xctx.cur_screen)
wake_up(); wake_up();
break; break;
default: default:

View File

@ -25,6 +25,7 @@ typedef struct _keyboard_shortcut {
typedef struct _xctx { typedef struct _xctx {
Atom utf8; Atom utf8;
Display *dpy; Display *dpy;
int cur_screen;
Window win; Window win;
bool visible; bool visible;
dimension_t geometry; dimension_t geometry;