summaryrefslogtreecommitdiff
path: root/xkb
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 /xkb
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 'xkb')
-rw-r--r--xkb/xkbActions.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index f7fa0af28..f45dd818f 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1,4 +1,5 @@
/* $Xorg: xkbActions.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
+/* $XdotOrg: $ */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
@@ -38,6 +39,48 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkb.h"
#include <ctype.h>
+static unsigned int _xkbServerGeneration;
+int xkbDevicePrivateIndex = -1;
+
+void
+xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
+ pointer data)
+{
+ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
+ ProcessInputProc tmp = device->public.processInputProc;
+ if(xkbPrivPtr->unwrapProc)
+ xkbPrivPtr->unwrapProc = NULL;
+
+ UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr);
+ proc(device,data);
+ WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
+ tmp,xkbUnwrapProc);
+}
+
+
+void
+XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
+{
+ xkbDeviceInfoPtr xkbPrivPtr;
+
+ if (serverGeneration != _xkbServerGeneration) {
+ if ((xkbDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
+ return;
+ _xkbServerGeneration = serverGeneration;
+ }
+ if (!AllocateDevicePrivate(device, xkbDevicePrivateIndex))
+ return;
+
+ xkbPrivPtr = (xkbDeviceInfoPtr) xalloc(sizeof(xkbDeviceInfoRec));
+ if (!xkbPrivPtr)
+ return;
+ xkbPrivPtr->unwrapProc = NULL;
+
+ device->devPrivates[xkbDevicePrivateIndex].ptr = xkbPrivPtr;
+ WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
+ proc,xkbUnwrapProc);
+}
+
#ifdef XINPUT
extern void ProcessOtherEvent(
xEvent * /* xE */,
@@ -822,6 +865,7 @@ xEvent ev;
int x,y;
XkbStateRec old;
unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0;
+xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device);
if ((filter->keycode!=0)&&(filter->keycode!=keycode))
return 1;
@@ -870,7 +914,10 @@ unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0;
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
- CoreProcessKeyboardEvent(&ev,xkbi->device,1);
+ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr);
+ xkbi->device->public.processInputProc(&ev,xkbi->device,1);
+ COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
+ ProcessKeyboardEvent,xkbUnwrapProc);
xkbi->device->key->modifierMap[ev.u.u.detail] = realMods;
if ( mask || mods ) {
@@ -908,7 +955,10 @@ unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0;
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
- CoreProcessKeyboardEvent(&ev,xkbi->device,1);
+ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr);
+ xkbi->device->public.processInputProc(&ev,xkbi->device,1);
+ COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
+ ProcessKeyboardEvent,xkbUnwrapProc);
xkbi->device->key->modifierMap[ev.u.u.detail] = realMods;
if ( mask || mods ) {
@@ -1102,6 +1152,8 @@ Bool pressEvent;
#ifdef XINPUT
Bool xiEvent;
#endif
+
+xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
keyc= kbd->key;
xkbi= keyc->xkbInfo;
@@ -1244,7 +1296,10 @@ Bool xiEvent;
if (keyEvent) {
realMods = keyc->modifierMap[key];
keyc->modifierMap[key] = 0;
- CoreProcessKeyboardEvent(xE,dev,count);
+ UNWRAP_PROCESS_INPUT_PROC(dev,xkbPrivPtr);
+ dev->public.processInputProc(xE,dev,count);
+ COND_WRAP_PROCESS_INPUT_PROC(dev, xkbPrivPtr,
+ ProcessKeyboardEvent,xkbUnwrapProc);
keyc->modifierMap[key] = realMods;
}
else CoreProcessPointerEvent(xE,dev,count);