Variable timeout (2)

This commit is contained in:
Bert 2011-02-17 17:32:29 +01:00
commit e2ef9b8323

10
main.c
View File

@ -255,7 +255,7 @@ void read_dir_rec(const char *dirname) {
/* event handling */ /* event handling */
unsigned char timeout; int timeout;
int mox, moy; int mox, moy;
void redraw() { void redraw() {
@ -515,7 +515,7 @@ void on_motionnotify(XMotionEvent *mev) {
if (mev->x >= 0 && mev->x <= win.w && mev->y >= 0 && mev->y <= win.h) { if (mev->x >= 0 && mev->x <= win.w && mev->y >= 0 && mev->y <= win.h) {
if (img_move(&img, &win, mev->x - mox, mev->y - moy)) if (img_move(&img, &win, mev->x - mox, mev->y - moy))
timeout = 1; timeout = 1000;
mox = mev->x; mox = mev->x;
moy = mev->y; moy = mev->y;
@ -547,11 +547,11 @@ void run() {
redraw(); redraw();
continue; continue;
} else { } else {
timeout = 1; timeout = 75000;
} }
} else if (timeout) { } else if (timeout) {
t.tv_sec = 0; t.tv_sec = 0;
t.tv_usec = 75000; t.tv_usec = timeout;
xfd = ConnectionNumber(win.env.dpy); xfd = ConnectionNumber(win.env.dpy);
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(xfd, &fds); FD_SET(xfd, &fds);
@ -577,7 +577,7 @@ void run() {
break; break;
case ConfigureNotify: case ConfigureNotify:
if (win_configure(&win, &ev.xconfigure)) { if (win_configure(&win, &ev.xconfigure)) {
timeout = 1; timeout = 75000;
if (mode == MODE_NORMAL) if (mode == MODE_NORMAL)
img.checkpan = 1; img.checkpan = 1;
} }