From 548b383f0be8a8a4248fd0858cd0922c47ef4275 Mon Sep 17 00:00:00 2001 From: Bert Date: Fri, 15 Apr 2011 11:23:58 +0200 Subject: Fixed mouse cursor --- main.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index b8b189d..5892f18 100644 --- a/main.c +++ b/main.c @@ -38,10 +38,10 @@ #define FNAME_CNT 1024 #define TITLE_LEN 256 -#define TO_WIN_RESIZE 75000 -#define TO_IMAGE_DRAG 1000 -#define TO_CURSOR_HIDE 1500000 -#define TO_THUMBS_LOAD 75000 +typedef enum { + MODE_NORMAL = 0, + MODE_THUMBS +} appmode_t; typedef struct { KeySym ksym; @@ -49,11 +49,6 @@ typedef struct { const char *cmdline; } command_t; -typedef enum { - MODE_NORMAL = 0, - MODE_THUMBS -} appmode_t; - #define MAIN_C #include "config.h" @@ -70,11 +65,6 @@ size_t filesize; char win_title[TITLE_LEN]; -int timo_cursor; -int timo_redraw; -unsigned char drag; -int mox, moy; - void cleanup() { static int in = 0; @@ -128,8 +118,7 @@ int load_image(int new) { else filesize = 0; - if (!timo_cursor) - win_set_cursor(&win, CURSOR_NONE); + /* cursor is reset in redraw() */ } return 1; } @@ -333,6 +322,16 @@ int run_command(const char *cline, Bool reload) { /* event handling */ +#define TO_WIN_RESIZE 75000 +#define TO_IMAGE_DRAG 1000 +#define TO_CURSOR_HIDE 1500000 +#define TO_THUMBS_LOAD 75000 + +int timo_cursor; +int timo_redraw; +unsigned char drag; +int mox, moy; + void redraw() { if (mode == MODE_NORMAL) { img_render(&img, &win); @@ -585,8 +584,10 @@ void on_buttonpress(XButtonEvent *bev) { changed = 0; if (mode == MODE_NORMAL) { - win_set_cursor(&win, CURSOR_ARROW); - timo_cursor = TO_CURSOR_HIDE; + if (!drag) { + win_set_cursor(&win, CURSOR_ARROW); + timo_cursor = TO_CURSOR_HIDE; + } switch (bev->button) { case Button1: -- cgit v1.2.3-54-g00ecf