aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-17 11:08:25 +0100
committerBert <ber.t@gmx.com>2011-02-17 11:08:25 +0100
commit783213c0bbc1b52504c346588742095a766f052d (patch)
tree8c79eaa89cbd1167f1bf33537e31841b92d9abb3
parentbcc70bd7cbcdf56e84984929d9f8c6f1776f2204 (diff)
Use watch-cursor while loading thumbnails
-rw-r--r--main.c5
-rw-r--r--window.c22
-rw-r--r--window.h3
3 files changed, 20 insertions, 10 deletions
diff --git a/main.c b/main.c
index ec770e6..d54cda5 100644
--- a/main.c
+++ b/main.c
@@ -476,9 +476,12 @@ void run() {
while (1) {
if (mode == MODE_THUMBS && tns_loaded < filecnt) {
+ win_set_cursor(&win, CURSOR_WATCH);
tns_load(&tns, &win, filenames[tns_loaded++]);
tns_render(&tns, &win);
- if (!XPending(win.env.dpy))
+ if (tns_loaded == filecnt)
+ win_set_cursor(&win, CURSOR_ARROW);
+ else if (!XPending(win.env.dpy))
continue;
} else if (timeout) {
t.tv_sec = 0;
diff --git a/window.c b/window.c
index 0ea3fba..35a37fe 100644
--- a/window.c
+++ b/window.c
@@ -26,8 +26,9 @@
#include "util.h"
#include "window.h"
-static Cursor arrow;
-static Cursor hand;
+static Cursor carrow;
+static Cursor chand;
+static Cursor cwatch;
static GC bgc;
Atom wm_delete_win;
@@ -107,8 +108,9 @@ void win_open(win_t *win) {
XSelectInput(e->dpy, win->xwin, StructureNotifyMask | KeyPressMask |
ButtonPressMask | ButtonReleaseMask | Button2MotionMask);
- arrow = XCreateFontCursor(e->dpy, XC_left_ptr);
- hand = XCreateFontCursor(e->dpy, XC_fleur);
+ carrow = XCreateFontCursor(e->dpy, XC_left_ptr);
+ chand = XCreateFontCursor(e->dpy, XC_fleur);
+ cwatch = XCreateFontCursor(e->dpy, XC_watch);
bgc = XCreateGC(e->dpy, win->xwin, 0, None);
@@ -135,8 +137,9 @@ void win_close(win_t *win) {
if (!win)
return;
- XFreeCursor(win->env.dpy, arrow);
- XFreeCursor(win->env.dpy, hand);
+ XFreeCursor(win->env.dpy, carrow);
+ XFreeCursor(win->env.dpy, chand);
+ XFreeCursor(win->env.dpy, cwatch);
XFreeGC(win->env.dpy, bgc);
@@ -281,11 +284,14 @@ void win_set_cursor(win_t *win, win_cur_t cursor) {
switch (cursor) {
case CURSOR_HAND:
- XDefineCursor(win->env.dpy, win->xwin, hand);
+ XDefineCursor(win->env.dpy, win->xwin, chand);
+ break;
+ case CURSOR_WATCH:
+ XDefineCursor(win->env.dpy, win->xwin, cwatch);
break;
case CURSOR_ARROW:
default:
- XDefineCursor(win->env.dpy, win->xwin, arrow);
+ XDefineCursor(win->env.dpy, win->xwin, carrow);
break;
}
}
diff --git a/window.h b/window.h
index c51a26e..f00af22 100644
--- a/window.h
+++ b/window.h
@@ -25,7 +25,8 @@
typedef enum win_cur_e {
CURSOR_ARROW = 0,
- CURSOR_HAND
+ CURSOR_HAND,
+ CURSOR_WATCH
} win_cur_t;
typedef struct win_env_s {