[vlc-commits] macosx: Move input-related handlers to InputManager, simplify
David Fuhrmann
git at videolan.org
Sat Jun 27 23:04:59 CEST 2015
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jun 27 22:31:54 2015 +0200| [91751dbd6aaeacf12544f44d34c2b5594f66823a] | committer: David Fuhrmann
macosx: Move input-related handlers to InputManager, simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91751dbd6aaeacf12544f44d34c2b5594f66823a
---
modules/gui/macosx/InputManager.m | 56 +++++++++++++++++++-------
modules/gui/macosx/MainWindow.m | 2 +
modules/gui/macosx/VLCVoutWindowController.m | 4 +-
modules/gui/macosx/fspanel.m | 2 +-
modules/gui/macosx/intf.h | 6 ---
modules/gui/macosx/intf.m | 33 ---------------
6 files changed, 46 insertions(+), 57 deletions(-)
diff --git a/modules/gui/macosx/InputManager.m b/modules/gui/macosx/InputManager.m
index 004d915..d34b22c 100644
--- a/modules/gui/macosx/InputManager.m
+++ b/modules/gui/macosx/InputManager.m
@@ -21,6 +21,7 @@
#import "InputManager.h"
+#import "CoreInteraction.h"
#import "CompatibilityFixes.h"
#import "ExtensionsManager.h"
#import "intf.h"
@@ -28,6 +29,7 @@
#import "MainWindow.h"
#import "playlist.h"
#import "playlistinfo.h"
+#import "TrackSynchronization.h"
#import "iTunes.h"
#import "Spotify.h"
@@ -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];
break;
case INPUT_EVENT_POSITION:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject: nil waitUntilDone:NO];
+ [[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_CACHE:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainWindow) withObject: nil waitUntilDone: NO];
+ [inputManager performSelectorOnMainThread:@selector(updateMainWindow) withObject:nil waitUntilDone:NO];
break;
case INPUT_EVENT_STATISTICS:
dispatch_async(dispatch_get_main_queue(), ^{
@@ -84,17 +86,19 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_ITEM_META:
case INPUT_EVENT_ITEM_INFO:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_BOOKMARK:
break;
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;
case INPUT_EVENT_PROGRAM:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_ITEM_EPG:
break;
@@ -102,17 +106,17 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_ITEM_NAME:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_AUDIO_DELAY:
case INPUT_EVENT_SUBTITLE_DELAY:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO];
break;
case INPUT_EVENT_DEAD:
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
- [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject:nil waitUntilDone:NO];
+ [inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
+ [[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject:nil waitUntilDone:NO];
break;
default:
@@ -198,9 +202,9 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[self updateMetaAndInfo];
- [[o_main mainWindow] updateWindow];
- [o_main updateDelays];
- [o_main updateMainMenu];
+ [self updateMainWindow];
+ [self updateDelays];
+ [self updateMainMenu];
/*
* 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,
}
}
- [[VLCMain sharedInstance] updateMainWindow];
+ [self updateMainWindow];
[self sendDistributedNotificationWithUpdatedPlaybackStatus];
}
@@ -383,6 +387,28 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[[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
{
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VLCPlayerStateDidChange"
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 6655857..b107565 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -688,6 +688,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_fspanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
+
+ [[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateName
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 38c80d3..b344bda 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -212,8 +212,8 @@
if (b_nonembedded) {
// events might be posted before window is created, so call them again
- [[VLCMain sharedInstance] updateName];
- [[VLCMain sharedInstance] updateMainWindow]; // update controls bar
+ [[[VLCMain sharedInstance] mainWindow] updateName];
+ [[[VLCMain sharedInstance] mainWindow] updateWindow]; // update controls bar
}
// TODO: find a cleaner way for "start in fullscreen"
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index 78967cd..656ded9 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -642,7 +642,7 @@
var_Set(p_input, "position", pos);
vlc_object_release(p_input);
}
- [[VLCMain sharedInstance] updatePlaybackPosition];
+ [[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
}
- (IBAction)fsVolumeSliderUpdate:(id)sender
diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index 6c18640..04114d2 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -146,14 +146,8 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (void)plItemUpdated;
- (void)playbackModeUpdated;
- (void)updateVolume;
-- (void)updatePlaybackPosition;
-- (void)updateName;
-- (void)updateRecordState: (BOOL)b_value;
-- (void)updateMainMenu;
-- (void)updateMainWindow;
- (void)showMainWindow;
- (void)showFullscreenController;
-- (void)updateDelays;
- (void)updateTogglePlaylistState;
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index fdb0546..3801c79 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1225,18 +1225,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_info updateMetadata];
}
-- (void)updateMainMenu
-{
- [o_mainmenu setupMenus];
- [o_mainmenu updatePlaybackRate];
- [[VLCCoreInteraction sharedInstance] resetAtoB];
-}
-
-- (void)updateMainWindow
-{
- [o_mainwindow updateWindow];
-}
-
- (void)showMainWindow
{
[o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO];
@@ -1249,32 +1237,11 @@ static VLCMain *_o_sharedMainInstance = nil;
[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
{
[o_mainwindow updateVolumeSlider];
}
-- (void)updateRecordState: (BOOL)b_value
-{
- [o_mainmenu updateRecordState:b_value];
-}
-
- (void)playbackModeUpdated
{
playlist_t * p_playlist = pl_Get(VLCIntf);
More information about the vlc-commits
mailing list