mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
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.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
- (void)signalMouseMovement:(NSPoint)point;
|
- (void)signalMouseMovement:(NSPoint)point;
|
||||||
- (void)putKey:(int)mpkey withModifiers:(int)modifiers;
|
- (void)putKey:(int)mpkey withModifiers:(int)modifiers;
|
||||||
- (void)putAxis:(int)mpkey delta:(float)delta;
|
- (void)putAxis:(int)mpkey delta:(float)delta;
|
||||||
|
- (void)putCommand:(char*)cmd;
|
||||||
- (void)performAsyncResize:(NSSize)size;
|
- (void)performAsyncResize:(NSSize)size;
|
||||||
|
|
||||||
- (BOOL)isInFullScreenMode;
|
- (BOOL)isInFullScreenMode;
|
||||||
|
|||||||
@@ -97,12 +97,8 @@
|
|||||||
|
|
||||||
- (void)mulSize:(float)multiplier
|
- (void)mulSize:(float)multiplier
|
||||||
{
|
{
|
||||||
if (![self.adapter isInFullScreenMode]) {
|
char *cmd = ta_asprintf(NULL, "set window-scale %f", multiplier);
|
||||||
NSSize size = [self.adapter videoSize];
|
[self.adapter putCommand:cmd];
|
||||||
size.width *= multiplier;
|
|
||||||
size.height *= multiplier;
|
|
||||||
[self setCenteredContentSize:size];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)titleHeight
|
- (int)titleHeight
|
||||||
|
|||||||
@@ -629,6 +629,13 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
|
|||||||
mp_input_put_axis(self.vout->input_ctx, mpkey, delta);
|
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 {
|
- (void)performAsyncResize:(NSSize)size {
|
||||||
vo_cocoa_resize_redraw(self.vout, size.width, size.height);
|
vo_cocoa_resize_redraw(self.vout, size.width, size.height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user