Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Remove dumb middle button emulation code f...



details:   https://anonhg.NetBSD.org/src/rev/126a395cc745
branches:  trunk
changeset: 951911:126a395cc745
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Feb 07 16:13:56 2021 +0000

description:
Remove dumb middle button emulation code from the ms(4) driver.

Also fix leftover comments (derived from the original Sun's "firm_event"
implementation as seen in sys/dev/sun/ms.c) to sync with reality on x68k.

The current implementation the ms(4) driver just checks whether
two (left/right) buttons are changed in the same packet.
This means it cannot handle a release event correctly if two
buttons pressed simultaneously are released in the different timing.

The middle button emulation should be handled in application layer
as other Xservers do, and I'll import Emulate3Buttons support for the
X68k Xorg based monolithic server.

See my post on port-x68k@ for details:
 https://mail-index.netbsd.org/port-x68k/2021/02/05/msg000074.html

diffstat:

 sys/arch/x68k/dev/ms.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 0c3db11c17fc -r 126a395cc745 sys/arch/x68k/dev/ms.c
--- a/sys/arch/x68k/dev/ms.c    Sun Feb 07 15:54:09 2021 +0000
+++ b/sys/arch/x68k/dev/ms.c    Sun Feb 07 16:13:56 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ms.c,v 1.34 2014/07/25 08:10:35 dholland Exp $ */
+/*     $NetBSD: ms.c,v 1.35 2021/02/07 16:13:56 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.34 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.35 2021/02/07 16:13:56 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -356,8 +356,8 @@
 {
        struct firm_event *fe;
        int mb, ub, d, get, put, any;
-       static const char to_one[] = { 1, 2, 3 };
-       static const int to_id[] = { MS_LEFT, MS_RIGHT, MS_MIDDLE };
+       static const char to_one[] = { 1, 2, 2 };
+       static const int to_id[] = { MS_LEFT, MS_RIGHT };
 
        /*
         * Discard input if not ready.  Drop sync on parity or framing
@@ -402,7 +402,7 @@
 
        /*
         * We have at least one event (mouse button, delta-X, or
-        * delta-Y; possibly all three, and possibly three separate
+        * delta-Y; possibly all three, and possibly two separate
         * button events).  Deliver these events until we are out
         * of changes or out of room.  As events get delivered,
         * mark them `unchanged'.
@@ -430,12 +430,12 @@
        ub = ms->ms_ub;
        while ((d = mb ^ ub) != 0) {
                /*
-                * Mouse button change.  Convert up to three changes
+                * Mouse button change.  Convert up to two changes
                 * to the `first' change, and drop it into the event queue.
                 */
                NEXT;
-               d = to_one[d - 1];              /* from 1..7 to {1,2,4} */
-               fe->id = to_id[d - 1];          /* from {1,2,4} to ID */
+               d = to_one[d - 1];              /* from 1..3 to {1,2} */
+               fe->id = to_id[d - 1];          /* from {1,2} to ID */
                fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
                firm_gettime(fe);
                ADVANCE;



Home | Main Index | Thread Index | Old Index