summaryrefslogtreecommitdiff
path: root/apps/x11_main.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2011-09-04 04:08:29 +0200
committerSebastian Rasmussen <sebras@gmail.com>2011-09-04 12:35:13 +0200
commitf6b4b3586cef63c68cc3a436ffdf32edb8f144cf (patch)
tree333dd6320d4e538af8388eaf178df1d608c75bad /apps/x11_main.c
parent1e96e8e23581dc44e04d5133891f477bc9a6c5d6 (diff)
downloadmupdf-f6b4b3586cef63c68cc3a436ffdf32edb8f144cf.tar.xz
Repaint only viewer search area when editing search string.
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r--apps/x11_main.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 1d18d0d5..d62c63d6 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -75,6 +75,7 @@ static int mapped = 0;
static Cursor xcarrow, xchand, xcwait;
static int justcopied = 0;
static int dirty = 0;
+static int dirtysearch = 0;
static char *password = "";
static XColor xbgcolor;
static XColor xshcolor;
@@ -276,6 +277,18 @@ static void fillrect(int x, int y, int w, int h)
XFillRectangle(xdpy, xwin, xgc, x, y, w, h);
}
+static void winblitsearch(pdfapp_t *app)
+{
+ if (gapp.isediting)
+ {
+ char buf[sizeof(gapp.search) + 50];
+ sprintf(buf, "Search: %s", gapp.search);
+ XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
+ fillrect(0, 0, gapp.winw, 30);
+ windrawstring(&gapp, 10, 20, buf);
+ }
+}
+
static void winblit(pdfapp_t *app)
{
int x0 = gapp.panx;
@@ -342,14 +355,7 @@ static void winblit(pdfapp_t *app)
justcopied = 1;
}
- if (gapp.isediting)
- {
- char buf[sizeof(gapp.search) + 50];
- sprintf(buf, "Search: %s", gapp.search);
- XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
- fillrect(0, 0, gapp.winw, 30);
- windrawstring(&gapp, 10, 20, buf);
- }
+ winblitsearch(app);
}
void winrepaint(pdfapp_t *app)
@@ -357,6 +363,11 @@ void winrepaint(pdfapp_t *app)
dirty = 1;
}
+void winrepaintsearch(pdfapp_t *app)
+{
+ dirtysearch = 1;
+}
+
void windrawstringxor(pdfapp_t *app, int x, int y, char *s)
{
int prevfunction;
@@ -636,21 +647,6 @@ int main(int argc, char **argv)
onmouse(oldx, oldy, 0, 0, 0);
- if (dirty)
- {
- winblit(&gapp);
- dirty = 0;
- }
-
- if (gapp.isediting)
- {
- char str[sizeof(gapp.search) + 50];
- sprintf(str, "Search: %s", gapp.search);
- XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
- fillrect(0, 0, gapp.winw, 30);
- windrawstring(&gapp, 10, 20, str);
- }
-
break;
case MotionNotify:
@@ -684,10 +680,17 @@ int main(int argc, char **argv)
}
while (!closing && XPending(xdpy));
- if (!closing && dirty)
+ if (closing)
+ continue;
+
+ if (dirty || dirtysearch)
{
- winblit(&gapp);
+ if (dirty)
+ winblit(&gapp);
+ else if (dirtysearch)
+ winblitsearch(&gapp);
dirty = 0;
+ dirtysearch = 0;
}
}