summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-03-13 18:07:22 +0100
committerAkemi <der.richter@gmx.de>2017-03-26 20:38:26 +0200
commit5e066670d0633f94e8e02b6e417e262b759863d9 (patch)
treedbf974f2b05fc56fd6b5bb3e4d7fc54672439527
parent063ca8f0fe48c281944c5307b1e8bbb11bb22822 (diff)
downloadmpv-5e066670d0633f94e8e02b6e417e262b759863d9.tar.bz2
mpv-5e066670d0633f94e8e02b6e417e262b759863d9.tar.xz
cocoa: fix first responder when borderless window is used
this fixes a weird behaviour when a borderless window's style mask is set to a none-borderless style mask. this can happen when cycling the border or just toggling fullscreen. what happens is that the first responder is reset to the NSWindow instead of being kept, the events view in our case. this happens without the usual resignFirstResponder, becomeFirstResponder routine. this is a small workaround that overrides the setStyleMask method. it keeps the first responder from before the style mask change and resets this first responder after the new style mask was applied.
-rw-r--r--video/out/cocoa/window.m7
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m
index 137ef530d9..d26d7272a6 100644
--- a/video/out/cocoa/window.m
+++ b/video/out/cocoa/window.m
@@ -70,6 +70,13 @@
return self;
}
+- (void)setStyleMask:(NSWindowStyleMask)style
+{
+ NSResponder *nR = [self firstResponder];
+ [super setStyleMask:style];
+ [self makeFirstResponder:nR];
+}
+
- (void)toggleFullScreen:(id)sender
{
if (_is_animating)