nsxiv548b383
Fixed mouse cursor
+20 −19
2 files changed
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | all: sxiv | |
| 2 | 2 | ||
| 3 | − | VERSION=git-20110414 | |
| 3 | + | VERSION=git-20110415 | |
| 4 | 4 | ||
| 5 | 5 | CC?=gcc | |
| 6 | 6 | PREFIX?=/usr/local | |
| @@ -38,10 +38,10 @@ | |||
| 38 | 38 | #define FNAME_CNT 1024 | |
| 39 | 39 | #define TITLE_LEN 256 | |
| 40 | 40 | ||
| 41 | − | #define TO_WIN_RESIZE 75000 | |
| 42 | − | #define TO_IMAGE_DRAG 1000 | |
| 43 | − | #define TO_CURSOR_HIDE 1500000 | |
| 44 | − | #define TO_THUMBS_LOAD 75000 | |
| 41 | + | typedef enum { | |
| 42 | + | MODE_NORMAL = 0, | |
| 43 | + | MODE_THUMBS | |
| 44 | + | } appmode_t; | |
| 45 | 45 | ||
| 46 | 46 | typedef struct { | |
| 47 | 47 | KeySym ksym; | |
| @@ -49,11 +49,6 @@ typedef struct { | |||
| 49 | 49 | const char *cmdline; | |
| 50 | 50 | } command_t; | |
| 51 | 51 | ||
| 52 | − | typedef enum { | |
| 53 | − | MODE_NORMAL = 0, | |
| 54 | − | MODE_THUMBS | |
| 55 | − | } appmode_t; | |
| 56 | − | ||
| 57 | 52 | #define MAIN_C | |
| 58 | 53 | #include "config.h" | |
| 59 | 54 | ||
| @@ -70,11 +65,6 @@ size_t filesize; | |||
| 70 | 65 | ||
| 71 | 66 | char win_title[TITLE_LEN]; | |
| 72 | 67 | ||
| 73 | − | int timo_cursor; | |
| 74 | − | int timo_redraw; | |
| 75 | − | unsigned char drag; | |
| 76 | − | int mox, moy; | |
| 77 | − | ||
| 78 | 68 | void cleanup() { | |
| 79 | 69 | static int in = 0; | |
| 80 | 70 | ||
| @@ -128,8 +118,7 @@ int load_image(int new) { | |||
| 128 | 118 | else | |
| 129 | 119 | filesize = 0; | |
| 130 | 120 | ||
| 131 | − | if (!timo_cursor) | |
| 132 | − | win_set_cursor(&win, CURSOR_NONE); | |
| 121 | + | /* cursor is reset in redraw() */ | |
| 133 | 122 | } | |
| 134 | 123 | return 1; | |
| 135 | 124 | } | |
| @@ -333,6 +322,16 @@ int run_command(const char *cline, Bool reload) { | |||
| 333 | 322 | ||
| 334 | 323 | /* event handling */ | |
| 335 | 324 | ||
| 325 | + | #define TO_WIN_RESIZE 75000 | |
| 326 | + | #define TO_IMAGE_DRAG 1000 | |
| 327 | + | #define TO_CURSOR_HIDE 1500000 | |
| 328 | + | #define TO_THUMBS_LOAD 75000 | |
| 329 | + | ||
| 330 | + | int timo_cursor; | |
| 331 | + | int timo_redraw; | |
| 332 | + | unsigned char drag; | |
| 333 | + | int mox, moy; | |
| 334 | + | ||
| 336 | 335 | void redraw() { | |
| 337 | 336 | if (mode == MODE_NORMAL) { | |
| 338 | 337 | img_render(&img, &win); | |
| @@ -585,8 +584,10 @@ void on_buttonpress(XButtonEvent *bev) { | |||
| 585 | 584 | changed = 0; | |
| 586 | 585 | ||
| 587 | 586 | if (mode == MODE_NORMAL) { | |
| 588 | − | win_set_cursor(&win, CURSOR_ARROW); | |
| 589 | − | timo_cursor = TO_CURSOR_HIDE; | |
| 587 | + | if (!drag) { | |
| 588 | + | win_set_cursor(&win, CURSOR_ARROW); | |
| 589 | + | timo_cursor = TO_CURSOR_HIDE; | |
| 590 | + | } | |
| 590 | 591 | ||
| 591 | 592 | switch (bev->button) { | |
| 592 | 593 | case Button1: | |