winemac: Discard key repeat events after a modifier key has been pressed.
Sierra (macOS 10.12) changed the behavior of key repeat. In previous versions of macOS, key repeat stops when a modifier key is pressed or released. In Sierra, it does not; it just keeps repeating as newly-modified. On Windows, key repeat stops when a modifier key is pressed, although not when one is released. Some programs depend on this behavior. So, the Mac driver emulates it. Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b115e9675f
commit
c5eca7be91
|
@ -81,6 +81,8 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
|
|||
|
||||
NSTimeInterval lastDockIconSnapshot;
|
||||
|
||||
BOOL allowKeyRepeats;
|
||||
|
||||
BOOL ignore_windowDeminiaturize;
|
||||
BOOL ignore_windowResize;
|
||||
BOOL fakingClose;
|
||||
|
|
|
@ -2424,7 +2424,18 @@ - (void) setRetinaMode:(int)mode
|
|||
/*
|
||||
* ---------- NSResponder method overrides ----------
|
||||
*/
|
||||
- (void) keyDown:(NSEvent *)theEvent { [self postKeyEvent:theEvent]; }
|
||||
- (void) keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
if ([theEvent isARepeat])
|
||||
{
|
||||
if (!allowKeyRepeats)
|
||||
return;
|
||||
}
|
||||
else
|
||||
allowKeyRepeats = YES;
|
||||
|
||||
[self postKeyEvent:theEvent];
|
||||
}
|
||||
|
||||
- (void) flagsChanged:(NSEvent *)theEvent
|
||||
{
|
||||
|
@ -2461,6 +2472,9 @@ - (void) flagsChanged:(NSEvent *)theEvent
|
|||
{
|
||||
BOOL pressed = (modifierFlags & modifiers[i].mask) != 0;
|
||||
|
||||
if (pressed)
|
||||
allowKeyRepeats = NO;
|
||||
|
||||
if (i == last_changed)
|
||||
lastModifierFlags = modifierFlags;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue