Fixed mouse cursor

This commit is contained in:
Bert 2011-04-15 11:23:58 +02:00
parent 0b91328181
commit 548b383f0b
2 changed files with 20 additions and 19 deletions

View file

@ -1,6 +1,6 @@
all: sxiv all: sxiv
VERSION=git-20110414 VERSION=git-20110415
CC?=gcc CC?=gcc
PREFIX?=/usr/local PREFIX?=/usr/local

37
main.c
View file

@ -38,10 +38,10 @@
#define FNAME_CNT 1024 #define FNAME_CNT 1024
#define TITLE_LEN 256 #define TITLE_LEN 256
#define TO_WIN_RESIZE 75000 typedef enum {
#define TO_IMAGE_DRAG 1000 MODE_NORMAL = 0,
#define TO_CURSOR_HIDE 1500000 MODE_THUMBS
#define TO_THUMBS_LOAD 75000 } appmode_t;
typedef struct { typedef struct {
KeySym ksym; KeySym ksym;
@ -49,11 +49,6 @@ typedef struct {
const char *cmdline; const char *cmdline;
} command_t; } command_t;
typedef enum {
MODE_NORMAL = 0,
MODE_THUMBS
} appmode_t;
#define MAIN_C #define MAIN_C
#include "config.h" #include "config.h"
@ -70,11 +65,6 @@ size_t filesize;
char win_title[TITLE_LEN]; char win_title[TITLE_LEN];
int timo_cursor;
int timo_redraw;
unsigned char drag;
int mox, moy;
void cleanup() { void cleanup() {
static int in = 0; static int in = 0;
@ -128,8 +118,7 @@ int load_image(int new) {
else else
filesize = 0; filesize = 0;
if (!timo_cursor) /* cursor is reset in redraw() */
win_set_cursor(&win, CURSOR_NONE);
} }
return 1; return 1;
} }
@ -333,6 +322,16 @@ int run_command(const char *cline, Bool reload) {
/* event handling */ /* 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() { void redraw() {
if (mode == MODE_NORMAL) { if (mode == MODE_NORMAL) {
img_render(&img, &win); img_render(&img, &win);
@ -585,8 +584,10 @@ void on_buttonpress(XButtonEvent *bev) {
changed = 0; changed = 0;
if (mode == MODE_NORMAL) { if (mode == MODE_NORMAL) {
win_set_cursor(&win, CURSOR_ARROW); if (!drag) {
timo_cursor = TO_CURSOR_HIDE; win_set_cursor(&win, CURSOR_ARROW);
timo_cursor = TO_CURSOR_HIDE;
}
switch (bev->button) { switch (bev->button) {
case Button1: case Button1: