The XRecord and DEC-XTRAP extensions are handed X/Y coordinates in 
events in device coordinates (i.e, translated to the origin of the 
current screen) as opposed to "logical" coordinates.  This is an 
issue, since applications that use these extensions often want to 
turn around and use the coordinate information they received in a 
X request which will then be arbitrarily incorrect depending on which 
screen the cursor happened to be on when the event was captured.  

  I've created a patch which allows extensions such as XRecord and 
XTrap to query which screen the event they are forwarding is 
occurring in, so that they can perform the translation themselves.
Is this the right way to solve this problem?  I think I've submitted 
this patch before a couple months ago, so perhaps there's some 
discussion to be had about this.  

  The patch applies to the CVS version of XFree as of a few minutes 
ago.  Please Cc me on any responses.

--
Paul

--- xc/programs/Xserver/XTrap/Imakefile.orig    Thu May  2 14:56:03 2002
+++ xc/programs/Xserver/XTrap/Imakefile Thu May  2 14:56:34 2002
@@ -11,7 +11,7 @@
 #endif
          SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c
          OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o
-     INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC)
+     INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext
 
 NormalLibraryTarget(xtrap,$(OBJS))
 LintLibraryTarget(xtrap,$(SRCS))
--- xc/programs/Xserver/XTrap/module/Imakefile.orig     Tue Jan 22 19:31:40 2002
+++ xc/programs/Xserver/XTrap/module/Imakefile  Thu May  2 14:58:36 2002
@@ -5,7 +5,8 @@
 
        SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c xf86XTrapModule.c
        OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o xf86XTrapModule.o
-   INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC)
+   INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \
+       -I$(SERVERSRC)/Xext
     DEFINES = -DEXTMODULE
 
 LinkSourceFile(xf86XTrapModule.c,..)
--- xc/programs/Xserver/XTrap/xtrapdi.c.orig    Tue Jan 22 19:31:39 2002
+++ xc/programs/Xserver/XTrap/xtrapdi.c Thu May  2 15:40:03 2002
@@ -76,6 +76,12 @@
 #include <X11/extensions/xtrapddmi.h>
 #include <X11/extensions/xtrapproto.h>
 #include "colormapst.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "cursor.h"
+#endif
+
 
 /*----------------------------*
  *  Global Data Declarations  *
@@ -1547,6 +1553,21 @@
             /* Copy the event information into our local memory */
             (void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
 
+#ifdef PANORAMIX
+           if (!noPanoramiXExtension &&
+                (data.u.event.u.u.type == MotionNotify ||
+                data.u.event.u.u.type == ButtonPress ||
+                data.u.event.u.u.type == ButtonRelease ||
+                data.u.event.u.u.type == KeyPress ||
+                data.u.event.u.u.type == KeyRelease)) {
+                   int scr = XineramaGetCursorScreen();
+                   data.u.event.u.keyButtonPointer.rootX +=
+                       panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x;
+                   data.u.event.u.keyButtonPointer.rootY +=
+                       panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y;
+           }
+#endif
+
             if (penv->client->swapped)
             {   /* 
                  * Notice that we don't swap the XTRAP EVENT information.  
--- xc/programs/Xserver/dix/events.c.orig       Tue Feb 19 03:09:22 2002
+++ xc/programs/Xserver/dix/events.c    Thu May  2 15:14:19 2002
@@ -927,6 +927,18 @@
     *py = sprite.hotPhys.y;
 }
 
+#ifdef PANORAMIX
+int
+XineramaGetCursorScreen()
+{
+    if(!noPanoramiXExtension) {
+       return sprite.screen->myNum;
+    } else {
+       return 0;
+    }
+}
+#endif /* PANORAMIX */
+
 #define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
 
 static void
--- xc/programs/Xserver/hw/xfree86/loader/dixsym.c.orig Wed Mar  6 13:13:02 2002
+++ xc/programs/Xserver/hw/xfree86/loader/dixsym.c      Thu May  2 15:17:03 2002
@@ -138,6 +138,9 @@
   SYMVAR(EventCallback)
   SYMVAR(inputInfo)
   SYMVAR(SetCriticalEvent)
+#ifdef PANORAMIX
+  SYMVAR(XineramaGetCursorScreen)
+#endif
   /* property.c */
   SYMFUNC(ChangeWindowProperty)
   /* extension.c */
--- xc/programs/Xserver/include/cursor.h.orig   Thu Sep 12 05:53:52 2002
+++ xc/programs/Xserver/include/cursor.h        Fri Sep 13 13:00:41 2002
@@ -174,4 +174,12 @@
 #endif
 );
 
+#ifdef PANORAMIX
+extern int XineramaGetCursorScreen(
+#if NeedFunctionPrototypes
+    void
+#endif
+);
+#endif /* PANORAMIX */
+
 #endif /* CURSOR_H */
--- xc/programs/Xserver/record/Imakefile.orig   Fri Nov  2 15:29:34 2001
+++ xc/programs/Xserver/record/Imakefile        Fri May  3 16:39:54 2002
@@ -16,7 +16,7 @@
 #endif
        SRCS = record.c set.c
        OBJS = record.o set.o
-   INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC)
+   INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext
    LINTLIBS = ../dix/llib-ldix.ln
     DEFINES = -DNDEBUG
 
--- xc/programs/Xserver/record/module/Imakefile.orig    Wed Apr  5 11:14:03 2000
+++ xc/programs/Xserver/record/module/Imakefile Fri May  3 16:40:33 2002
@@ -13,7 +13,8 @@
 
        SRCS = record.c set.c $(MSRCS)
        OBJS = record.o set.o $(MOBJS)
-   INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC)
+   INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
+       -I$(SERVERSRC)/Xext
    LINTLIBS = ../../dix/llib-ldix.ln
     DEFINES = -DNDEBUG
 
--- xc/programs/Xserver/record/record.c.orig    Fri May  3 16:37:07 2002
+++ xc/programs/Xserver/record/record.c Fri May  3 16:45:26 2002
@@ -48,6 +48,13 @@
 #include "xf86_ansic.h"
 #endif
 
+#ifdef PANORAMIX
+#include "globals.h"
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "cursor.h"
+#endif
+
 static RESTYPE RTContext;   /* internal resource type for Record contexts */
 static int RecordErrorBase; /* first Record error number */
 
@@ -870,11 +877,31 @@
                    {
                        xEvent swappedEvent;
                        xEvent *pEvToRecord = pev;
+#ifdef PANORAMIX
+                       xEvent shiftedEvent;
+
+                       if (!noPanoramiXExtension &&
+                           (pev->u.u.type == MotionNotify ||
+                            pev->u.u.type == ButtonPress ||
+                            pev->u.u.type == ButtonRelease ||
+                            pev->u.u.type == KeyPress ||
+                            pev->u.u.type == KeyRelease)) {
+                               int scr = XineramaGetCursorScreen();
+                               memcpy(&shiftedEvent, pev, sizeof(xEvent));
+                               shiftedEvent.u.keyButtonPointer.rootX +=
+                                   panoramiXdataPtr[scr].x - 
+                                       panoramiXdataPtr[0].x;
+                               shiftedEvent.u.keyButtonPointer.rootY +=
+                                   panoramiXdataPtr[scr].y -
+                                       panoramiXdataPtr[0].y;
+                               pEvToRecord = &shiftedEvent;
+                       }
+#endif /* PANORAMIX */
 
                        if (pContext->pRecordingClient->swapped)
                        {
-                           (*EventSwapVector[pev->u.u.type & 0177])
-                               (pev, &swappedEvent);
+                           (*EventSwapVector[pEvToRecord->u.u.type & 0177])
+                               (pEvToRecord, &swappedEvent);
                            pEvToRecord = &swappedEvent;
                        }
 


_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to