xserver/dix devices.c, 3.25, 3.26 events.c, 3.56, 3.57 main.c, 3.46,
3.47 privates.c, 3.10, 3.11
Dave Airlie
xserver-commit at pdx.freedesktop.org
Tue Jan 3 00:32:51 PST 2006
Committed by: airlied
Update of /cvs/xserver/xserver/dix
In directory gabe:/tmp/cvs-serv5493/dix
Modified Files:
devices.c events.c main.c privates.c
Log Message:
Add xevie support from Xgl code drop - this doesn't build
but it doesn't build in Xgl either, also other dix changes
Index: devices.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/devices.c,v
retrieving revision 3.25
retrieving revision 3.26
diff -u -d -r3.25 -r3.26
--- devices.c 19 Apr 2004 18:21:28 -0000 3.25
+++ devices.c 3 Jan 2006 08:32:49 -0000 3.26
@@ -123,6 +123,9 @@
#ifdef XKB
dev->xkb_interest= NULL;
#endif
+ dev->nPrivates = 0;
+ dev->devPrivates = NULL;
+ dev->unwrapProc = NULL;
inputInfo.off_devices = dev;
return dev;
}
Index: events.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/events.c,v
retrieving revision 3.56
retrieving revision 3.57
diff -u -d -r3.56 -r3.57
--- events.c 8 Aug 2005 06:25:20 -0000 3.56
+++ events.c 3 Jan 2006 08:32:49 -0000 3.57
@@ -103,6 +103,20 @@
#include "security.h"
#endif
+#ifdef XEVIE
+extern WindowPtr *WindowTable;
+extern int xevieFlag;
+extern int xevieClientIndex;
+extern DeviceIntPtr xeviemouse;
+extern DeviceIntPtr xeviekb;
+extern Mask xevieMask;
+extern Mask xevieFilters[128];
+extern int xevieEventSent;
+extern int xevieKBEventSent;
+int xeviegrabState = 0;
+xEvent *xeviexE;
+#endif
+
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "extnsionst.h"
@@ -179,11 +193,6 @@
static int spriteTraceSize = 0;
static int spriteTraceGood;
-typedef struct {
- int x, y;
- ScreenPtr pScreen;
-} HotSpot;
-
static struct {
CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */
@@ -202,6 +211,11 @@
#endif
} sprite; /* info about the cursor sprite */
+#ifdef XEVIE
+WindowPtr xeviewin;
+HotSpot xeviehot;
+#endif
+
static void DoEnterLeaveEvents(
WindowPtr /*fromWin*/,
WindowPtr /*toWin*/,
@@ -406,7 +420,13 @@
if (qe)
{
sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
NullWindow;
@@ -443,12 +463,24 @@
lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2);
if (sprite.hot.x < lims.x1)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = lims.x1;
else if (sprite.hot.x >= lims.x2)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = lims.x2 - 1;
if (sprite.hot.y < lims.y1)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = lims.y1;
else if (sprite.hot.y >= lims.y2)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = lims.y2 - 1;
if (REGION_NUM_RECTS(&sprite.Reg2) > 1)
@@ -478,16 +510,33 @@
panoramiXdataPtr[0].x;
XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
panoramiXdataPtr[0].y;
-
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = XE_KBPTR.rootX;
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = sprite.physLimits.x2 - 1;
if (sprite.hot.y < sprite.physLimits.y1)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = sprite.physLimits.y1;
else if (sprite.hot.y >= sprite.physLimits.y2)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = sprite.physLimits.y2 - 1;
if (sprite.hotShape)
@@ -504,6 +553,9 @@
XE_KBPTR.rootY = sprite.hot.y;
}
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
if (sprite.win != prevSpriteWin)
@@ -724,8 +776,13 @@
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
- sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
+#ifdef XEVIE
+ xeviehot.y =
+#endif
pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
NullWindow;
}
@@ -736,16 +793,31 @@
if (sprite.hot.pScreen != pWin->drawable.pScreen)
{
sprite.hot.pScreen = pWin->drawable.pScreen;
+#ifdef XEVIE
+ xeviehot.x = xeviehot.y = 0;
+#endif
sprite.hot.x = sprite.hot.y = 0;
}
lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize);
if (sprite.hot.x < lims.x1)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = lims.x1;
else if (sprite.hot.x >= lims.x2)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = lims.x2 - 1;
if (sprite.hot.y < lims.y1)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = lims.y1;
else if (sprite.hot.y >= lims.y2)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = lims.y2 - 1;
if (wBoundingShape(pWin))
ConfineToShape(&pWin->borderSize, &sprite.hot.x, &sprite.hot.y);
@@ -1969,15 +2041,33 @@
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = XE_KBPTR.rootX;
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
+#ifdef XEVIE
+ xeviehot.x =
+#endif
sprite.hot.x = sprite.physLimits.x2 - 1;
if (sprite.hot.y < sprite.physLimits.y1)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = sprite.physLimits.y1;
else if (sprite.hot.y >= sprite.physLimits.y2)
+#ifdef XEVIE
+ xeviehot.y =
+#endif
sprite.hot.y = sprite.physLimits.y2 - 1;
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
@@ -1993,6 +2083,9 @@
XE_KBPTR.rootY = sprite.hot.y;
}
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
#ifdef notyet
if (!(sprite.win->deliverableEvents &
@@ -2033,6 +2126,9 @@
sprite.hot = sprite.hotPhys;
sprite.hotLimits.x2 = pScreen->width;
sprite.hotLimits.y2 = pScreen->height;
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = win;
sprite.current = wCursor (win);
spriteTraceGood = 1;
@@ -2624,6 +2720,45 @@
GrabPtr grab = keybd->grab;
Bool deactivateGrab = FALSE;
register KeyClassPtr keyc = keybd->key;
+#ifdef XEVIE
+ static Window rootWin = 0;
+
+ if(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
+ (xevieMask & xevieFilters[xE->u.u.type])) {
+ key = xE->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+ if((xE->u.u.type == KeyPress && (*kptr & bit)) ||
+ (xE->u.u.type == KeyRelease && !(*kptr & bit)))
+ {} else {
+#ifdef XKB
+ if(!noXkbExtension)
+ xevieKBEventSent = 1;
+#endif
+ if(!xevieKBEventSent)
+ {
+ xeviekb = keybd;
+ if(!rootWin) {
+ rootWin = GetCurrentRootWindow()->drawable.id;
+ }
+ xE->u.keyButtonPointer.event = xeviewin->drawable.id;
+ xE->u.keyButtonPointer.root = rootWin;
+ xE->u.keyButtonPointer.child = (xeviewin->firstChild) ? xeviewin->firstChild->
+drawable.id:0;
+ xE->u.keyButtonPointer.rootX = xeviehot.x;
+ xE->u.keyButtonPointer.rootY = xeviehot.y;
+ xE->u.keyButtonPointer.state = keyc->state;
+ WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
+#ifdef XKB
+ if(noXkbExtension)
+#endif
+ return;
+ } else {
+ xevieKBEventSent = 0;
+ }
+ }
+ }
+#endif
if (!syncEvents.playingEvents)
{
@@ -2636,6 +2771,15 @@
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
}
+#ifdef XEVIE
+ /* fix for bug5094030: don't change the state bit if the event is from XEvIE client */
+ if(!(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
+ (xevieMask & xevieFilters[xE->u.u.type]
+#ifdef XKB
+ && !noXkbExtension
+#endif
+ )))
+#endif
XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
XE_KBPTR.rootX = sprite.hot.x;
XE_KBPTR.rootY = sprite.hot.y;
@@ -2643,6 +2787,17 @@
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
modifiers = keyc->modifierMap[key];
+#if defined(XKB) && defined(XEVIE)
+ if(!noXkbExtension && !xeviegrabState &&
+ xevieFlag && clients[xevieClientIndex] &&
+ (xevieMask & xevieFilters[xE->u.u.type])) {
+ switch(xE->u.u.type) {
+ case KeyPress: *kptr &= ~bit; break;
+ case KeyRelease: *kptr |= bit; break;
+ }
+ }
+#endif
+
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
@@ -2769,6 +2924,18 @@
#ifdef XKB
XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo;
#endif
+#ifdef XEVIE
+ if(xevieFlag && clients[xevieClientIndex] && !xeviegrabState &&
+ (xevieMask & xevieFilters[xE->u.u.type])) {
+ if(xevieEventSent)
+ xevieEventSent = 0;
+ else {
+ xeviemouse = mouse;
+ WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
+ return;
+ }
+ }
+#endif
if (!syncEvents.playingEvents)
NoticeTime(xE)
@@ -3917,6 +4084,9 @@
spriteTraceGood = 0;
lastEventMask = OwnerGrabButtonMask;
filters[MotionNotify] = PointerMotionMask;
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = NullWindow;
sprite.current = NullCursor;
sprite.hotLimits.x1 = 0;
Index: main.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/main.c,v
retrieving revision 3.46
retrieving revision 3.47
diff -u -d -r3.46 -r3.47
--- main.c 8 Aug 2005 06:25:20 -0000 3.46
+++ main.c 3 Jan 2006 08:32:49 -0000 3.47
@@ -350,6 +350,7 @@
#endif
ResetColormapPrivates();
ResetFontPrivateIndex();
+ ResetDevicePrivateIndex();
InitCallbackManager();
InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
Index: privates.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/privates.c,v
retrieving revision 3.10
retrieving revision 3.11
diff -u -d -r3.10 -r3.11
--- privates.c 11 Sep 2003 05:12:50 -0000 3.10
+++ privates.c 3 Jan 2006 08:32:49 -0000 3.11
@@ -42,6 +42,7 @@
#include "colormapst.h"
#include "servermd.h"
#include "site.h"
+#include "inputstr.h"
/*
* See the Wrappers and devPrivates section in "Definition of the
@@ -371,3 +372,39 @@
return index;
}
+
+/*
+ * device private machinery
+ */
+
+static int devicePrivateIndex = 0;
+
+int
+AllocateDevicePrivateIndex()
+{
+ return devicePrivateIndex++;
+}
+
+Bool
+AllocateDevicePrivate(DeviceIntPtr device, int index)
+{
+ if (device->nPrivates < ++index) {
+ DevUnion *nprivs = (DevUnion *) xrealloc(device->devPrivates,
+ index * sizeof(DevUnion));
+ if (!nprivs)
+ return FALSE;
+ device->devPrivates = nprivs;
+ bzero(&nprivs[device->nPrivates], sizeof(DevUnion)
+ * (index - device->nPrivates));
+ device->nPrivates = index;
+ return TRUE;
+ } else {
+ return TRUE;
+ }
+}
+
+void
+ResetDevicePrivateIndex(void)
+{
+ devicePrivateIndex = 0;
+}
More information about the xserver-commit
mailing list