[BUG][FIX] Re: 3.0 for unix: No mouse wheel, -noevents doesn't work

Ned Konz ned at bike-nomad.com
Thu Feb 8 06:44:07 UTC 2001


On Wednesday 07 February 2001 16:58, Ian Piumarta wrote:
> is available at
>
>  
> ftp://ftp.inria.fr/INRIA/Projects/SOR/users/piumarta/squeak/Squeak-3.0pre1.
>tar.gz
>
> for any intrepid explorers who might want to try it out.  

Thanks, Ian!

I just compared it to a 3.0 VM built from your 2.8pre5 sources with newer 
generated code, and noticed that:

* The mouse wheel no longer works (something to do with the event stuff?)
The mouse wheel is reported as ButtonPress and ButtonRelease events with 
button numbers of 4 (up) and 5 (down).

* -noevents causes mouse events to not be reported to the image at all 
(though interrupt keystrokes seem to get through)

This was the case both on a 3.0 and a 2.9alpha image. The mouse wheel works 
with the 3.0 VM built from the 2.8pre5 code.

The problem appears to be in the processing of the mouse down event. Without 
events, this code in recordMouseDown appends a keycode to the keyboard buffer 
for mouse wheel events:

    case 4: /* Mouse wheel support */
    case 5: keyBufAppend( (theEvent->button + 26)        /* Up/Down */
		       | (2 << 8)                          /* Ctrl  */
		       | (modifierMap[(theEvent->state) & 0xF] << 8));
            return;

However, when using the event-driven I/O, the effects of keyBufAppend aren't 
seen.

The attached diff will get the mouse wheel working again with events.
-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com
-------------- next part --------------
--- /tmp/Squeak-3.0/src/unix/sqXWindow.c	Wed Feb  7 15:57:26 2001
+++ src/unix/sqXWindow.c	Wed Feb  7 22:37:05 2001
@@ -831,6 +831,19 @@
 
 static void recordMouseEvent(XButtonEvent *xevt, int pressFlag)
 {
+  /* mouse wheel support */
+  if ((xevt->button == 4 || xevt->button == 5) && pressFlag)
+  {
+    sqKeyboardEvent *evt= allocateKeyboardEvent();
+    evt->charCode= (xevt->button + 26);       /* Up/Down */
+    evt->pressCode= EventKeyChar;
+    evt->modifiers= CtrlKeyBit | modifierMap[(xevt->state) & 0xF];
+    evt->reserved1=
+    evt->reserved2=
+    evt->reserved3= 0;
+  }
+  else
+  {
   sqMouseEvent *evt= allocateMouseEvent();
   evt->x= mousePosition.x;
   evt->y= mousePosition.y;
@@ -838,6 +851,7 @@
   evt->modifiers= (buttonState >> 3);
   evt->reserved1=
     evt->reserved2= 0;
+  }
 }
 
 static void recordKeyboardEvent(XKeyEvent *xevt, int pressCode)


More information about the Squeak-dev mailing list