summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-22 08:43:02 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-22 08:43:02 +0100
commit3f594c2e848f21329c0548e27544ef3827e06a56 (patch)
tree5d07f14ba2b45afad4246fbb5e2d60474be1cfbc
parentede608ed4365eb43d8630b9a9a9b6c642af279ce (diff)
downloadmpv-3f594c2e848f21329c0548e27544ef3827e06a56.tar.bz2
mpv-3f594c2e848f21329c0548e27544ef3827e06a56.tar.xz
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.
-rw-r--r--video/out/cocoa/mpvadapter.h1
-rw-r--r--video/out/cocoa/window.m8
-rw-r--r--video/out/cocoa_common.m7
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);
}