Krolyxon
Commit 548b383

Branches

Refs →

nsxiv548b383

Fixed mouse cursor

Author
Bert
Date
2011-04-15 11:23 +0200
Parent
0b91328
Commit
548b383f0be8a8a4248fd0858cd0922c47ef4275

+20 −19

2 files changed

  1. M Makefile +1 −1
  2. M main.c +19 −18
M Makefile View
@@ -1,6 +1,6 @@
11 all: sxiv
22
3−VERSION=git-20110414
3+VERSION=git-20110415
44
55 CC?=gcc
66 PREFIX?=/usr/local
M main.c View
@@ -38,10 +38,10 @@
3838 #define FNAME_CNT 1024
3939 #define TITLE_LEN 256
4040
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;
4545
4646 typedef struct {
4747 KeySym ksym;
@@ -49,11 +49,6 @@ typedef struct {
4949 const char *cmdline;
5050 } command_t;
5151
52−typedef enum {
53− MODE_NORMAL = 0,
54− MODE_THUMBS
55−} appmode_t;
56−
5752 #define MAIN_C
5853 #include "config.h"
5954
@@ -70,11 +65,6 @@ size_t filesize;
7065
7166 char win_title[TITLE_LEN];
7267
73−int timo_cursor;
74−int timo_redraw;
75−unsigned char drag;
76−int mox, moy;
77−
7868 void cleanup() {
7969 static int in = 0;
8070
@@ -128,8 +118,7 @@ int load_image(int new) {
128118 else
129119 filesize = 0;
130120
131− if (!timo_cursor)
132− win_set_cursor(&win, CURSOR_NONE);
121+ /* cursor is reset in redraw() */
133122 }
134123 return 1;
135124 }
@@ -333,6 +322,16 @@ int run_command(const char *cline, Bool reload) {
333322
334323 /* event handling */
335324
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+
336335 void redraw() {
337336 if (mode == MODE_NORMAL) {
338337 img_render(&img, &win);
@@ -585,8 +584,10 @@ void on_buttonpress(XButtonEvent *bev) {
585584 changed = 0;
586585
587586 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+ }
590591
591592 switch (bev->button) {
592593 case Button1: