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
VERSION=git-20110414
VERSION=git-20110415
CC?=gcc
PREFIX?=/usr/local

37
main.c
View file

@ -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: