From 3f594c2e848f21329c0548e27544ef3827e06a56 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 22 Nov 2013 08:43:02 +0100 Subject: cocoa: use window-scale to support video scaling functionality In the cocoa backend you can use cmd+0/1/2 to scale the window. This commit makes it use the new window-scale functionality. --- video/out/cocoa/mpvadapter.h | 1 + video/out/cocoa/window.m | 8 ++------ video/out/cocoa_common.m | 7 +++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/video/out/cocoa/mpvadapter.h b/video/out/cocoa/mpvadapter.h index eafeefce9f..b1a13d5ace 100644 --- a/video/out/cocoa/mpvadapter.h +++ b/video/out/cocoa/mpvadapter.h @@ -23,6 +23,7 @@ - (void)signalMouseMovement:(NSPoint)point; - (void)putKey:(int)mpkey withModifiers:(int)modifiers; - (void)putAxis:(int)mpkey delta:(float)delta; +- (void)putCommand:(char*)cmd; - (void)performAsyncResize:(NSSize)size; - (BOOL)isInFullScreenMode; diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m index 97f5af1dd9..b259af134e 100644 --- a/video/out/cocoa/window.m +++ b/video/out/cocoa/window.m @@ -97,12 +97,8 @@ - (void)mulSize:(float)multiplier { - if (![self.adapter isInFullScreenMode]) { - NSSize size = [self.adapter videoSize]; - size.width *= multiplier; - size.height *= multiplier; - [self setCenteredContentSize:size]; - } + char *cmd = ta_asprintf(NULL, "set window-scale %f", multiplier); + [self.adapter putCommand:cmd]; } - (int)titleHeight diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 4dded28301..3d1f8868f1 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -629,6 +629,13 @@ int vo_cocoa_cgl_color_size(struct vo *vo) mp_input_put_axis(self.vout->input_ctx, mpkey, delta); } +- (void)putCommand:(char*)cmd +{ + mp_cmd_t *cmdt = mp_input_parse_cmd(self.vout->input_ctx, bstr0(cmd), ""); + mp_input_queue_cmd(self.vout->input_ctx, cmdt); + ta_free(cmd); +} + - (void)performAsyncResize:(NSSize)size { vo_cocoa_resize_redraw(self.vout, size.width, size.height); } -- cgit v1.2.3