Commit c5eca7be authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b115e967
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
NSTimeInterval lastDockIconSnapshot; NSTimeInterval lastDockIconSnapshot;
BOOL allowKeyRepeats;
BOOL ignore_windowDeminiaturize; BOOL ignore_windowDeminiaturize;
BOOL ignore_windowResize; BOOL ignore_windowResize;
BOOL fakingClose; BOOL fakingClose;
......
...@@ -2424,7 +2424,18 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -2424,7 +2424,18 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
/* /*
* ---------- NSResponder method overrides ---------- * ---------- 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 - (void) flagsChanged:(NSEvent *)theEvent
{ {
...@@ -2461,6 +2472,9 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi ...@@ -2461,6 +2472,9 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
{ {
BOOL pressed = (modifierFlags & modifiers[i].mask) != 0; BOOL pressed = (modifierFlags & modifiers[i].mask) != 0;
if (pressed)
allowKeyRepeats = NO;
if (i == last_changed) if (i == last_changed)
lastModifierFlags = modifierFlags; lastModifierFlags = modifierFlags;
else else
......
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