Commit 2e6b25b0 authored by David Fuhrmann's avatar David Fuhrmann

macosx: improve accessibility support for black ui

The commit adds additional attributes to the black windows in order to correctly
link to the close / zoom / maximize buttons. This is needed to get some
tools using this api to work, in particular / e.g. jitouch.
(cherry picked from commit 73b270549bb441dd2f273f93d492239b459f1513)
Signed-off-by: default avatarDavid Fuhrmann <david.fuhrmann@googlemail.com>
parent 931e469e
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
- (void)windowDidEnterFullScreen:(NSNotification *)notification; - (void)windowDidEnterFullScreen:(NSNotification *)notification;
- (void)windowWillExitFullScreen:(NSNotification *)notification; - (void)windowWillExitFullScreen:(NSNotification *)notification;
- (id)detachedTitlebarView;
@end @end
@interface VLCDetachedVideoWindow : NSWindow @interface VLCDetachedVideoWindow : NSWindow
......
...@@ -2548,6 +2548,59 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2548,6 +2548,59 @@ static VLCMainWindow *_o_sharedInstance = nil;
return nil; return nil;
} }
#pragma mark -
#pragma mark Accessibility stuff
- (NSArray *)accessibilityAttributeNames
{
if( !b_dark_interface )
return [super accessibilityAttributeNames];
static NSMutableArray *attributes = nil;
if ( attributes == nil ) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
NSArray *appendAttributes = [NSArray arrayWithObjects: NSAccessibilitySubroleAttribute,
NSAccessibilityCloseButtonAttribute,
NSAccessibilityMinimizeButtonAttribute,
NSAccessibilityZoomButtonAttribute,
nil];
for( NSString *attribute in appendAttributes )
{
if( ![attributes containsObject:attribute] )
[attributes addObject:attribute];
}
}
return attributes;
}
- (id)accessibilityAttributeValue: (NSString*)o_attribute_name
{
if( b_dark_interface )
{
VLCMainWindowTitleView *o_tbv = o_titlebar_view;
if( [o_attribute_name isEqualTo: NSAccessibilitySubroleAttribute] )
return NSAccessibilityStandardWindowSubrole;
if( [o_attribute_name isEqualTo: NSAccessibilityCloseButtonAttribute] )
return [[o_tbv closeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] )
return [[o_tbv minimizeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] )
return [[o_tbv zoomButton] cell];
}
return [super accessibilityAttributeValue: o_attribute_name];
}
- (id)detachedTitlebarView
{
return o_detached_titlebar_view;
}
@end @end
@implementation VLCDetachedVideoWindow @implementation VLCDetachedVideoWindow
...@@ -2758,4 +2811,49 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2758,4 +2811,49 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setFrame: maxRect display: YES animate: YES]; [self setFrame: maxRect display: YES animate: YES];
} }
- (NSArray *)accessibilityAttributeNames
{
if( !b_dark_interface )
return [super accessibilityAttributeNames];
static NSMutableArray *attributes = nil;
if ( attributes == nil ) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
NSArray *appendAttributes = [NSArray arrayWithObjects: NSAccessibilitySubroleAttribute,
NSAccessibilityCloseButtonAttribute,
NSAccessibilityMinimizeButtonAttribute,
NSAccessibilityZoomButtonAttribute,
nil];
for( NSString *attribute in appendAttributes )
{
if( ![attributes containsObject:attribute] )
[attributes addObject:attribute];
}
}
return attributes;
}
- (id)accessibilityAttributeValue: (NSString*)o_attribute_name
{
if( b_dark_interface )
{
VLCMainWindowTitleView *o_tbv = [[VLCMainWindow sharedInstance] detachedTitlebarView];
if( [o_attribute_name isEqualTo: NSAccessibilitySubroleAttribute] )
return NSAccessibilityStandardWindowSubrole;
if( [o_attribute_name isEqualTo: NSAccessibilityCloseButtonAttribute] )
return [[o_tbv closeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityMinimizeButtonAttribute] )
return [[o_tbv minimizeButton] cell];
if( [o_attribute_name isEqualTo: NSAccessibilityZoomButtonAttribute] )
return [[o_tbv zoomButton] cell];
}
return [super accessibilityAttributeValue: o_attribute_name];
}
@end @end
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
- (void)setWindowButtonOver:(BOOL)b_value; - (void)setWindowButtonOver:(BOOL)b_value;
- (void)setWindowFullscreenButtonOver:(BOOL)b_value; - (void)setWindowFullscreenButtonOver:(BOOL)b_value;
- (NSButton*)closeButton;
- (NSButton*)minimizeButton;
- (NSButton*)zoomButton;
@end @end
@interface VLCWindowButtonCell : NSButtonCell @interface VLCWindowButtonCell : NSButtonCell
......
...@@ -257,6 +257,22 @@ ...@@ -257,6 +257,22 @@
[super mouseDown: event]; [super mouseDown: event];
} }
- (NSButton*)closeButton
{
return o_red_btn;
}
- (NSButton*)minimizeButton
{
return o_yellow_btn;
}
- (NSButton*)zoomButton
{
return o_green_btn;
}
@end @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