Browse Source

Fixed mouse cursor

master
Bert 14 years ago
parent
commit
548b383f0b
2 changed files with 20 additions and 19 deletions
  1. +1
    -1
      Makefile
  2. +19
    -18
      main.c

+ 1
- 1
Makefile 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


+ 19
- 18
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
#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 { 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)
win_set_cursor(&win, CURSOR_NONE);
/* cursor is reset in redraw() */
} }
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);
timo_cursor = TO_CURSOR_HIDE;
if (!drag) {
win_set_cursor(&win, CURSOR_ARROW);
timo_cursor = TO_CURSOR_HIDE;
}


switch (bev->button) { switch (bev->button) {
case Button1: case Button1:


Loading…
Cancel
Save