1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-23 03:37:27 +00:00

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.
This commit is contained in:
Akemi 2017-03-13 18:07:22 +01:00
parent 063ca8f0fe
commit 5e066670d0

View File

@ -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)