Commit fda5675f authored by Olivier Fourdan's avatar Olivier Fourdan

xkb: add hook to allow/deny AccessX key repeat

The xserver generates the key repeat by itself.

But when used with another server processing inputs first (e.g. a
Wayland compositor), the other server may be busy dealing with some
other things and not queue up key release events in time.

Add a vfunc in XkbSrvInfo to possibly add a check before re-emitting a
keypress event in the AccessX timer handler, so that the key repeat has
a chance to be denied if the server processing the input is not ready.
Signed-off-by: 's avatarOlivier Fourdan <ofourdan@redhat.com>
Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 3735ab96
...@@ -142,6 +142,10 @@ typedef struct _XkbFilter { ...@@ -142,6 +142,10 @@ typedef struct _XkbFilter {
struct _XkbFilter *next; struct _XkbFilter *next;
} XkbFilterRec, *XkbFilterPtr; } XkbFilterRec, *XkbFilterPtr;
typedef Bool (*XkbSrvCheckRepeatPtr) (DeviceIntPtr dev,
struct _XkbSrvInfo * /* xkbi */ ,
unsigned /* keycode */);
typedef struct _XkbSrvInfo { typedef struct _XkbSrvInfo {
XkbStateRec prev_state; XkbStateRec prev_state;
XkbStateRec state; XkbStateRec state;
...@@ -189,6 +193,8 @@ typedef struct _XkbSrvInfo { ...@@ -189,6 +193,8 @@ typedef struct _XkbSrvInfo {
int szFilters; int szFilters;
XkbFilterPtr filters; XkbFilterPtr filters;
XkbSrvCheckRepeatPtr checkRepeat;
} XkbSrvInfoRec, *XkbSrvInfoPtr; } XkbSrvInfoRec, *XkbSrvInfoPtr;
#define XkbSLI_IsDefault (1L<<0) #define XkbSLI_IsDefault (1L<<0)
......
...@@ -89,6 +89,7 @@ AccessXInit(DeviceIntPtr keybd) ...@@ -89,6 +89,7 @@ AccessXInit(DeviceIntPtr keybd)
xkbi->repeatKeyTimer = NULL; xkbi->repeatKeyTimer = NULL;
xkbi->krgTimer = NULL; xkbi->krgTimer = NULL;
xkbi->beepTimer = NULL; xkbi->beepTimer = NULL;
xkbi->checkRepeat = NULL;
ctrls->repeat_delay = XkbDfltRepeatDelay; ctrls->repeat_delay = XkbDfltRepeatDelay;
ctrls->repeat_interval = XkbDfltRepeatInterval; ctrls->repeat_interval = XkbDfltRepeatInterval;
ctrls->debounce_delay = 300; ctrls->debounce_delay = 300;
...@@ -317,7 +318,8 @@ AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, void *arg) ...@@ -317,7 +318,8 @@ AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, void *arg)
if (xkbi->repeatKey == 0) if (xkbi->repeatKey == 0)
return 0; return 0;
AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, TRUE); if (xkbi->checkRepeat == NULL || xkbi->checkRepeat (dev, xkbi, xkbi->repeatKey))
AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, TRUE);
return xkbi->desc->ctrls->repeat_interval; return xkbi->desc->ctrls->repeat_interval;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment