On Tue, 2 Apr 2002 20:40:43 -0800
Nathaniel Gray <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I'm trying to use x2x and have mostly had success, but I can't get the scroll 
> wheel button events to get sent to the other computer.  The X server on the 
> source machine seems to think there are only 3 buttons on the mouse 
> (XGetPointerMapping(...) call in x2x.c returns 3) and I can't figure out how 
> to convince it otherwise.  Despite this, the scroll-wheel works perfectly on 
> the source computer.
> 
> Can somebody suggest a place to start figuring this out?  I know C very well 
> but basically don't know the X APIs, but I don't mind hacking the x2x code.  
> Has anybody had success with x2x and scroll-wheels?
> 
> Thanks,
> -n8
> 
> -- 
> Nathaniel Gray
> 
> California Institute of Technology
> Computation and Neural Systems
> --
> 
> _______________________________________________
> Xpert mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xpert

        Hi,

        I've had the same problem. My distant XServer wasn't supporting the 4 and 5
buttons through the Pointer Option  "ZAxisMapping" "4 5".
        x2x should detect this when we call XGetPointerMapping : it returns 3 and not
5. Here is a patch against x2x version 1.27 for handling it correctly : if there is 
less
buttons handled by the distant XServer than requested, the other buttons are silently
ignored. At least, x2x won't crash if you use your wheel by accident, but until you
enable wheel mouses in the distant XServer (even if there is no such pointer connected
to it), your wheel won't be usable on this server.

Hope this helps, Thomas.

My 0.2 cents :
--- x2x-1.27-vanilla/x2x.c      Wed Aug 20 18:14:52 1997
+++ x2x-1.27/x2x.c      Wed Apr  3 10:51:58 2002
@@ -134,6 +134,7 @@
 #define FAKE_BUTTON 1
 
 #define N_BUTTONS   5
+static int nButtons = N_BUTTONS;
 
 #define GETDPYXTRA(DPY,PDPYINFO)\
    (((DPY) == (PDPYINFO)->fromDpy) ?\
@@ -1064,18 +1065,21 @@
 #endif
     break;
   case X2X_CONNECTED:
-    if (pEv->button <= N_BUTTONS) toButton = pDpyInfo->inverseMap[pEv->button];
-    for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
-      XTestFakeButtonEvent(pShadow->dpy, toButton, True, 0);
-#ifdef DEBUG
-      printf("from button %d down, to button %d down\n", pEv->button,toButton);
-#endif
-      XFlush(pShadow->dpy);
-    } /* END for */
-    if (doAutoUp)
-      FakeAction(pDpyInfo, FAKE_BUTTON, toButton, True);
+    if (pEv->button <= nButtons) 
+      {
+       toButton = pDpyInfo->inverseMap[pEv->button];
+       for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
+         XTestFakeButtonEvent(pShadow->dpy, toButton, True, 0);
+#ifdef DEBUG
+         printf("from button %d down, to button %d down\n", pEv->button,toButton);
+#endif
+         XFlush(pShadow->dpy);
+       } /* END for */
+       if (doAutoUp)
+         FakeAction(pDpyInfo, FAKE_BUTTON, toButton, True);
+      } /* END if */
     if (doEdge) break;
-
+    
     /* check if more than one button pressed */
     state = pEv->state;
     switch (pEv->button) {
@@ -1113,16 +1117,19 @@
 
   if ((pDpyInfo->mode == X2X_CONNECTED) || 
       (pDpyInfo->mode == X2X_CONN_RELEASE)) {
-    if (pEv->button <= N_BUTTONS) toButton = pDpyInfo->inverseMap[pEv->button];
-    for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
-      XTestFakeButtonEvent(pShadow->dpy, toButton, False, 0);
-#ifdef DEBUG
-      printf("from button %d up, to button %d up\n", pEv->button, toButton);
-#endif
-      XFlush(pShadow->dpy);
-    } /* END for */
-    if (doAutoUp)
-      FakeAction(pDpyInfo, FAKE_BUTTON, toButton, False);
+    if (pEv->button <= nButtons)
+      {
+       toButton = pDpyInfo->inverseMap[pEv->button];
+       for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
+         XTestFakeButtonEvent(pShadow->dpy, toButton, False, 0);
+#ifdef DEBUG
+         printf("from button %d up, to button %d up\n", pEv->button, toButton);
+#endif
+         XFlush(pShadow->dpy);
+       } /* END for */
+       if (doAutoUp)
+         FakeAction(pDpyInfo, FAKE_BUTTON, toButton, False);
+      } /* END if */
   } /* END if */
 
   if (doEdge) return False;
@@ -1508,7 +1515,8 @@
 #endif
          } /* END if */
        } else { /* button goes up */
-         XTestFakeButtonEvent(pShadow->dpy, pFake->thing, False, 0);
+         if(pFake->thing <= nButtons)
+           XTestFakeButtonEvent(pShadow->dpy, pFake->thing, False, 0);
 #ifdef DEBUG
          printf("button %d up\n", pFake->thing);
 #endif
@@ -1535,7 +1543,6 @@
 {
   unsigned int buttCtr;
   unsigned char buttonMap[N_BUTTONS];
-  int nButtons;
 
   if (dpy == pDpyInfo->toDpy) { /* only care about toDpy */
     /* straightforward mapping */
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to