1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-27 02:40:53 +00:00

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.
This commit is contained in:
torque 2015-02-16 14:27:06 -08:00 committed by Stefano Pigozzi
parent 678cd30904
commit bce753060e
3 changed files with 4 additions and 2 deletions

View File

@ -23,4 +23,5 @@
- (void)setFullScreen:(BOOL)willBeFullscreen;
- (void)clear;
- (BOOL)canHideCursor;
- (void)signalMousePosition;
@end

View File

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

View File

@ -455,6 +455,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));
@ -572,7 +574,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;
});