aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-04-15 11:23:58 +0200
committerBert <ber.t@gmx.com>2011-04-15 11:23:58 +0200
commit548b383f0be8a8a4248fd0858cd0922c47ef4275 (patch)
treeaba9fd1cd35d74bfa811115e75aa10d85f54a45a
parent0b9132818134d8f7ec3dbd8685115377d1eabeba (diff)
Fixed mouse cursor
-rw-r--r--Makefile2
-rw-r--r--main.c37
2 files changed, 20 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 24a60ff..1178c8b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
all: sxiv
-VERSION=git-20110414
+VERSION=git-20110415
CC?=gcc
PREFIX?=/usr/local
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: