summaryrefslogtreecommitdiff
path: root/xkb/xkbActions.c
diff options
context:
space:
mode:
Diffstat (limited to 'xkb/xkbActions.c')
-rw-r--r--xkb/xkbActions.c104
1 files changed, 86 insertions, 18 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index fd8910841..7f3c47ebc 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.11 2003/02/13 15:36:48 dawes Exp $ */
#include <stdio.h>
#include <math.h>
@@ -137,7 +138,7 @@ XkbAction * pActs;
static XkbAction fake;
xkb= xkbi->desc;
- if (!XkbKeyHasActions(xkb,key)) {
+ if (!XkbKeyHasActions(xkb,key) || !XkbKeycodeInRange(xkb,key)) {
fake.type = XkbSA_NoAction;
return fake;
}
@@ -244,7 +245,6 @@ _XkbFilterSetState(xkbi,filter,keycode,pAction)
XkbAction * pAction;
#endif
{
-
if (filter->keycode==0) { /* initial press */
filter->keycode = keycode;
filter->active = 1;
@@ -620,14 +620,12 @@ Bool accel;
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
- if (xkbi->mouseKeysAccel) {
- xkbi->mouseKeysFlags= pAction->ptr.flags;
- xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
- xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
- xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
+ xkbi->mouseKeysFlags= pAction->ptr.flags;
+ xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
+ xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
+ xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
xkbi->desc->ctrls->mk_delay,
_XkbPtrAccelExpire,(pointer)xkbi);
- }
}
else if (filter->keycode==keycode) {
filter->active = 0;
@@ -844,7 +842,7 @@ XkbEventCauseRec cause;
filter->keycode= 0;
filter->active= 0;
}
- return 0;
+ return 1;
}
static int
@@ -923,12 +921,12 @@ _XkbFilterRedirectKey(xkbi,filter,keycode,pAction)
{
unsigned realMods;
xEvent ev;
-int x,y,kc;
+int x,y;
XkbStateRec old;
-unsigned mods,mask,oldCoreState,oldCorePrevState;
+unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0;
if ((filter->keycode!=0)&&(filter->keycode!=keycode))
- return 0;
+ return 1;
GetSpritePosition(&x,&y);
ev.u.keyButtonPointer.time = GetTimeInMillis();
@@ -982,8 +980,6 @@ unsigned mods,mask,oldCoreState,oldCorePrevState;
xkbi->device->key->prev_state= oldCorePrevState;
xkbi->state= old;
}
-
- return 0;
}
else if (filter->keycode==keycode) {
@@ -1018,10 +1014,72 @@ unsigned mods,mask,oldCoreState,oldCorePrevState;
filter->keycode= 0;
filter->active= 0;
- return 0;
}
- return 0;
+ return 1;
+}
+
+static int
+#if NeedFunctionPrototypes
+_XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode,
+ XkbAction * pAction)
+#else
+_XkbFilterSwitchScreen(xkbi,filter,keycode,pAction)
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ unsigned keycode;
+ XkbAction * pAction;
+#endif
+{
+ if (filter->keycode==0) { /* initial press */
+ DeviceIntPtr dev = xkbi->device;
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterSwitchScreen;
+ AccessXCancelRepeatKey(xkbi, keycode);
+ XkbDDXSwitchScreen(dev,keycode,pAction);
+ return 0;
+ }
+ else if (filter->keycode==keycode) {
+ filter->active= 0;
+ return 0;
+ }
+ return 1;
+}
+
+#ifdef XFree86Server
+static int
+#if NeedFunctionPrototypes
+_XkbFilterXF86Private( XkbSrvInfoPtr xkbi,
+ XkbFilterPtr filter,
+ unsigned keycode,
+ XkbAction * pAction)
+#else
+_XkbFilterXF86Private(xkbi,filter,keycode,pAction)
+ XkbSrvInfoPtr xkbi;
+ XkbFilterPtr filter;
+ unsigned keycode;
+ XkbAction * pAction;
+#endif
+{
+ if (filter->keycode==0) { /* initial press */
+ DeviceIntPtr dev = xkbi->device;
+ filter->keycode = keycode;
+ filter->active = 1;
+ filter->filterOthers = 0;
+ filter->filter = _XkbFilterXF86Private;
+ XkbDDXPrivate(dev,keycode,pAction);
+ return 0;
+ }
+ else if (filter->keycode==keycode) {
+ filter->active= 0;
+ return 0;
+ }
+ return 1;
}
+#endif
#ifdef XINPUT
@@ -1251,7 +1309,8 @@ Bool xiEvent;
sendEvent= XkbDDXTerminateServer(dev,key,&act);
break;
case XkbSA_SwitchScreen:
- sendEvent= XkbDDXSwitchScreen(dev,key,&act);
+ filter = _XkbNextFreeFilter();
+ sendEvent=_XkbFilterSwitchScreen(xkbi,filter,key,&act);
break;
case XkbSA_SetControls:
case XkbSA_LockControls:
@@ -1273,6 +1332,12 @@ Bool xiEvent;
sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act);
break;
#endif
+#ifdef XFree86Server
+ case XkbSA_XFree86Private:
+ filter = _XkbNextFreeFilter();
+ sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act);
+ break;
+#endif
}
}
}
@@ -1307,7 +1372,7 @@ Bool xiEvent;
}
if (sendEvent) {
-#if XINPUT
+#ifdef XINPUT
if (xiEvent)
ProcessOtherEvent(xE,dev,count);
else
@@ -1320,6 +1385,9 @@ Bool xiEvent;
}
else CoreProcessPointerEvent(xE,dev,count);
}
+ else if (keyEvent)
+ FixKeyState(xE,dev);
+
xkbi->prev_state= oldState;
XkbComputeDerivedState(xkbi);
keyc->prev_state= keyc->state;