Commit e799040c authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: expand AppleScript API for menu navigation and menu status checks

parent 4c2de37f
......@@ -158,6 +158,7 @@ Mac OS X Interface
* new AppleScript API giving access to audio desynchronization
* Support for building with disabled sparkle update mechanism
* New configure flag to disable automatic updates
* Expanded AppleScript API for menu detection and navigation
iOS:
* Dropped support for iOS 6.x
......
......@@ -70,6 +70,12 @@
- (void)startListeningWithAppleRemote;
- (void)stopListeningWithAppleRemote;
- (void)menuFocusActivate;
- (void)moveMenuFocusLeft;
- (void)moveMenuFocusRight;
- (void)moveMenuFocusUp;
- (void)moveMenuFocusDown;
- (void)addSubtitlesToCurrentInput:(NSArray *)paths;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
......
......@@ -1057,6 +1057,57 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
[_remote stopListening:self];
}
#pragma mark - menu navigation
- (void)menuFocusActivate
{
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (p_input_thread == NULL)
return;
input_Control(p_input_thread, INPUT_NAV_ACTIVATE, NULL );
vlc_object_release(p_input_thread);
}
- (void)moveMenuFocusLeft
{
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (p_input_thread == NULL)
return;
input_Control(p_input_thread, INPUT_NAV_LEFT, NULL );
vlc_object_release(p_input_thread);
}
- (void)moveMenuFocusRight
{
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (p_input_thread == NULL)
return;
input_Control(p_input_thread, INPUT_NAV_RIGHT, NULL );
vlc_object_release(p_input_thread);
}
- (void)moveMenuFocusUp
{
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (p_input_thread == NULL)
return;
input_Control(p_input_thread, INPUT_NAV_UP, NULL );
vlc_object_release(p_input_thread);
}
- (void)moveMenuFocusDown
{
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (p_input_thread == NULL)
return;
input_Control(p_input_thread, INPUT_NAV_DOWN, NULL );
vlc_object_release(p_input_thread);
}
/* Helper method for the remote control interface in order to trigger forward/backward and volume
increase/decrease as long as the user holds the left/right, plus/minus button */
- (void) executeHoldActionForRemoteButton: (NSNumber*) buttonIdentifierNumber
......
......@@ -47,5 +47,6 @@
@property (readonly) int durationOfCurrentItem;
@property (readonly) NSString *pathOfCurrentItem;
@property (readonly) NSString *nameOfCurrentItem;
@property (readonly) BOOL playbackShowsMenu;
@end
......@@ -102,6 +102,16 @@
[[VLCCoreInteraction sharedInstance] volumeUp];
else if ([o_command isEqualToString:@"volumeDown"])
[[VLCCoreInteraction sharedInstance] volumeDown];
else if ([o_command isEqualToString:@"moveMenuFocusUp"])
[[VLCCoreInteraction sharedInstance] moveMenuFocusUp];
else if ([o_command isEqualToString:@"moveMenuFocusDown"])
[[VLCCoreInteraction sharedInstance] moveMenuFocusDown];
else if ([o_command isEqualToString:@"moveMenuFocusLeft"])
[[VLCCoreInteraction sharedInstance] moveMenuFocusLeft];
else if ([o_command isEqualToString:@"moveMenuFocusRight"])
[[VLCCoreInteraction sharedInstance] moveMenuFocusRight];
else if ([o_command isEqualToString:@"menuFocusActivate"])
[[VLCCoreInteraction sharedInstance] menuFocusActivate];
else if ([o_command isEqualToString:@"stepForward"]) {
//default: forwardShort
if (o_parameter) {
......@@ -268,4 +278,38 @@
return [[VLCCoreInteraction sharedInstance] nameOfCurrentPlaylistItem];
}
- (BOOL)playbackShowsMenu {
input_thread_t *p_input_thread = pl_CurrentInput(getIntf());
if (!p_input_thread)
return NO;
int i_current_title = var_GetInteger(p_input_thread, "title");
input_title_t **p_input_title;
int count;
/* fetch data */
int coreret = input_Control(p_input_thread, INPUT_GET_FULL_TITLE_INFO,
&p_input_title, &count);
vlc_object_release(p_input_thread);
if (coreret != VLC_SUCCESS)
return NO;
BOOL ret = NO;
if (count > 0 && i_current_title < count) {
ret = p_input_title[i_current_title]->i_flags & INPUT_TITLE_MENU;
}
/* free array */
for (int i = 0; i < count; i++) {
vlc_input_title_Delete(p_input_title[i]);
}
free(p_input_title);
return ret;
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment