summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2005-05-22 01:12:49 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2005-05-22 01:12:49 +0000
commit62343f5162066f19ca6e62d1c85a4a40d45b3295 (patch)
tree801fac4154f316c82e9cb25997bbdc2fd6c81427 /dix
parenta8a61bbe22361b12d4a2dd511894987a338e3eef (diff)
Bugzilla #2800 <https://bugs.freedesktop.org/show_bug.cgi?id=2800> XevieXORG-6_8_99_8
extension crash with signal 11 on keyboard Bugzilla #1205 <https://bugs.freedesktop.org/show_bug.cgi?id=1205> Xevie client receives two KeyPress events on consumed keys when XKB is enabled Patch #2223 <https://bugs.freedesktop.org/attachment.cgi?id=2223> Fixes for both of these and some other Xevie bugs (Derek Wang - Sun Microsystems)
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c25
-rw-r--r--dix/events.c156
-rw-r--r--dix/main.c1
-rw-r--r--dix/privates.c38
4 files changed, 193 insertions, 27 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 3bc098158..d99fcdd36 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -48,6 +48,7 @@ SOFTWARE.
/* $Xorg: devices.c,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ */
+/* $XdotOrg: $ */
#include <X11/X.h>
#include "misc.h"
@@ -120,6 +121,8 @@ _AddInputDevice(DeviceProc deviceProc, Bool autoStart)
#ifdef XKB
dev->xkb_interest= NULL;
#endif
+ dev->nPrivates = 0;
+ dev->devPrivates = dev->unwrapProc = NULL;
inputInfo.off_devices = dev;
return dev;
}
@@ -352,13 +355,10 @@ _RegisterPointerDevice(DeviceIntPtr device)
{
inputInfo.pointer = device;
#ifdef XKB
- if (noXkbExtension) {
- device->public.processInputProc = CoreProcessPointerEvent;
- device->public.realInputProc = CoreProcessPointerEvent;
- } else {
- device->public.processInputProc = ProcessPointerEvent;
- device->public.realInputProc = ProcessPointerEvent;
- }
+ device->public.processInputProc = CoreProcessPointerEvent;
+ device->public.realInputProc = CoreProcessPointerEvent;
+ if (!noXkbExtension)
+ XkbSetExtension(device,ProcessPointerEvent);
#else
device->public.processInputProc = ProcessPointerEvent;
device->public.realInputProc = ProcessPointerEvent;
@@ -378,13 +378,10 @@ _RegisterKeyboardDevice(DeviceIntPtr device)
{
inputInfo.keyboard = device;
#ifdef XKB
- if (noXkbExtension) {
- device->public.processInputProc = CoreProcessKeyboardEvent;
- device->public.realInputProc = CoreProcessKeyboardEvent;
- } else {
- device->public.processInputProc = ProcessKeyboardEvent;
- device->public.realInputProc = ProcessKeyboardEvent;
- }
+ device->public.processInputProc = CoreProcessKeyboardEvent;
+ device->public.realInputProc = CoreProcessKeyboardEvent;
+ if (!noXkbExtension)
+ XkbSetExtension(device,ProcessKeyboardEvent);
#else
device->public.processInputProc = ProcessKeyboardEvent;
device->public.realInputProc = ProcessKeyboardEvent;
diff --git a/dix/events.c b/dix/events.c
index d80b249bb..fcd6eec29 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -76,6 +76,39 @@ Equipment Corporation.
******************************************************************/
+/*****************************************************************
+
+Copyright 2003-2005 Sun Microsystems, Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+******************************************************************/
+
/* $Xorg: events.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include <X11/X.h>
@@ -425,7 +458,13 @@ XineramaCheckVirtualMotion(
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;
@@ -462,12 +501,24 @@ XineramaCheckVirtualMotion(
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)
@@ -497,16 +548,33 @@ XineramaCheckMotion(xEvent *xE)
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)
@@ -523,6 +591,9 @@ XineramaCheckMotion(xEvent *xE)
XE_KBPTR.rootY = sprite.hot.y;
}
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
if (sprite.win != prevSpriteWin)
@@ -744,7 +815,13 @@ CheckVirtualMotion(
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
+#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;
@@ -756,16 +833,31 @@ CheckVirtualMotion(
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;
#ifdef SHAPE
if (wBoundingShape(pWin))
@@ -1951,15 +2043,33 @@ CheckMotion(xEvent *xE)
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;
#ifdef SHAPE
if (sprite.hotShape)
@@ -1977,6 +2087,9 @@ CheckMotion(xEvent *xE)
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 &
@@ -2056,6 +2169,9 @@ DefineInitialRootWindow(register WindowPtr win)
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;
@@ -2641,20 +2757,13 @@ ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int coun
{} else {
#ifdef XKB
if(!noXkbExtension)
- xevieKBEventSent = 0;
+ xevieKBEventSent = 1;
#endif
if(!xevieKBEventSent)
{
xeviekb = keybd;
if(!rootWin) {
- WindowPtr pWin = xeviewin->parent;
- while(pWin) {
- if(!pWin->parent) {
- rootWin = pWin->drawable.id;
- break;
- }
- pWin = pWin->parent;
- };
+ rootWin = GetCurrentRootWindow()->drawable.id;
}
xE->u.keyButtonPointer.event = xeviewin->drawable.id;
xE->u.keyButtonPointer.root = rootWin;
@@ -2668,8 +2777,8 @@ drawable.id:0;
if(noXkbExtension)
#endif
return;
- }else {
- xevieKBEventSent = 0;
+ } else {
+ xevieKBEventSent = 0;
}
}
}
@@ -2686,13 +2795,31 @@ drawable.id:0;
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
}
- XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
+ /* 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
+ )))
+ XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
XE_KBPTR.rootX = sprite.hot.x;
XE_KBPTR.rootY = sprite.hot.y;
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
modifiers = keyc->modifierMap[key];
+#ifdef XKB
+ 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))) {
@@ -3951,6 +4078,9 @@ InitEvents()
spriteTraceGood = 0;
lastEventMask = OwnerGrabButtonMask;
filters[MotionNotify] = PointerMotionMask;
+#ifdef XEVIE
+ xeviewin =
+#endif
sprite.win = NullWindow;
sprite.current = NullCursor;
sprite.hotLimits.x1 = 0;
diff --git a/dix/main.c b/dix/main.c
index 41c626ca6..87ff45a36 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -362,6 +362,7 @@ main(int argc, char *argv[], char *envp[])
#endif
ResetColormapPrivates();
ResetFontPrivateIndex();
+ ResetDevicePrivateIndex();
InitCallbackManager();
InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
diff --git a/dix/privates.c b/dix/privates.c
index 1353e29aa..a8f3ee9aa 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -1,4 +1,5 @@
/* $Xorg: privates.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
+/* $XdotOrg: $ */
/*
Copyright 1993, 1998 The Open Group
@@ -39,6 +40,7 @@ from The Open Group.
#include "colormapst.h"
#include "servermd.h"
#include "site.h"
+#include "inputstr.h"
/*
* See the Wrappers and devPrivates section in "Definition of the
@@ -354,3 +356,39 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
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;
+}