From: Ingo Bürk Date: Fri, 13 Jan 2017 17:34:58 +0000 (+0100) Subject: Only react on the last Expose event in a series of events. (#2636) X-Git-Tag: 4.14~67 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d58dbc3;p=i3%2Fi3 Only react on the last Expose event in a series of events. (#2636) Thanks to @psychon for pointing this out during the review of PR #2624. This commit extends this change to all other occurences of Expose events within i3. --- diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index 9e851c06..8eec941c 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -966,7 +966,10 @@ int main(int argc, char *argv[]) { break; case XCB_EXPOSE: - handle_expose(); + if (((xcb_expose_event_t *)event)->count == 0) { + handle_expose(); + } + break; } diff --git a/i3-input/main.c b/i3-input/main.c index 0f07c845..6d1e3378 100644 --- a/i3-input/main.c +++ b/i3-input/main.c @@ -525,7 +525,10 @@ int main(int argc, char *argv[]) { break; case XCB_EXPOSE: - handle_expose(NULL, conn, (xcb_expose_event_t *)event); + if (((xcb_expose_event_t *)event)->count == 0) { + handle_expose(NULL, conn, (xcb_expose_event_t *)event); + } + break; } diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index b9f27a87..eb25e9cb 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -596,7 +596,10 @@ int main(int argc, char *argv[]) { switch (type) { case XCB_EXPOSE: - handle_expose(conn, (xcb_expose_event_t *)event); + if (((xcb_expose_event_t *)event)->count == 0) { + handle_expose(conn, (xcb_expose_event_t *)event); + } + break; case XCB_BUTTON_PRESS: diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index d3bfca69..edef9b7e 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -1149,8 +1149,11 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) { handle_visibility_notify((xcb_visibility_notify_event_t *)event); break; case XCB_EXPOSE: - /* Expose-events happen, when the window needs to be redrawn */ - redraw_bars(); + if (((xcb_expose_event_t *)event)->count == 0) { + /* Expose-events happen, when the window needs to be redrawn */ + redraw_bars(); + } + break; case XCB_BUTTON_PRESS: /* Button press events are mouse buttons clicked on one of our bars */ diff --git a/src/handlers.c b/src/handlers.c index 6d7be465..315688c4 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -1511,7 +1511,10 @@ void handle_event(int type, xcb_generic_event_t *event) { break; case XCB_EXPOSE: - handle_expose_event((xcb_expose_event_t *)event); + if (((xcb_expose_event_t *)event)->count == 0) { + handle_expose_event((xcb_expose_event_t *)event); + } + break; case XCB_MOTION_NOTIFY: diff --git a/src/restore_layout.c b/src/restore_layout.c index d48e5c6e..9edf4b11 100644 --- a/src/restore_layout.c +++ b/src/restore_layout.c @@ -360,7 +360,10 @@ static void configure_notify(xcb_configure_notify_event_t *event) { static void restore_handle_event(int type, xcb_generic_event_t *event) { switch (type) { case XCB_EXPOSE: - expose_event((xcb_expose_event_t *)event); + if (((xcb_expose_event_t *)event)->count == 0) { + expose_event((xcb_expose_event_t *)event); + } + break; case XCB_CONFIGURE_NOTIFY: configure_notify((xcb_configure_notify_event_t *)event);