From eb902efb0450b0080688fd210951049579d316b6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 17 Oct 2014 19:15:17 +0200 Subject: cocoa: allow mouse events to bubble up with no-input-cursor Previously we didn't report events to the core, but still prevented the events to travel on the responder chain. --- video/out/cocoa_common.m | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'video/out/cocoa_common.m') diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 655c740169..0b1acdcce7 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -693,6 +693,14 @@ void *vo_cocoa_cgl_pixel_format(struct vo *vo) vo_cocoa_set_current_context(self.vout, false); } +- (BOOL)keyboardEnabled { + return !!mp_input_vo_keyboard_enabled(self.vout->input_ctx); +} + +- (BOOL)mouseEnabled { + return !!mp_input_mouse_enabled(self.vout->input_ctx); +} + - (void)setNeedsResize { struct vo_cocoa_state *s = self.vout->cocoa; s->pending_events |= VO_EVENT_RESIZE; @@ -710,28 +718,23 @@ void *vo_cocoa_cgl_pixel_format(struct vo *vo) } - (void)signalMouseMovement:(NSPoint)point { - if (mp_input_mouse_enabled(self.vout->input_ctx)) { - mp_input_set_mouse_pos(self.vout->input_ctx, point.x, point.y); - [self recalcMovableByWindowBackground:point]; - } + mp_input_set_mouse_pos(self.vout->input_ctx, point.x, point.y); + [self recalcMovableByWindowBackground:point]; } - (void)putKeyEvent:(NSEvent*)event { - if (mp_input_vo_keyboard_enabled(self.vout->input_ctx)) - cocoa_put_key_event(event); + cocoa_put_key_event(event); } - (void)putKey:(int)mpkey withModifiers:(int)modifiers { - if (mp_input_vo_keyboard_enabled(self.vout->input_ctx)) - cocoa_put_key_with_modifiers(mpkey, modifiers); + cocoa_put_key_with_modifiers(mpkey, modifiers); } - (void)putAxis:(int)mpkey delta:(float)delta; { - if (mp_input_mouse_enabled(self.vout->input_ctx)) - mp_input_put_axis(self.vout->input_ctx, mpkey, delta); + mp_input_put_axis(self.vout->input_ctx, mpkey, delta); } - (void)putCommand:(char*)cmd -- cgit v1.2.3