$OpenBSD: patch-apps_x11_main_c,v 1.4 2013/04/29 12:54:00 sthen Exp $

From a20d6a58ebc6c60ff44f0f385cf399ee6fca55bf Mon Sep 17 00:00:00 2001
From: Robin Watts <Robin.Watts@artifex.com>
Date: Fri, 26 Apr 2013 12:21:17 +0100
Subject: [PATCH] Fix dirty flag handling bug in X11 event loop.

--- apps/x11_main.c.orig	Mon Apr 29 13:48:12 2013
+++ apps/x11_main.c	Mon Apr 29 13:49:12 2013
@@ -79,6 +79,7 @@ static int mapped = 0;
 static Cursor xcarrow, xchand, xcwait, xccaret;
 static int justcopied = 0;
 static int dirty = 0;
+static int transition_dirty = 0;
 static int dirtysearch = 0;
 static char *password = "";
 static XColor xbgcolor;
@@ -504,6 +505,8 @@ static void winblit(pdfapp_t *app)
 void winrepaint(pdfapp_t *app)
 {
 	dirty = 1;
+	if (app->in_transit)
+		transition_dirty = 1;
 }
 
 void winrepaintsearch(pdfapp_t *app)
@@ -779,7 +782,7 @@ int main(int argc, char **argv)
 
 	while (!closing)
 	{
-		while (!closing && XPending(xdpy) && !dirty)
+		while (!closing && XPending(xdpy) && !transition_dirty)
 		{
 			XNextEvent(xdpy, &xevt);
 
@@ -886,6 +889,7 @@ int main(int argc, char **argv)
 			else if (dirtysearch)
 				winblitsearch(&gapp);
 			dirty = 0;
+			transition_dirty = 0;
 			dirtysearch = 0;
 			pdfapp_postblit(&gapp);
 		}
@@ -899,7 +903,7 @@ int main(int argc, char **argv)
 			timeradd(&now, &tmo, &tmo_at);
 		}
 
-		if (XPending(xdpy) || dirty)
+		if (XPending(xdpy) || transition_dirty)
 			continue;
 
 		timeout = NULL;
