mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-26 07:40:05 +01:00
Fix for stuck modifier keys, attempt 2!
This commit is contained in:
parent
0e87a30186
commit
65b4e4733f
2 changed files with 39 additions and 7 deletions
|
|
@ -41,7 +41,6 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "mi.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mipointer.h"
|
||||
|
||||
#include "darwin.h"
|
||||
#include "darwinKeyboard.h"
|
||||
|
||||
|
|
@ -72,7 +71,8 @@ typedef struct _EventQueue {
|
|||
} EventQueueRec, *EventQueuePtr;
|
||||
|
||||
static EventQueueRec darwinEventQueue;
|
||||
|
||||
extern KeyClassPtr darwinKeyc;
|
||||
#define KeyPressed(k) (darwinKeyc->down[k >> 3] & (1 << (k & 7)))
|
||||
|
||||
/*
|
||||
* DarwinPressModifierMask
|
||||
|
|
@ -150,8 +150,37 @@ static void DarwinUpdateModifiers(
|
|||
* are held down during a "context" switch -- otherwise, we would miss the KeyUp.
|
||||
*/
|
||||
static void DarwinReleaseModifiers(void) {
|
||||
xEvent e;
|
||||
DarwinUpdateModifiers(&e, KeyRelease, COMMAND_MASK(-1) | CONTROL_MASK(-1) | ALTERNATE_MASK(-1) | SHIFT_MASK(-1));
|
||||
KeySym *map = NULL;
|
||||
xEvent ke;
|
||||
int i = 0, j = 0, nevents = 0;
|
||||
|
||||
map = darwinKeyc->curKeySyms.map;
|
||||
|
||||
for (i = darwinKeyc->curKeySyms.minKeyCode, map = darwinKeyc->curKeySyms.map;
|
||||
i < darwinKeyc->curKeySyms.maxKeyCode;
|
||||
i++, map += darwinKeyc->curKeySyms.mapWidth) {
|
||||
if (KeyPressed(i)) {
|
||||
switch (*map) {
|
||||
/* Don't release the lock keys */
|
||||
case XK_Caps_Lock:
|
||||
case XK_Shift_Lock:
|
||||
case XK_Num_Lock:
|
||||
case XK_Scroll_Lock:
|
||||
case XK_Kana_Lock:
|
||||
break;
|
||||
default:
|
||||
ke.u.keyButtonPointer.time = GetTimeInMillis();
|
||||
ke.u.keyButtonPointer.rootX = 0;
|
||||
ke.u.keyButtonPointer.rootY = 0;
|
||||
ke.u.u.type = KeyRelease;
|
||||
ke.u.u.detail = i;
|
||||
(*darwinEventQueue.pKbd->processInputProc)(&ke,
|
||||
(DeviceIntPtr)darwinEventQueue.pKbd, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcessInputEvents();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -477,9 +506,10 @@ void ProcessInputEvents(void)
|
|||
break;
|
||||
}
|
||||
|
||||
case kXDarwinDeactivate:
|
||||
DarwinReleaseModifiers();
|
||||
// fall through
|
||||
case kXDarwinDeactivate:
|
||||
DarwinReleaseModifiers();
|
||||
old_flags=0;
|
||||
// fall through
|
||||
default:
|
||||
// Check for mode specific event
|
||||
DarwinModeProcessEvent(&xe);
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
|
|||
static darwinKeyboardInfo keyInfo;
|
||||
static FILE *fref = NULL;
|
||||
static char *inBuffer = NULL;
|
||||
KeyClassPtr darwinKeyc = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Data Stream Object
|
||||
|
|
@ -835,6 +836,7 @@ InitModMap(register KeyClassPtr keyc)
|
|||
CARD8 keysPerModifier[8];
|
||||
CARD8 mask;
|
||||
|
||||
darwinKeyc = keyc;
|
||||
if (keyc->modifierKeyMap != NULL)
|
||||
xfree (keyc->modifierKeyMap);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue