]> git.tdb.fi Git - geometrycompositor.git/commitdiff
Clear damage before rendering the window
authorMikko Rasa <tdb@tdb.fi>
Sun, 13 Dec 2015 12:27:12 +0000 (14:27 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 13 Dec 2015 12:27:12 +0000 (14:27 +0200)
This avoids a race condition where the application might render to the
window after it has been rendered but before the damage is cleared.

source/main.c

index 1cabcf637dc992dd14dcf71656795e371e218c5a..074477bd35dca4e556b0c2cc113ddaf759d2127a 100644 (file)
@@ -1069,6 +1069,8 @@ void refresh_screen(Compositor *compositor, CompositedScreen *screen)
                if(window->map_state!=IsViewable)
                        continue;
 
+               XDamageSubtract(compositor->display, window->damage, None, None);
+
                glBindTexture(GL_TEXTURE_2D, window->texture);
                compositor->glXBindTexImageEXT(compositor->display, window->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL);
                glUniform4f(screen->geometry_loc,
@@ -1076,7 +1078,6 @@ void refresh_screen(Compositor *compositor, CompositedScreen *screen)
                        (float)(window->width+2*window->border)/screen->width, (float)(window->height+2*window->border)/screen->height);
                glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
                compositor->glXReleaseTexImageEXT(compositor->display, window->glx_pixmap, GLX_FRONT_LEFT_EXT);
-               XDamageSubtract(compositor->display, window->damage, None, None);
        }
 
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);