summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2014-07-28 20:36:32 +0200
committerBert Münnich <ber.t@posteo.de>2014-07-28 20:36:32 +0200
commitbb6721549b30c33b0080975aa19a0b02a916c7e5 (patch)
tree5836842e5120d9dcdeee1e0efaf94c34d35a04e2 /main.c
parent5e481912ec983be89f10cbbb21561ed7cc898027 (diff)
downloadnsxiv-bb6721549b30c33b0080975aa19a0b02a916c7e5.tar.zst
Overhauled window drawing, yet again; fixes issue #155
- Buffer for window content is bigger than the window, minimizes artifacts when window is resized - Back to using XSetWindowBackgroundPixmap() instead of XCopyArea(), no need to handle exposure events; X server can show gray background directly after resize event before sxiv redraws the window contents
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/main.c b/main.c
index 6db8a44..cb4460d 100644
--- a/main.c
+++ b/main.c
@@ -301,7 +301,7 @@ void read_info(void)
end:
info.i -= info.lastsep;
win.bar.l[info.i] = '\0';
- win_update_bar(&win);
+ win_draw(&win);
close(info.fd);
info.fd = -1;
while (waitpid(-1, NULL, WNOHANG) > 0);
@@ -487,7 +487,7 @@ void run_key_handler(const char *key, unsigned int mask)
if (restore_bar)
memcpy(oldbar, win.bar.l, sizeof(win.bar.l));
strncpy(win.bar.l, "Running key handler...", sizeof(win.bar.l));
- win_update_bar(&win);
+ win_draw(&win);
win_set_cursor(&win, CURSOR_WATCH);
stat(files[n].path, &oldst);
@@ -512,7 +512,7 @@ void run_key_handler(const char *key, unsigned int mask)
}
restore_bar = false;
strncpy(win.bar.l, "Reloading image...", sizeof(win.bar.l));
- win_update_bar(&win);
+ win_draw(&win);
if (mode == MODE_IMAGE) {
img_close(&img, true);
@@ -529,7 +529,7 @@ void run_key_handler(const char *key, unsigned int mask)
end:
if (restore_bar)
memcpy(win.bar.l, oldbar, sizeof(win.bar.l));
- set_timeout(reset_cursor, TO_CURSOR_HIDE, true);
+ reset_cursor();
redraw();
}
@@ -732,9 +732,6 @@ void run(void)
}
}
break;
- case Expose:
- win_expose(&win, &ev.xexpose);
- break;
case KeyPress:
on_keypress(&ev.xkey);
break;
@@ -870,6 +867,7 @@ int main(int argc, char **argv)
}
win_open(&win);
+ win_set_cursor(&win, CURSOR_WATCH);
run();
cleanup();