summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2013-04-26 12:21:17 +0100
committerRobin Watts <robin.watts@artifex.com>2013-04-26 14:42:55 +0100
commita20d6a58ebc6c60ff44f0f385cf399ee6fca55bf (patch)
tree196f3645b4a999d56bebd8ebfbd9fbffc873f09f /apps
parent2172fe392a373d75ed4ac7c7730397e1349e1730 (diff)
downloadmupdf-a20d6a58ebc6c60ff44f0f385cf399ee6fca55bf.tar.xz
Fix dirty flag handling bug in X11 event loop.
When I added transition handling to mupdf, I broke the X11 behaviour of coalescing all events and only blitting when idle. This commit restores that behaviour, except when transitions are actually in progress (when it still blits instantly).
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfapp.c6
-rw-r--r--apps/x11_main.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index c3b7d54f..ff23c4b2 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -1677,7 +1677,6 @@ void pdfapp_postblit(pdfapp_t *app)
if (llama >= 256)
{
/* Completed. */
- app->in_transit = 0;
fz_drop_pixmap(app->ctx, app->image);
app->image = app->new_image;
app->new_image = NULL;
@@ -1689,4 +1688,9 @@ void pdfapp_postblit(pdfapp_t *app)
else
fz_generate_transition(app->image, app->old_image, app->new_image, llama, &app->transition);
winrepaint(app);
+ if (llama >= 256)
+ {
+ /* Completed. */
+ app->in_transit = 0;
+ }
}
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 364013c8..987e3594 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -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;