Commit 73b27054 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.
parent 7ed15b71
......@@ -206,6 +206,7 @@
- (void)windowDidEnterFullScreen:(NSNotification *)notification;
- (void)windowWillExitFullScreen:(NSNotification *)notification;
- (id)detachedTitlebarView;
@end
@interface VLCDetachedVideoWindow : NSWindow
......
......@@ -2750,6 +2750,59 @@ static VLCMainWindow *_o_sharedInstance = 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
@implementation VLCDetachedVideoWindow
......@@ -2960,4 +3013,49 @@ static VLCMainWindow *_o_sharedInstance = nil;
[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
......@@ -56,6 +56,10 @@
- (void)setWindowButtonOver:(BOOL)b_value;
- (void)setWindowFullscreenButtonOver:(BOOL)b_value;
- (NSButton*)closeButton;
- (NSButton*)minimizeButton;
- (NSButton*)zoomButton;
@end
@interface VLCWindowButtonCell : NSButtonCell
......
......@@ -257,6 +257,22 @@
[super mouseDown: event];
}
- (NSButton*)closeButton
{
return o_red_btn;
}
- (NSButton*)minimizeButton
{
return o_yellow_btn;
}
- (NSButton*)zoomButton
{
return o_green_btn;
}
@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