[BUG,FIX] CursorWithMask on X

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Tue Feb 2 18:17:08 UTC 1999


Hi Ian,

I really wanted to have that nice CursorWithMask but it showed only as a
black blob - stColorBlack and stColorWhite were not initialized with RGB
triplets (which are needed for 16/32 bpp visuals). A diff is attached.

Bert

PS: cc to the list for all X fans out there ;-)

-- 
  Bert Freudenberg                                            Department of
                                                             Simulation and
  mailto:bert at isg.cs.uni-magdeburg.de                     Computer Graphics
  http://isgwww.cs.uni-magdeburg.de/isg/bert.html        Univ. of Magdeburg

Content-Type: TEXT/PLAIN; charset=US-ASCII; name="sqXWindow.c.diff"
Content-ID: <Pine.GSO.4.05.9902021917080.24755 at luxator>
Content-Description: sqXWindow.c.diff
Content-Disposition: attachment; filename="sqXWindow.c.diff"
-------------- next part --------------
--- ../src/unix/sqXWindow.c.orig	Tue Feb 13 17:34:53 2001
+++ ../src/unix/sqXWindow.c	Thu Apr  5 16:27:14 2001
@@ -861,14 +861,28 @@

  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;
    evt->buttons= buttonState & 0x7;
-  evt->modifiers= (buttonState >> 3);
+    evt->modifiers= modifierMap[(xevt->state) & 0xF];
    evt->reserved1=
      evt->reserved2= 0;
  }
+}

  static void recordKeyboardEvent(XKeyEvent *xevt, int pressCode)
  {
@@ -880,8 +894,10 @@
    KeySym symbolic;
    nConv= XLookupString(xevt, buf, sizeof(buf), &symbolic, 0);
    charCode= buf[0];
+#if 0
    if (charCode == 127)
      charCode= 8;
+#endif
    if (nConv == 0 && (charCode= translateCode(symbolic)) < 0)
      return;	/* unknown key */
    if (charCode >= 128)
@@ -1678,7 +1694,7 @@
  {
    int stButtons= 0;

-  if (theEvent->type == ButtonPress)
+  if (theEvent->type == KeyPress)
      stButtons= buttonState & 0x7;
    else
      stButtons= 0;
@@ -1957,9 +1973,9 @@
      {
        w= (w / sizeof(void *)) * sizeof(void *);
        XResizeWindow(stDisplay, stParent, w, h);
-      XResizeWindow(stDisplay, stWindow, w, h);
        noteWindowChange();
      }
+  XResizeWindow(stDisplay, stWindow, w, h);
    return (w << 16) | h;  /* w is high 16 bits; h is low 16 bits */
  #endif
  }
@@ -2128,6 +2144,7 @@
  	  XResizeWindow(stDisplay, stWindow, scrW, scrH);
  	  XLowerWindow(stDisplay, stParent);
  	  XRaiseWindow(stDisplay, stWindow);
+ 	  XSetInputFocus(stDisplay, stWindow, RevertToPointerRoot, 
CurrentTime);
  	  XSynchronize(stDisplay, False);
  	  windowState= WIN_ZOOMED;
  	}


More information about the Squeak-dev mailing list