From 112f6803189adb7b39364f60a21e6abf8050c46e Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 2 Jul 2013 17:16:39 -0700 Subject: [PATCH] Hand-apply patches (keyboard autorepeat) from Authentic8 branch: b5b58fcbbd9eb57ff1ff4b8df8f4426c1c2881fb --- xorg/X11R7.6/rdp/rdpinput.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c index 9fa7fa0a..5cef9458 100644 --- a/xorg/X11R7.6/rdp/rdpinput.c +++ b/xorg/X11R7.6/rdp/rdpinput.c @@ -58,6 +58,7 @@ static int g_tab_down = 0; /* this is toggled every time num lock key is released, not like the above *_down vars */ static int g_scroll_lock_down = 0; +static OsTimerPtr g_kbtimer = 0; #define MIN_KEY_CODE 8 #define MAX_KEY_CODE 255 @@ -314,11 +315,58 @@ rdpBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) ErrorF("rdpBell:\n"); } +/******************************************************************************/ +static CARD32 +rdpInDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + //ErrorF("rdpInDeferredUpdateCallback:\n"); + + /* our keyboard device */ + XkbSetRepeatKeys(g_keyboard, -1, AutoRepeatModeOff); + /* the main one for the server */ + XkbSetRepeatKeys(inputInfo.keyboard, -1, AutoRepeatModeOff); + + return 0; +} + /******************************************************************************/ void rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) { + XkbControlsPtr ctrls; + ErrorF("rdpChangeKeyboardControl:\n"); + ctrls = 0; + if (pDev != 0) + { + if (pDev->key != 0) + { + if (pDev->key->xkbInfo != 0) + { + if (pDev->key->xkbInfo->desc != 0) + { + if (pDev->key->xkbInfo->desc->ctrls != 0) + { + ctrls = pDev->key->xkbInfo->desc->ctrls; + } + } + } + } + } + if (ctrls != 0) + { + if (ctrls->enabled_ctrls & XkbRepeatKeysMask) + { + //ErrorF("rdpChangeKeyboardControl: autoRepeat on\n"); + /* schedual to turn off the autorepeat after 100 ms so any app + * polling it will be happy it's on */ + g_kbtimer = TimerSet(g_kbtimer, 0, 100, rdpInDeferredUpdateCallback, 0);\ + } + else + { + //ErrorF("rdpChangeKeyboardControl: autoRepeat off\n"); + } + } } /******************************************************************************/