mirror of
https://github.com/mpv-player/mpv
synced 2025-02-26 02:05:31 +00:00
cocoa: support the "window-minimized" property
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
This commit is contained in:
parent
5c3a6ca96e
commit
d7f04e2085
@ -2,7 +2,7 @@
|
||||
-- if it's brought back again. If the player was already paused when minimizing,
|
||||
-- then try not to mess with the pause state.
|
||||
|
||||
-- Note: currently works with X11 only.
|
||||
-- Note: currently works with X11 or OS X only.
|
||||
|
||||
local did_minimize = false
|
||||
|
||||
|
@ -71,6 +71,16 @@
|
||||
[self.adapter windowDidBecomeKey:notification];
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification *)notification
|
||||
{
|
||||
[self.adapter windowDidMiniaturize:notification];
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)notification
|
||||
{
|
||||
[self.adapter windowDidDeminiaturize:notification];
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
|
@ -744,6 +744,16 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
});
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_GET_WIN_STATE: {
|
||||
with_cocoa_lock(vo->cocoa, ^{
|
||||
if ([[vo->cocoa->view window] isMiniaturized]) {
|
||||
*(int *)arg |= VO_WIN_STATE_MINIMIZED;
|
||||
} else {
|
||||
*(int *)arg = 0;
|
||||
}
|
||||
});
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_SET_CURSOR_VISIBILITY:
|
||||
return vo_cocoa_set_cursor_visibility(vo, arg);
|
||||
case VOCTRL_UPDATE_WINDOW_TITLE:
|
||||
@ -873,4 +883,16 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
[self didChangeMousePosition];
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification *)notification
|
||||
{
|
||||
struct vo_cocoa_state *s = self.vout->cocoa;
|
||||
s->pending_events |= VO_EVENT_WIN_STATE;
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)notification
|
||||
{
|
||||
struct vo_cocoa_state *s = self.vout->cocoa;
|
||||
s->pending_events |= VO_EVENT_WIN_STATE;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user