mirror of https://code.videolan.org/videolan/vlc
macosx: use a notification to update the window level instead of calling the singleton directly
This commit is contained in:
parent
52eb94a956
commit
cf6a864018
|
@ -114,7 +114,6 @@
|
|||
- (IBAction)applyProfileCheckboxChanged:(id)sender;
|
||||
|
||||
- (void)toggleWindow:(id)sender;
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
- (void)saveCurrentProfileAtTerminate;
|
||||
|
||||
/* Equalizer */
|
||||
|
|
|
@ -204,6 +204,11 @@ NSString *VLCAudioEffectsProfileNamesKey = @"AudioEffectProfileNames";
|
|||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(updateCocoaWindowLevel:)
|
||||
name:VLCWindowShouldUpdateLevel
|
||||
object:nil];
|
||||
|
||||
[_applyProfileCheckbox setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"AudioEffectApplyProfileOnStartup"]];
|
||||
[_applyProfileCheckbox setTitle:_NS("Apply profile at next launch")];
|
||||
|
||||
|
@ -281,6 +286,11 @@ NSString *VLCAudioEffectsProfileNamesKey = @"AudioEffectProfileNames";
|
|||
[self resetProfileSelector];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark internal functions
|
||||
|
||||
|
@ -333,8 +343,9 @@ NSString *VLCAudioEffectsProfileNamesKey = @"AudioEffectProfileNames";
|
|||
|
||||
#pragma mark -
|
||||
#pragma mark generic code
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
@property (readwrite, weak) IBOutlet NSTextField *editNameTextField;
|
||||
@property (readwrite, weak) IBOutlet NSTextField *editTimeTextField;
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
- (IBAction)toggleWindow:(id)sender;
|
||||
|
||||
- (IBAction)add:(id)sender;
|
||||
|
|
|
@ -54,7 +54,9 @@
|
|||
- (id)init
|
||||
{
|
||||
self = [super initWithWindowNibName:@"Bookmarks"];
|
||||
|
||||
if (self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateCocoaWindowLevel:) name:VLCWindowShouldUpdateLevel object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -93,8 +95,9 @@
|
|||
[_editTimeLabel setStringValue: _NS("Time")];
|
||||
}
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@
|
|||
@property (readwrite, weak) IBOutlet NSTextField *videoDecodedLabel;
|
||||
@property (readwrite, weak) IBOutlet NSTextField *videoDecodedTextField;
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
- (IBAction)toggleWindow:(id)sender;
|
||||
|
||||
- (IBAction)metaFieldChanged:(id)sender;
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
selector:@selector(updateStatistics:)
|
||||
name:VLCPlayerStatisticsUpdated
|
||||
object:nil];
|
||||
[defaultNotificationCenter addObserver:self
|
||||
selector:@selector(updateCocoaWindowLevel:)
|
||||
name:VLCWindowShouldUpdateLevel
|
||||
object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -148,8 +152,9 @@
|
|||
[self updatePanelWithItem:_mediaItem];
|
||||
}
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@
|
|||
@property (readwrite, weak) IBOutlet NSTextField *sv_durTextField;
|
||||
@property (readwrite, weak) IBOutlet NSStepper *sv_durStepper;
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
|
||||
- (IBAction)toggleWindow:(id)sender;
|
||||
- (IBAction)resetValues:(id)sender;
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@
|
|||
selector:@selector(updateValues:)
|
||||
name:VLCPlayerSubtitlesFPSChanged
|
||||
object:nil];
|
||||
[notificationCenter addObserver:self
|
||||
selector:@selector(updateCocoaWindowLevel:)
|
||||
name:VLCWindowShouldUpdateLevel
|
||||
object:nil];
|
||||
|
||||
[self.window setTitle:_NS("Track Synchronization")];
|
||||
[_resetButton setTitle:_NS("Reset")];
|
||||
|
@ -117,8 +121,9 @@
|
|||
[self resetValues:self];
|
||||
}
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -167,7 +167,6 @@
|
|||
@property (nonatomic) int posterizeValue;
|
||||
|
||||
/* generic */
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
- (void)saveCurrentProfileAtTerminate;
|
||||
|
||||
- (void)toggleWindow:(id)sender;
|
||||
|
|
|
@ -72,6 +72,11 @@ NSString *VLCVideoEffectsProfileNamesKey = @"VideoEffectProfileNames";
|
|||
{
|
||||
self = [super initWithWindowNibName:@"VideoEffects"];
|
||||
if (self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(updateCocoaWindowLevel:)
|
||||
name:VLCWindowShouldUpdateLevel
|
||||
object:nil];
|
||||
|
||||
self.popupPanel = [[VLCPopupPanelController alloc] init];
|
||||
self.textfieldPanel = [[VLCTextfieldPanelController alloc] init];
|
||||
|
||||
|
@ -334,8 +339,9 @@ NSString *VLCVideoEffectsProfileNamesKey = @"VideoEffectProfileNames";
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ typedef void(^CompletionBlock)(enum ResumeResult);
|
|||
|
||||
- (void)showWindowWithItem:(input_item_t *)p_item withLastPosition:(NSInteger)pos completionBlock:(CompletionBlock)block;
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
|
||||
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,10 +40,21 @@
|
|||
- (id)init
|
||||
{
|
||||
self = [super initWithWindowNibName:@"ResumeDialog"];
|
||||
if (self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(updateCocoaWindowLevel:)
|
||||
name:VLCWindowShouldUpdateLevel
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[o_title_lbl setStringValue:_NS("Continue playback?")];
|
||||
|
@ -59,7 +70,6 @@
|
|||
currentResumeTimeout = 10;
|
||||
completionBlock = [block copy];
|
||||
|
||||
|
||||
NSString *o_restartButtonLabel = _NS("Restart playback");
|
||||
o_restartButtonLabel = [o_restartButtonLabel stringByAppendingFormat:@" (%d)", currentResumeTimeout];
|
||||
[o_restart_btn setTitle:o_restartButtonLabel];
|
||||
|
@ -122,8 +132,9 @@
|
|||
config_PutInt("macosx-continue-playback", newState);
|
||||
}
|
||||
|
||||
- (void)updateCocoaWindowLevel:(NSInteger)i_level
|
||||
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
|
||||
{
|
||||
NSInteger i_level = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
|
||||
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
|
||||
[self.window setLevel: i_level];
|
||||
}
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
@class VLCVideoWindowCommon;
|
||||
@class VLCVoutView;
|
||||
|
||||
extern NSString *VLCWindowShouldUpdateLevel;
|
||||
extern NSString *VLCWindowLevelKey;
|
||||
|
||||
@interface VLCVideoOutputProvider : NSObject
|
||||
|
||||
@property (readonly, nonatomic) NSInteger currentStatusWindowLevel;
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
#import "panels/VLCBookmarksWindowController.h"
|
||||
#import "panels/VLCTrackSynchronizationWindowController.h"
|
||||
|
||||
NSString *VLCWindowShouldUpdateLevel = @"VLCWindowShouldUpdateLevel";
|
||||
NSString *VLCWindowLevelKey = @"VLCWindowLevelKey";
|
||||
|
||||
static int WindowEnable(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
@ -551,16 +554,10 @@ int WindowOpen(vout_window_t *p_wnd)
|
|||
_currentStatusWindowLevel = i_level + 1;
|
||||
}
|
||||
|
||||
NSInteger currentStatusWindowLevel = self.currentStatusWindowLevel;
|
||||
|
||||
VLCMain *main = [VLCMain sharedInstance];
|
||||
[[main libraryWindow] setWindowLevel:i_level];
|
||||
[[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
[[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
[[main currentMediaInfoPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
[[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
[[main trackSyncPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
[[main resumeDialog] updateCocoaWindowLevel:currentStatusWindowLevel];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:VLCWindowShouldUpdateLevel object:self userInfo:@{VLCWindowLevelKey : @(_currentWindowLevel)}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -78,12 +78,14 @@ NSString *VLCVideoWindowDidEnterFullscreen = @"VLCVideoWindowDidEnterFullscreen"
|
|||
self = [super initWithContentRect:contentRect styleMask:styleMask
|
||||
backing:backingType defer:flag];
|
||||
|
||||
/* we want to be moveable regardless of our style */
|
||||
[self setMovableByWindowBackground: YES];
|
||||
[self setCanBecomeKeyWindow:YES];
|
||||
if (self) {
|
||||
/* we want to be moveable regardless of our style */
|
||||
[self setMovableByWindowBackground: YES];
|
||||
[self setCanBecomeKeyWindow:YES];
|
||||
|
||||
o_temp_view = [[NSView alloc] init];
|
||||
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
|
||||
o_temp_view = [[NSView alloc] init];
|
||||
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue