Commit 91751dbd authored by David Fuhrmann's avatar David Fuhrmann

macosx: Move input-related handlers to InputManager, simplify

parent 0eaddd99
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#import "InputManager.h" #import "InputManager.h"
#import "CoreInteraction.h"
#import "CompatibilityFixes.h" #import "CompatibilityFixes.h"
#import "ExtensionsManager.h" #import "ExtensionsManager.h"
#import "intf.h" #import "intf.h"
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
#import "MainWindow.h" #import "MainWindow.h"
#import "playlist.h" #import "playlist.h"
#import "playlistinfo.h" #import "playlistinfo.h"
#import "TrackSynchronization.h"
#import "iTunes.h" #import "iTunes.h"
#import "Spotify.h" #import "Spotify.h"
...@@ -60,14 +62,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -60,14 +62,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[[[VLCMain sharedInstance] mainMenu] performSelectorOnMainThread:@selector(updatePlaybackRate) withObject: nil waitUntilDone:NO]; [[[VLCMain sharedInstance] mainMenu] performSelectorOnMainThread:@selector(updatePlaybackRate) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_POSITION: case INPUT_EVENT_POSITION:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject: nil waitUntilDone:NO]; [[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_TITLE: case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER: case INPUT_EVENT_CHAPTER:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_CACHE: case INPUT_EVENT_CACHE:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainWindow) withObject: nil waitUntilDone: NO]; [inputManager performSelectorOnMainThread:@selector(updateMainWindow) withObject:nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_STATISTICS: case INPUT_EVENT_STATISTICS:
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
...@@ -84,17 +86,19 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -84,17 +86,19 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break; break;
case INPUT_EVENT_ITEM_META: case INPUT_EVENT_ITEM_META:
case INPUT_EVENT_ITEM_INFO: case INPUT_EVENT_ITEM_INFO:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_BOOKMARK: case INPUT_EVENT_BOOKMARK:
break; break;
case INPUT_EVENT_RECORD: case INPUT_EVENT_RECORD:
[[VLCMain sharedInstance] updateRecordState: var_GetBool(p_this, "record")]; dispatch_async(dispatch_get_main_queue(), ^{
[[[VLCMain sharedInstance] mainMenu] updateRecordState: var_InheritBool(p_this, "record")];
});
break; break;
case INPUT_EVENT_PROGRAM: case INPUT_EVENT_PROGRAM:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_ITEM_EPG: case INPUT_EVENT_ITEM_EPG:
break; break;
...@@ -102,17 +106,17 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -102,17 +106,17 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break; break;
case INPUT_EVENT_ITEM_NAME: case INPUT_EVENT_ITEM_NAME:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_AUDIO_DELAY: case INPUT_EVENT_AUDIO_DELAY:
case INPUT_EVENT_SUBTITLE_DELAY: case INPUT_EVENT_SUBTITLE_DELAY:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO];
break; break;
case INPUT_EVENT_DEAD: case INPUT_EVENT_DEAD:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO]; [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject:nil waitUntilDone:NO]; [[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject:nil waitUntilDone:NO];
break; break;
default: default:
...@@ -198,9 +202,9 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -198,9 +202,9 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[self updateMetaAndInfo]; [self updateMetaAndInfo];
[[o_main mainWindow] updateWindow]; [self updateMainWindow];
[o_main updateDelays]; [self updateDelays];
[o_main updateMainMenu]; [self updateMainMenu];
/* /*
* Due to constraints within NSAttributedString's main loop runtime handling * Due to constraints within NSAttributedString's main loop runtime handling
...@@ -334,7 +338,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -334,7 +338,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
} }
} }
[[VLCMain sharedInstance] updateMainWindow]; [self updateMainWindow];
[self sendDistributedNotificationWithUpdatedPlaybackStatus]; [self sendDistributedNotificationWithUpdatedPlaybackStatus];
} }
...@@ -383,6 +387,28 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, ...@@ -383,6 +387,28 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[[o_main info] updatePanelWithItem:p_input_item]; [[o_main info] updatePanelWithItem:p_input_item];
} }
- (void)updateMainWindow
{
[[o_main mainWindow] updateWindow];
}
- (void)updateName
{
[[o_main mainWindow] updateName];
}
- (void)updateDelays
{
[[VLCTrackSynchronization sharedInstance] updateValues];
}
- (void)updateMainMenu
{
[[o_main mainMenu] setupMenus];
[[o_main mainMenu] updatePlaybackRate];
[[VLCCoreInteraction sharedInstance] resetAtoB];
}
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus - (void)sendDistributedNotificationWithUpdatedPlaybackStatus
{ {
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VLCPlayerStateDidChange" [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VLCPlayerStateDidChange"
......
...@@ -688,6 +688,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -688,6 +688,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_fspanel updatePositionAndTime]; [o_fspanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)]; [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
[[VLCCoreInteraction sharedInstance] updateAtoB];
} }
- (void)updateName - (void)updateName
......
...@@ -212,8 +212,8 @@ ...@@ -212,8 +212,8 @@
if (b_nonembedded) { if (b_nonembedded) {
// events might be posted before window is created, so call them again // events might be posted before window is created, so call them again
[[VLCMain sharedInstance] updateName]; [[[VLCMain sharedInstance] mainWindow] updateName];
[[VLCMain sharedInstance] updateMainWindow]; // update controls bar [[[VLCMain sharedInstance] mainWindow] updateWindow]; // update controls bar
} }
// TODO: find a cleaner way for "start in fullscreen" // TODO: find a cleaner way for "start in fullscreen"
......
...@@ -642,7 +642,7 @@ ...@@ -642,7 +642,7 @@
var_Set(p_input, "position", pos); var_Set(p_input, "position", pos);
vlc_object_release(p_input); vlc_object_release(p_input);
} }
[[VLCMain sharedInstance] updatePlaybackPosition]; [[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
} }
- (IBAction)fsVolumeSliderUpdate:(id)sender - (IBAction)fsVolumeSliderUpdate:(id)sender
......
...@@ -146,14 +146,8 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -146,14 +146,8 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (void)plItemUpdated; - (void)plItemUpdated;
- (void)playbackModeUpdated; - (void)playbackModeUpdated;
- (void)updateVolume; - (void)updateVolume;
- (void)updatePlaybackPosition;
- (void)updateName;
- (void)updateRecordState: (BOOL)b_value;
- (void)updateMainMenu;
- (void)updateMainWindow;
- (void)showMainWindow; - (void)showMainWindow;
- (void)showFullscreenController; - (void)showFullscreenController;
- (void)updateDelays;
- (void)updateTogglePlaylistState; - (void)updateTogglePlaylistState;
......
...@@ -1225,18 +1225,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1225,18 +1225,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_info updateMetadata]; [o_info updateMetadata];
} }
- (void)updateMainMenu
{
[o_mainmenu setupMenus];
[o_mainmenu updatePlaybackRate];
[[VLCCoreInteraction sharedInstance] resetAtoB];
}
- (void)updateMainWindow
{
[o_mainwindow updateWindow];
}
- (void)showMainWindow - (void)showMainWindow
{ {
[o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO]; [o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO];
...@@ -1249,32 +1237,11 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1249,32 +1237,11 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO]; [o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
} }
- (void)updateDelays
{
[[VLCTrackSynchronization sharedInstance] performSelectorOnMainThread: @selector(updateValues) withObject: nil waitUntilDone:NO];
}
- (void)updateName
{
[o_mainwindow updateName];
}
- (void)updatePlaybackPosition
{
[o_mainwindow updateTimeSlider];
[[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateVolume - (void)updateVolume
{ {
[o_mainwindow updateVolumeSlider]; [o_mainwindow updateVolumeSlider];
} }
- (void)updateRecordState: (BOOL)b_value
{
[o_mainmenu updateRecordState:b_value];
}
- (void)playbackModeUpdated - (void)playbackModeUpdated
{ {
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t * p_playlist = pl_Get(VLCIntf);
......
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