Commit b2c77d44 authored by David Fuhrmann's avatar David Fuhrmann

macosx: replace controlsbar updating code by a safer helper

In the previous implementation was so unsafe that the ARC
compiler was not able work properly and printed a warning.

While there was no real problem here, switch to blocks to
silence the compiler and see potential errors earlier.
parent c8961ccb
...@@ -654,7 +654,9 @@ static const float f_min_window_height = 307.; ...@@ -654,7 +654,9 @@ static const float f_min_window_height = 307.;
[self.controlsBar updateTimeSlider]; [self.controlsBar updateTimeSlider];
[self.fspanel updatePositionAndTime]; [self.fspanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)]; [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar updateTimeSlider];
}];
[[VLCCoreInteraction sharedInstance] updateAtoB]; [[VLCCoreInteraction sharedInstance] updateAtoB];
} }
...@@ -722,7 +724,9 @@ static const float f_min_window_height = 307.; ...@@ -722,7 +724,9 @@ static const float f_min_window_height = 307.;
- (void)updateWindow - (void)updateWindow
{ {
[self.controlsBar updateControls]; [self.controlsBar updateControls];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateControls)]; [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar updateControls];
}];
bool b_seekable = false; bool b_seekable = false;
...@@ -756,7 +760,9 @@ static const float f_min_window_height = 307.; ...@@ -756,7 +760,9 @@ static const float f_min_window_height = 307.;
[self.controlsBar setPause]; [self.controlsBar setPause];
[self.fspanel setPause]; [self.fspanel setPause];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPause)]; [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar setPause];
}];
} }
- (void)setPlay - (void)setPlay
...@@ -764,7 +770,9 @@ static const float f_min_window_height = 307.; ...@@ -764,7 +770,9 @@ static const float f_min_window_height = 307.;
[self.controlsBar setPlay]; [self.controlsBar setPlay];
[self.fspanel setPlay]; [self.fspanel setPlay];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPlay)]; [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
[controlsBar setPlay];
}];
} }
- (void)updateVolumeSlider - (void)updateVolumeSlider
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#import <vlc_vout_window.h> #import <vlc_vout_window.h>
#import "KeyboardBacklight.h" #import "KeyboardBacklight.h"
@class VLCControlsBarCommon;
@class VLCVideoWindowCommon; @class VLCVideoWindowCommon;
@class VLCVoutView; @class VLCVoutView;
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
- (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd; - (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd;
- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation; - (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation;
- (void)updateWindowsControlsBarWithSelector:(SEL)aSel; - (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block;
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater; - (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level; - (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
......
...@@ -554,13 +554,14 @@ void WindowClose(vout_window_t *p_wnd) ...@@ -554,13 +554,14 @@ void WindowClose(vout_window_t *p_wnd)
#pragma mark - #pragma mark -
#pragma mark Misc methods #pragma mark Misc methods
- (void)updateWindowsControlsBarWithSelector:(SEL)aSel - (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block
{ {
[o_vout_dict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { [o_vout_dict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if ([obj respondsToSelector:@selector(controlsBar)]) { if ([obj respondsToSelector:@selector(controlsBar)]) {
id o_controlsBar = [obj controlsBar]; VLCControlsBarCommon *o_controlsBar = [obj controlsBar];
if (o_controlsBar) if (o_controlsBar && block)
[o_controlsBar performSelector:aSel]; block(o_controlsBar);
} }
}]; }];
} }
......
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