[vlc-commits] macosx: add custom window close button

Felix Paul Kühne git at videolan.org
Sun Nov 3 19:32:42 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Nov  1 09:16:17 2019 +0100| [72e49c8ea3e55bcbfb40c3a36b598b0352760bde] | committer: Felix Paul Kühne

macosx: add custom window close button

This is based on legacy code of the 3.0 branch

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72e49c8ea3e55bcbfb40c3a36b598b0352760bde
---

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   6 +
 modules/gui/macosx/Makefile.am                     |  16 +-
 .../Button-Icons/window-close-graphite.png         | Bin 0 -> 228 bytes
 .../Button-Icons/window-close-graphite at 2x.png      | Bin 0 -> 381 bytes
 .../Button-Icons/window-close-on-graphite.png      | Bin 0 -> 278 bytes
 .../Button-Icons/window-close-on-graphite at 2x.png   | Bin 0 -> 441 bytes
 .../Resources/Button-Icons/window-close-on.png     | Bin 0 -> 286 bytes
 .../Resources/Button-Icons/window-close-on at 2x.png  | Bin 0 -> 477 bytes
 .../Button-Icons/window-close-over-graphite.png    | Bin 0 -> 253 bytes
 .../Button-Icons/window-close-over-graphite at 2x.png | Bin 0 -> 437 bytes
 .../Resources/Button-Icons/window-close-over.png   | Bin 0 -> 293 bytes
 .../Button-Icons/window-close-over at 2x.png          | Bin 0 -> 449 bytes
 .../macosx/Resources/Button-Icons/window-close.png | Bin 0 -> 248 bytes
 .../Resources/Button-Icons/window-close at 2x.png     | Bin 0 -> 379 bytes
 modules/gui/macosx/views/VLCCustomWindowButton.h   |  56 +++++
 modules/gui/macosx/views/VLCCustomWindowButton.m   | 262 +++++++++++++++++++++
 po/POTFILES.in                                     |   2 +
 17 files changed, 341 insertions(+), 1 deletion(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 84bb08d28e..c6a4fde941 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -120,6 +120,7 @@
 		7D445D8B22032B9200263D34 /* VLCPlaylistTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D8A22032B9200263D34 /* VLCPlaylistTableView.m */; };
 		7D445D8E2203375100263D34 /* VLCPlaylistMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D8D2203375100263D34 /* VLCPlaylistMenuController.m */; };
 		7D460B0C229EB4C700097948 /* VLCDragDropView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D460B0B229EB4C700097948 /* VLCDragDropView.m */; };
+		7D61DCE4236C1937008133CF /* VLCCustomWindowButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D61DCE3236C1937008133CF /* VLCCustomWindowButton.m */; };
 		7D66D4362200BC340040D04A /* VLCClickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4352200BC340040D04A /* VLCClickerManager.m */; };
 		7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4382200C5B80040D04A /* VLCVideoFilterHelper.m */; };
 		7D66D43C2200D6090040D04A /* VLCDetachedVideoWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D43B2200D6090040D04A /* VLCDetachedVideoWindow.m */; };
@@ -497,6 +498,8 @@
 		7D5678EC1D5BA1DC002698F3 /* VLCApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCApplication.m; sourceTree = "<group>"; };
 		7D5678EE1D5BA397002698F3 /* VLCMainWindowControlsBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCMainWindowControlsBar.h; sourceTree = "<group>"; };
 		7D5678EF1D5BA397002698F3 /* VLCMainWindowControlsBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMainWindowControlsBar.m; sourceTree = "<group>"; };
+		7D61DCE2236C1937008133CF /* VLCCustomWindowButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCCustomWindowButton.h; sourceTree = "<group>"; };
+		7D61DCE3236C1937008133CF /* VLCCustomWindowButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCCustomWindowButton.m; sourceTree = "<group>"; };
 		7D66D4342200BC340040D04A /* VLCClickerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCClickerManager.h; sourceTree = "<group>"; };
 		7D66D4352200BC340040D04A /* VLCClickerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCClickerManager.m; sourceTree = "<group>"; };
 		7D66D4372200C5B80040D04A /* VLCVideoFilterHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCVideoFilterHelper.h; sourceTree = "<group>"; };
@@ -825,6 +828,8 @@
 		1C1ED5062204AB7C00811EC0 /* views */ = {
 			isa = PBXGroup;
 			children = (
+				7D61DCE2236C1937008133CF /* VLCCustomWindowButton.h */,
+				7D61DCE3236C1937008133CF /* VLCCustomWindowButton.m */,
 				6B0292E41F43256300A50082 /* VLCBottomBarView.h */,
 				6B0292E51F43256300A50082 /* VLCBottomBarView.m */,
 				6B6A499A1DFD9B23009128AC /* VLCDefaultValueSlider.h */,
@@ -1658,6 +1663,7 @@
 				7D2554C522C8E8B500F2D9C2 /* VLCMediaSourceDeviceCollectionViewItem.m in Sources */,
 				1CCC88F52078A3D500E5626F /* SyncTracks.xib in Sources */,
 				1CCC88F62078A3D500E5626F /* VLCInformationWindow.xib in Sources */,
+				7D61DCE4236C1937008133CF /* VLCCustomWindowButton.m in Sources */,
 				7DFFF90123682D4800C8B0C9 /* VLCDetachedAudioWindow.m in Sources */,
 				7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */,
 				7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index f4a2692001..ba42cc8800 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -173,6 +173,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/preferences/prefs_widgets.m \
 	gui/macosx/views/VLCBottomBarView.h \
 	gui/macosx/views/VLCBottomBarView.m \
+	gui/macosx/views/VLCCustomWindowButton.h \
+	gui/macosx/views/VLCCustomWindowButton.m \
 	gui/macosx/views/VLCDefaultValueSlider.h \
 	gui/macosx/views/VLCDefaultValueSlider.m \
 	gui/macosx/views/VLCDefaultValueSliderCell.h \
@@ -456,7 +458,19 @@ libmacosx_plugin_la_RES = \
 	gui/macosx/Resources/Button-Icons/VLCVolumeOnTemplate.pdf \
 	gui/macosx/Resources/Button-Icons/VLCVolumeOffTemplate.pdf \
 	gui/macosx/Resources/Button-Icons/VLCClearLogTemplate.pdf \
-	gui/macosx/Resources/Button-Icons/VLCSaveTemplate.pdf
+	gui/macosx/Resources/Button-Icons/VLCSaveTemplate.pdf \
+	gui/macosx/Resources/Button-Icons/window-close-graphite.png \
+	gui/macosx/Resources/Button-Icons/window-close-graphite at 2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-on-graphite.png \
+	gui/macosx/Resources/Button-Icons/window-close-on-graphite at 2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-on.png \
+	gui/macosx/Resources/Button-Icons/window-close-on at 2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-over-graphite.png \
+	gui/macosx/Resources/Button-Icons/window-close-over-graphite at 2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-over.png \
+	gui/macosx/Resources/Button-Icons/window-close-over at 2x.png \
+	gui/macosx/Resources/Button-Icons/window-close.png \
+	gui/macosx/Resources/Button-Icons/window-close at 2x.png
 
 libmacosx_plugin_la_RES += \
 	gui/macosx/Resources/dsa_pub.pem \
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-graphite.png b/modules/gui/macosx/Resources/Button-Icons/window-close-graphite.png
new file mode 100644
index 0000000000..af957723d7
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-graphite.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-graphite at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-graphite at 2x.png
new file mode 100644
index 0000000000..1528672a46
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-graphite at 2x.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite.png
new file mode 100644
index 0000000000..4e249d30dc
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite at 2x.png
new file mode 100644
index 0000000000..bd21e24eff
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite at 2x.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on.png
new file mode 100644
index 0000000000..ffdd45feea
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-on.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on at 2x.png
new file mode 100644
index 0000000000..f990e2bccc
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-on at 2x.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite.png
new file mode 100644
index 0000000000..4cfe9b9908
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite at 2x.png
new file mode 100644
index 0000000000..d29b2144a0
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite at 2x.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over.png
new file mode 100644
index 0000000000..7310bee4cf
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-over.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over at 2x.png
new file mode 100644
index 0000000000..2be47eae52
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close-over at 2x.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close.png b/modules/gui/macosx/Resources/Button-Icons/window-close.png
new file mode 100644
index 0000000000..9c29567c51
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close.png differ
diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close at 2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close at 2x.png
new file mode 100644
index 0000000000..f32df18a6c
Binary files /dev/null and b/modules/gui/macosx/Resources/Button-Icons/window-close at 2x.png differ
diff --git a/modules/gui/macosx/views/VLCCustomWindowButton.h b/modules/gui/macosx/views/VLCCustomWindowButton.h
new file mode 100644
index 0000000000..4170008af4
--- /dev/null
+++ b/modules/gui/macosx/views/VLCCustomWindowButton.h
@@ -0,0 +1,56 @@
+/*****************************************************************************
+* VLCCustomWindowButton.h: MacOS X interface module
+*****************************************************************************
+* Copyright (C) 2011-2019 VLC authors and VideoLAN
+*
+* Authors: Felix Paul Kühne <fkuehne # videolan -dot- org>
+*          David Fuhrmann <dfuhrmann at videolan dot org>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+*****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCWindowButtonCell : NSButtonCell
+
+ at end
+
+ at interface VLCCustomWindowButtonPrototype : NSButton
+
+- (void)performDefaultButtonAction:(id)sender;
+
+ at end
+
+ at interface VLCCustomWindowCloseButton : VLCCustomWindowButtonPrototype
+
+ at end
+
+
+ at interface VLCCustomWindowMinimizeButton : VLCCustomWindowButtonPrototype
+
+ at end
+
+
+ at interface VLCCustomWindowZoomButton : VLCCustomWindowButtonPrototype
+
+ at end
+
+ at interface VLCCustomWindowFullscreenButton : VLCCustomWindowButtonPrototype
+
+ at end
+
+NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/views/VLCCustomWindowButton.m b/modules/gui/macosx/views/VLCCustomWindowButton.m
new file mode 100644
index 0000000000..260a70f749
--- /dev/null
+++ b/modules/gui/macosx/views/VLCCustomWindowButton.m
@@ -0,0 +1,262 @@
+/*****************************************************************************
+* VLCCustomWindowButton.m: MacOS X interface module
+*****************************************************************************
+* Copyright (C) 2011-2019 VLC authors and VideoLAN
+*
+* Authors: Felix Paul Kühne <fkuehne # videolan -dot- org>
+*          David Fuhrmann <dfuhrmann at videolan dot org>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+*****************************************************************************/
+
+#import "VLCCustomWindowButton.h"
+
+ at interface VLCCustomWindowButtonPrototype()
+
+ at property (readwrite, retain) NSImage *buttonImage;
+ at property (readwrite, retain) NSImage *hoverButtonImage;
+ at property (readwrite, retain) NSImage *onClickButtonImage;
+
+- (void)loadButtonIcons;
+- (NSArray *)extendedAccessibilityAttributeNames:(NSArray *)theAttributeNames;
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName;
+- (NSNumber *)extendedAccessibilityIsAttributeSettable:(NSString *)theAttributeName;
+
+ at end
+
+ at implementation VLCWindowButtonCell
+
+- (NSArray *)accessibilityAttributeNames
+{
+    NSArray *theAttributeNames = [super accessibilityAttributeNames];
+    id theControlView = [self controlView];
+    return ([theControlView respondsToSelector: @selector(extendedAccessibilityAttributeNames:)] ? [theControlView extendedAccessibilityAttributeNames: theAttributeNames] : theAttributeNames); // ask the cell's control view (i.e., the button) for additional attribute values
+}
+
+- (id)accessibilityAttributeValue:(NSString *)theAttributeName
+{
+    id theControlView = [self controlView];
+    if ([theControlView respondsToSelector: @selector(extendedAccessibilityAttributeValue:)]) {
+        id theValue = [theControlView extendedAccessibilityAttributeValue: theAttributeName];
+        if (theValue) {
+            return theValue; // if this is an extended attribute value we added, return that -- otherwise, fall back to super's implementation
+        }
+    }
+    return [super accessibilityAttributeValue: theAttributeName];
+}
+
+- (BOOL)accessibilityIsAttributeSettable:(NSString *)theAttributeName
+{
+    id theControlView = [self controlView];
+    if ([theControlView respondsToSelector: @selector(extendedAccessibilityIsAttributeSettable:)]) {
+        NSNumber *theValue = [theControlView extendedAccessibilityIsAttributeSettable: theAttributeName];
+        if (theValue)
+            return [theValue boolValue]; // same basic strategy we use in -accessibilityAttributeValue:
+    }
+    return [super accessibilityIsAttributeSettable: theAttributeName];
+}
+
+ at end
+
+ at implementation VLCCustomWindowButtonPrototype
+
++ (Class)cellClass
+{
+    return [VLCWindowButtonCell class];
+}
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+    self = [super initWithCoder:coder];
+    if (self) {
+        [self commonInitializer];
+    }
+    return self;
+}
+
+- (instancetype)initWithFrame:(NSRect)frameRect
+{
+    self = [super initWithFrame:frameRect];
+    if (self) {
+        [self commonInitializer];
+    }
+    return self;
+}
+
+- (void)commonInitializer
+{
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(controlTintChanged:)
+                                                 name:NSControlTintDidChangeNotification
+                                               object:nil];
+    [self loadButtonIcons];
+    [self setTarget:self];
+    [self setAction:@selector(performDefaultButtonAction:)];
+}
+
+- (NSImage *)getButtonImage:(NSString *)imageName
+{
+    if ([NSColor currentControlTint] != NSBlueControlTint) {
+        imageName = [imageName stringByAppendingString:@"-graphite"];
+    }
+
+    return [NSImage imageNamed:imageName];
+}
+
+- (void)controlTintChanged:(NSNotification *)notification
+{
+    [self loadButtonIcons];
+    [self setNeedsDisplay];
+}
+
+- (void)loadButtonIcons
+{
+    [self setImage:self.buttonImage];
+    [self setAlternateImage:self.hoverButtonImage];
+}
+
+- (void)mouseEntered:(NSEvent *)event
+{
+    [self setImage:self.hoverButtonImage];
+    [super mouseEntered:event];
+}
+
+- (void)mouseExited:(NSEvent *)event
+{
+    [self setImage:self.buttonImage];
+    [super mouseExited:event];
+}
+
+- (void)performDefaultButtonAction:(id)sender
+{
+}
+
+- (NSArray *)extendedAccessibilityAttributeNames:(NSArray *)theAttributeNames {
+    return ([theAttributeNames containsObject: NSAccessibilitySubroleAttribute] ? theAttributeNames : [theAttributeNames arrayByAddingObject: NSAccessibilitySubroleAttribute]); // run-of-the-mill button cells don't usually have a Subrole attribute, so we add that attribute
+}
+
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName {
+    return nil;
+}
+
+- (NSNumber *)extendedAccessibilityIsAttributeSettable:(NSString *)theAttributeName {
+    return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? [NSNumber numberWithBool:NO] : nil); // make the Subrole attribute we added non-settable
+}
+
+- (void)accessibilityPerformAction:(NSString *)theActionName {
+    if ([theActionName isEqualToString: NSAccessibilityPressAction]) {
+        if ([self isEnabled])
+            [self performClick: nil];
+    } else
+        [super accessibilityPerformAction: theActionName];
+}
+
+ at end
+
+ at implementation VLCCustomWindowCloseButton
+
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName
+{
+    return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? NSAccessibilityCloseButtonAttribute : nil);
+}
+
+- (void)loadButtonIcons
+{
+    self.buttonImage = [self getButtonImage:@"window-close"];
+    self.hoverButtonImage = [self getButtonImage:@"window-close-over"];
+    self.onClickButtonImage = [self getButtonImage:@"window-close-on"];
+
+    [super loadButtonIcons];
+}
+
+- (void)performDefaultButtonAction:(id)sender
+{
+    if (self.window.styleMask & NSWindowStyleMaskClosable) {
+        [[self window] performClose:sender];
+    } else {
+        [[self window] close];
+    }
+}
+
+ at end
+
+ at implementation VLCCustomWindowMinimizeButton
+
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName
+{
+    return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? NSAccessibilityMinimizeButtonAttribute : nil);
+}
+
+- (void)loadButtonIcons
+{
+    self.buttonImage = [self getButtonImage:@"window-minimize"];
+    self.hoverButtonImage = [self getButtonImage:@"window-minimize-over"];
+    self.onClickButtonImage = [self getButtonImage:@"window-minimize-on"];
+
+    [super loadButtonIcons];
+}
+
+- (void)performDefaultButtonAction:(id)sender
+{
+    [[self window] miniaturize: sender];
+}
+
+ at end
+
+ at implementation VLCCustomWindowZoomButton
+
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName
+{
+    return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? NSAccessibilityZoomButtonAttribute : nil);
+}
+
+- (void)loadButtonIcons
+{
+    self.buttonImage = [self getButtonImage:@"window-zoom"];
+    self.hoverButtonImage = [self getButtonImage:@"window-zoom-over"];
+    self.onClickButtonImage = [self getButtonImage:@"window-zoom-on"];
+
+    [super loadButtonIcons];
+}
+
+- (void)performDefaultButtonAction:(id)sender
+{
+    [[self window] performZoom: sender];
+}
+
+ at end
+
+ at implementation VLCCustomWindowFullscreenButton
+
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName
+{
+    return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? NSAccessibilityFullScreenButtonAttribute : nil);
+}
+
+- (void)loadButtonIcons
+{
+    self.buttonImage = [self getButtonImage:@"window-fullscreen"];
+    self.hoverButtonImage = [self getButtonImage:@"window-fullscreen-over"];
+    self.onClickButtonImage = [self getButtonImage:@"window-fullscreen-on"];
+
+    [super loadButtonIcons];
+}
+
+- (void)performDefaultButtonAction:(id)sender
+{
+    [[self window] toggleFullScreen:self];
+}
+
+ at end
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 156bfd4837..d2771b57ec 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -578,6 +578,8 @@ modules/gui/macosx/preferences/prefs_widgets.h
 modules/gui/macosx/preferences/prefs_widgets.m
 modules/gui/macosx/views/VLCBottomBarView.h
 modules/gui/macosx/views/VLCBottomBarView.m
+modules/gui/macosx/views/VLCCustomWindowButton.h
+modules/gui/macosx/views/VLCCustomWindowButton.m
 modules/gui/macosx/views/VLCDefaultValueSlider.h
 modules/gui/macosx/views/VLCDefaultValueSlider.m
 modules/gui/macosx/views/VLCDefaultValueSliderCell.h



More information about the vlc-commits mailing list