From bb6721549b30c33b0080975aa19a0b02a916c7e5 Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Mon, 28 Jul 2014 20:36:32 +0200 Subject: 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 --- main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'main.c') 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(); -- cgit v1.2.3-70-g09d2