]> git.sur5r.net Git - i3/i3/commitdiff
x: set the contents of a decoration window immediately after changing its size
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jul 2011 18:08:40 +0000 (20:08 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jul 2011 18:08:40 +0000 (20:08 +0200)
Reduces flickering. A window loses its contents when being resized, so we have
to restore them as fast as possible.

src/x.c

diff --git a/src/x.c b/src/x.c
index 061984f6deb15293ec042864ebec03487f86bc2e..492442a76a251c05d9c29417b0837e834ba66f73 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -585,7 +585,14 @@ void x_push_node(Con *con) {
         }
 
         DLOG("setting rect (%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);
+        /* flush to ensure that the following commands are sent in a single
+         * buffer and will be processed directly afterwards (the contents of a
+         * window get lost when resizing it, therefore we want to provide it as
+         * fast as possible) */
+        xcb_flush(conn);
         xcb_set_window_rect(conn, con->frame, rect);
+        xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height);
+        xcb_flush(conn);
 
         memcpy(&(state->rect), &rect, sizeof(Rect));
         fake_notify = true;