Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/wsmoused change the comparisons to account for the ...



details:   https://anonhg.NetBSD.org/src/rev/6ba82944cb79
branches:  trunk
changeset: 533499:6ba82944cb79
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jul 02 12:41:26 2002 +0000

description:
change the comparisons to account for the unsigness of the variables.
>From Julio Merino.

diffstat:

 usr.sbin/wsmoused/events.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r fda98efb073c -r 6ba82944cb79 usr.sbin/wsmoused/events.c
--- a/usr.sbin/wsmoused/events.c        Tue Jul 02 11:49:19 2002 +0000
+++ b/usr.sbin/wsmoused/events.c        Tue Jul 02 12:41:26 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: events.c,v 1.1 2002/06/26 23:13:07 christos Exp $ */
+/* $NetBSD: events.c,v 1.2 2002/07/02 12:41:26 christos Exp $ */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: events.c,v 1.1 2002/06/26 23:13:07 christos Exp $");
+__RCSID("$NetBSD: events.c,v 1.2 2002/07/02 12:41:26 christos Exp $");
 #endif /* not lint */
 
 #include <sys/ioctl.h>
@@ -66,8 +66,7 @@
                if (m->count_col >= m->slowdown_x) {
                        m->count_col = 0;
                        if (evt->value > 0) m->col++;
-                       else m->col--;
-                       if (m->col < 0) m->col = 0;
+                       else if (m->col != 0) m->col--;
                        if (m->col > m->max_col) m->col = m->max_col;
                } else
                        m->count_col++;
@@ -76,9 +75,8 @@
        case WSCONS_EVENT_MOUSE_DELTA_Y:
                if (m->count_row >= m->slowdown_y) {
                        m->count_row = 0;
-                       if (evt->value > 0) m->row--;
-                       else m->row++;
-                       if (m->row < 0) m->row = 0;
+                       if (evt->value < 0) m->row++;
+                       else if (m->row != 0) m->row--;
                        if (m->row > m->max_row) m->row = m->max_row;
                } else
                        m->count_row++;



Home | Main Index | Thread Index | Old Index