Wake up for fullscreen change events

The PropertyNotify handling has been changed in the dropgtk branch to
ignore XEvents, when redrawing was unnecessary. But when the fullscreen
state of a window changes, we can't ignore the event, because it didn't
change the screen.

Additionally, there had been a mistake in the handling of the cur_screen:
The xctx.cur_screen field will only get updated, when the application is
visible and gets redrawn. Therefore, when a PropertyNotify event arrived
while the application had been hidden and the screens do not match
anymore, wake_up() will be called albeit being unnecessary.

Calling x_win_draw() when the screens change is also the preferable
solution over wake_up(), as there is nothing subject to change in the
queues when the displays change.
This commit is contained in:
Benedikt Heine 2018-02-24 17:30:15 +01:00
parent a7bc16874d
commit 0cf4753a68

View File

@ -60,6 +60,7 @@ typedef struct _colored_layout {
} colored_layout; } colored_layout;
cairo_ctx_t cairo_ctx; cairo_ctx_t cairo_ctx;
static bool fullscreen_last = false;
/* FIXME refactor setup teardown handlers into one setup and one teardown */ /* FIXME refactor setup teardown handlers into one setup and one teardown */
static void x_shortcut_setup_error_handler(void); static void x_shortcut_setup_error_handler(void);
@ -848,6 +849,7 @@ gboolean x_mainloop_fd_check(GSource *source)
*/ */
gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
{ {
bool fullscreen_now;
XEvent ev; XEvent ev;
unsigned int state; unsigned int state;
while (XPending(xctx.dpy) > 0) { while (XPending(xctx.dpy) > 0) {
@ -910,13 +912,20 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer
wake_up(); wake_up();
break; break;
case PropertyNotify: case PropertyNotify:
fullscreen_now = have_fullscreen_window();
if (fullscreen_now != fullscreen_last) {
fullscreen_last = fullscreen_now;
wake_up();
} else if ( settings.f_mode != FOLLOW_NONE
/* Ignore PropertyNotify, when we're still on the /* Ignore PropertyNotify, when we're still on the
* same screen. PropertyNotify is only neccessary * same screen. PropertyNotify is only neccessary
* to detect a focus change to another screen * to detect a focus change to another screen
*/ */
if( settings.f_mode != FOLLOW_NONE && xctx.visible
&& get_active_screen()->scr != xctx.cur_screen) && get_active_screen()->scr != xctx.cur_screen) {
wake_up(); x_win_draw();
}
break; break;
default: default:
screen_check_event(ev); screen_check_event(ev);