summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortorque <torque@1>2015-02-16 14:27:06 -0800
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-03-11 12:49:39 +0900
commit18d3c2ab85c6b860d174ec9e5805c025941d00d5 (patch)
tree5bb85671b63bf2c644c520e028b262f17f408dba
parentf84ca3a516d1d34cba2e9ef9bdbce95c7ebf399f (diff)
downloadmpv-18d3c2ab85c6b860d174ec9e5805c025941d00d5.tar.bz2
mpv-18d3c2ab85c6b860d174ec9e5805c025941d00d5.tar.xz
cocoa: update mouse coordinates when window is initialized.
Make MpvEventsView -signalMousePosition a public method so it can be called without a compiler warning. Previously, the mouse position would be reported as (0,0) until the cursor was moved. (cherry picked from commit bce753060eb9fb99ebc64fb6027d130a37b918a6)
-rw-r--r--video/out/cocoa/events_view.h1
-rw-r--r--video/out/cocoa/events_view.m1
-rw-r--r--video/out/cocoa_common.m4
3 files changed, 4 insertions, 2 deletions
diff --git a/video/out/cocoa/events_view.h b/video/out/cocoa/events_view.h
index a16a2d7d5a..3429563b4d 100644
--- a/video/out/cocoa/events_view.h
+++ b/video/out/cocoa/events_view.h
@@ -23,4 +23,5 @@
- (void)setFullScreen:(BOOL)willBeFullscreen;
- (void)clear;
- (BOOL)canHideCursor;
+- (void)signalMousePosition;
@end
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m
index 620de19f84..6dc9236c49 100644
--- a/video/out/cocoa/events_view.m
+++ b/video/out/cocoa/events_view.m
@@ -28,7 +28,6 @@
@property(nonatomic, assign) BOOL clearing;
@property(nonatomic, assign) BOOL hasMouseDown;
@property(nonatomic, retain) NSTrackingArea *tracker;
-- (void)signalMousePosition;
- (BOOL)hasDock:(NSScreen*)screen;
- (BOOL)hasMenubar:(NSScreen*)screen;
- (int)mpvButtonNumber:(NSEvent*)event;
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index b9aa1febee..86082435e8 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -365,6 +365,8 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags)
view.adapter = adapter;
s->view = view;
[parent addSubview:s->view];
+ // update the cursor position now that the view has been added.
+ [view signalMousePosition];
#if HAVE_COCOA_APPLICATION
cocoa_register_menu_item_action(MPM_H_SIZE, @selector(halfSize));
@@ -482,7 +484,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t flags, void *gl_ctx)
}
// trigger a resize -> don't set vo->dwidth and vo->dheight directly
- // since this block is executed asynchrolously to the video
+ // since this block is executed asynchronously to the video
// reconfiguration code.
s->pending_events |= VO_EVENT_RESIZE;
});