summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorMad Fish <MadFishTheOne@gmail.com>2013-01-20 16:53:51 +0100
committerMad Fish <MadFishTheOne@gmail.com>2013-01-20 16:53:51 +0100
commitec0bd696193093a091da42ec98708a97d3dd1dc7 (patch)
tree4378217ad1c85a1532f99d916600ea394c7b5e5c /video
parent5b7327920b1500c33342c021e70136973972fbce (diff)
downloadmpv-ec0bd696193093a091da42ec98708a97d3dd1dc7.tar.bz2
mpv-ec0bd696193093a091da42ec98708a97d3dd1dc7.tar.xz
cocoa_common: handle all pending events instead of just one
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m43
1 files changed, 24 insertions, 19 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index c713398863..d23a439629 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -472,7 +472,7 @@ static void vo_cocoa_display_cursor(struct vo *vo, int requested_state)
int vo_cocoa_check_events(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
- NSEvent *event;
+
int ms_time = (int) ([[NSProcessInfo processInfo] systemUptime] * 1000);
// automatically hide mouse cursor
@@ -482,26 +482,31 @@ int vo_cocoa_check_events(struct vo *vo)
s->cursor_timer = ms_time;
}
- event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil
- inMode:NSEventTrackingRunLoopMode dequeue:YES];
- if (event == nil)
- return 0;
- [NSApp sendEvent:event];
+ int result = 0;
- if (s->did_resize) {
- s->did_resize = NO;
- resize_window(vo);
- return VO_EVENT_RESIZE;
- }
- // Without SDL's bootstrap code (include SDL.h in mplayer.c),
- // on Leopard, we have trouble to get the play window automatically focused
- // when the app is actived. The Following code fix this problem.
- if ([event type] == NSAppKitDefined
- && [event subtype] == NSApplicationActivatedEventType) {
- [s->window makeMainWindow];
- [s->window makeKeyAndOrderFront:nil];
+ for (;;) {
+ NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil
+ inMode:NSEventTrackingRunLoopMode dequeue:YES];
+ if (event == nil)
+ break;
+ [NSApp sendEvent:event];
+
+ if (s->did_resize) {
+ s->did_resize = NO;
+ resize_window(vo);
+ result |= VO_EVENT_RESIZE;
+ }
+ // Without SDL's bootstrap code (include SDL.h in mplayer.c),
+ // on Leopard, we have trouble to get the play window automatically focused
+ // when the app is actived. The Following code fix this problem.
+ if ([event type] == NSAppKitDefined
+ && [event subtype] == NSApplicationActivatedEventType) {
+ [s->window makeMainWindow];
+ [s->window makeKeyAndOrderFront:nil];
+ }
}
- return 0;
+
+ return result;
}
void vo_cocoa_fullscreen(struct vo *vo)