From 72e49c8ea3e55bcbfb40c3a36b598b0352760bde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net>
Date: Fri, 1 Nov 2019 09:16:17 +0100
Subject: [PATCH] macosx: add custom window close button

This is based on legacy code of the 3.0 branch
---
 .../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@2x.png | Bin 0 -> 381 bytes
 .../Button-Icons/window-close-on-graphite.png | Bin 0 -> 278 bytes
 .../window-close-on-graphite@2x.png           | Bin 0 -> 441 bytes
 .../Button-Icons/window-close-on.png          | Bin 0 -> 286 bytes
 .../Button-Icons/window-close-on@2x.png       | Bin 0 -> 477 bytes
 .../window-close-over-graphite.png            | Bin 0 -> 253 bytes
 .../window-close-over-graphite@2x.png         | Bin 0 -> 437 bytes
 .../Button-Icons/window-close-over.png        | Bin 0 -> 293 bytes
 .../Button-Icons/window-close-over@2x.png     | Bin 0 -> 449 bytes
 .../Resources/Button-Icons/window-close.png   | Bin 0 -> 248 bytes
 .../Button-Icons/window-close@2x.png          | Bin 0 -> 379 bytes
 .../gui/macosx/views/VLCCustomWindowButton.h  |  56 ++++
 .../gui/macosx/views/VLCCustomWindowButton.m  | 262 ++++++++++++++++++
 po/POTFILES.in                                |   2 +
 17 files changed, 341 insertions(+), 1 deletion(-)
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-graphite.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-graphite@2x.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite@2x.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-on.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-on@2x.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite@2x.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-over.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close-over@2x.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close.png
 create mode 100644 modules/gui/macosx/Resources/Button-Icons/window-close@2x.png
 create mode 100644 modules/gui/macosx/views/VLCCustomWindowButton.h
 create mode 100644 modules/gui/macosx/views/VLCCustomWindowButton.m

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 84bb08d28ea6..c6a4fde941a3 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 f4a269200162..ba42cc88006b 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@2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-on-graphite.png \
+	gui/macosx/Resources/Button-Icons/window-close-on-graphite@2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-on.png \
+	gui/macosx/Resources/Button-Icons/window-close-on@2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-over-graphite.png \
+	gui/macosx/Resources/Button-Icons/window-close-over-graphite@2x.png \
+	gui/macosx/Resources/Button-Icons/window-close-over.png \
+	gui/macosx/Resources/Button-Icons/window-close-over@2x.png \
+	gui/macosx/Resources/Button-Icons/window-close.png \
+	gui/macosx/Resources/Button-Icons/window-close@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 0000000000000000000000000000000000000000..af957723d7421de0e6c94527eaa043a3a5930025
GIT binary patch
literal 228
zcmeAS@N?(olHy`uVBq!ia0vp^d_XL~!3HGNrubO_snwn?jv*C{M<*R+WHJ<S*{R?f
zp!DwDyMU0Q_Mjc^a_`RlQkyyRy<GYFsI||$)iys&F;W-md^2mhX?lXW>%#)IjLy?Z
z8<*|AJ5jFp*`C=z(Smh0j90R9ZRPay_9a9Y-l!K4;tEr=soFlzc%pEkpTH$y#l**<
zaxEf_HS;(h9{AfCuuu4v`_azhn=kU;niw6K_aKXb;T<o7#GGnnaRrf2H~R0C&F##!
b-B~I5y3Xc;k)fL%(Af;0u6{1-oD!M<6V6xJ

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-graphite@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-graphite@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..1528672a46bdda844a19a3e89eaf16fd4a9fbd94
GIT binary patch
literal 381
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@Pcsi**-5LX~wP*71+R8~|}UR+!b
zCX0)TfFdAvetvmjAw;mEwzjFYwX3VEzo%y+M7E};vA1_pb#()f+tk$F*w_Y93^8qb
zkV7KSbh(lszhDN1@|}-=$S?c*UoPtNe-J482P8`V|F8I2`Q(;@!(yPyEuJopAr*{A
zC%NuoRuo`6K0!YB*w=r@YlQrNao=8<>sVc=l^Sa9WKtSxq&oE&@7goFH}l!Kcy%Uy
zDEM}Dt8A52-i405s-M>r<>DeP*#46$FV??ya(2jzc7C@N(fqeAFIQQ=UN)42Svg_v
z38{&vJANri3ruf$ro<{Vo%6P9UVMsK&b9?H+SPR&+duZk9}o9vZ{`1&n#vu0vw7v=
yA3Jl()D9mw*CIRP$?~1ok8hLx8Yh<ii96z-!h+53WpaV;XYh3Ob6Mw<&;$S)Jf`me

literal 0
HcmV?d00001

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 0000000000000000000000000000000000000000..4e249d30dca285be9fed2bb587265373f1db3b86
GIT binary patch
literal 278
zcmV+x0qOpUP)<h;3K|Lk000e1NJLTq000gE000mO1^@s6CX`M(0002pNkl<ZcmZM<
zSP&W-%I51E5E&2<vNj|n{57Chvbb(2hJxraX(2H)_hDvc=Gt6=-P(t{c=`)7>m1?C
z=pmCcZ(t`y`F!)=B<(w$zCN8U^u=Ps<gD`s2It5Uz+f=em&@(R2?i&XO8qDyuJ9`a
zk0)SGKj))6oLsKlRzl*yB|u0HhewY@5=_oY2&Yu4?v#)u5RX_90h6=k@<xaIyb$x2
ztAX2GJx-2ah(~ugg#yXBs~i*4TJ10#4u6jt06-dmc$m@vVA23bgWqt4IHct`=kukG
cSo+>D07qEs^ydDSY5)KL07*qoM6N<$f`YenF8}}l

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on-graphite@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..bd21e24eff5df0a13736cab41966030e85952331
GIT binary patch
literal 441
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@Pcsk8u}5LY1W?;qjg6X@?B6ciK|
z5)vL16z%UH7!nczL_i@wzaXGsXlP_iOhQspT3T9GMn;aWZ%}AxM09jKP-Q|wN_>2B
zOia9!ldG((qQ1VdoSdScU!cCek)EDWa4^uo&@``u+CZC>N`m}?8DtaZUH&Z7_2<8g
z_v`;45c~Ik9GLO{f71W|U$0!=Rd@iX`hlm5V@L(#(MhglEQUNT#%Hf)m>S>tKdDeh
z)nD?KUoOvmg%#`jUp@QjD8aU`yxJjfj>D8AFYBj0)i`xZVCE{F3F))0@<ur;U0(F^
z%3d~GP2P-u@0RUM^ZD$N&@(Y(*7MF6<vD`he4dFNY1*e#Ok591R%)acD@MK9a4WU*
ztfRcBy?Rvry!8*PB^oy0m?=AlpNZXBpnIWCfmOx6re8N(A1<0#%aaktxH5#Vvn%+b
z>w`ZjPm~INM*Y@#uD*E6d9721do*me=TuxYTK#U}&G$K<jwM`NY-;}B>ip^Z7VZ8o
ZrJc_y@UQxRWdhKz44$rjF6*2Ung9~uxZD5$

literal 0
HcmV?d00001

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 0000000000000000000000000000000000000000..ffdd45feeafd28fa803a5bc98ee8ae990fbec877
GIT binary patch
literal 286
zcmeAS@N?(olHy`uVBq!ia0vp^d_XL~!3-n?z4mbcDenNE5LY0*N?Uujq4qo@ouwvv
za}5pW8|lt7)t_W)&}(Wq)6}5H)NqoDN(3uQ1PjYd1MLt7hIn3{a26Jz`gk7h8Kwq6
z_46GRW*KNbxZ!dMXq;q8kY6wZTjbi;QhWY`0Q>*{Q9x?l|NnbAqED{gz6Yo%)6>N<
zq=K=vubGj>P{1|$Z|}|e#p$0}lPByCIM({0XP)lLEgP?8sQMc|EjYCDZGsW6d_j$s
zoKK!W(7BZdt~6`vTnNf)5PhF!`eEf(k%U(}Lp3byWaZhv8v1AVe3o*aBy1d}_-fV@
a`RWQ**1a-Lx7vV~GI+ZBxvX<aXaWGg9A=9E

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-on@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-on@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..f990e2bccc032a29e445405e7be6306997027007
GIT binary patch
literal 477
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@PcsiFX%5LY0*+*D_VzSdkLokhmF
z%S`l^nCs0p(phGzzuZ)Rwz=L+1D&NNdO+?RQ~fEX2K}Z6J*I}U40V7i=bGyGn;OnG
z)Shl?FvHZKKvpV*kuijUq0iJXS&%<jP#~0%ahASTvH(BO1fZ6sruvIa^cw9vJ%F~V
zl?3?(Gsq^+yZl+E>(74~@7Mo9AolP7|8Zazh)DYXHR=DA2?jphKpkH^T^vIy7>`c6
zdgzb=kDKJ>Gxjrf@B6R(Z<3kCoua&L->xXNuTPTkJ-to$bB2xP@vk0_cmCVU?bP*1
zh4qq3p9W9f-IqR*e7^H8?%Z*+ywB@Sfa`OIIr5V%Hi}q9?V7?^dihF2jd4*aPuvt{
z-`i#lHM>s)3(9JSP0r=#sh=<C;3MokS;%hP)t>*y)l)WY(Ku?qx5$`3Xj8;3mexrD
z7Y-HuRC#*C@#Mc}H=eVbep>K5Anog_Hs?rHPTA9f6Y{rL9*g~DVfXjx7ehaftGkaB
zpIr5P66evGoBTqKAFa!pEOTOV#bdL|+X?52v)4V_r?Y#fRD1p>?pywfT8_#4mjV6H
N;OXk;vd$@?2>=F%%C-Oi

literal 0
HcmV?d00001

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 0000000000000000000000000000000000000000..4cfe9b990817874df3339219e91c0824fe2f88a4
GIT binary patch
literal 253
zcmV<Z00RGsP)<h;3K|Lk000e1NJLTq000gE000mO1^@s6CX`M(0002QNkl<Zcmc(d
zF%E)25Jjz&L)g>M*wJ{TRbdk#p_#_eK%s|{UXS7dR-R<GStukXZ1R)u{{NksWj5;`
z5!qT>8f&XZo|kU`=MHT$WK6LijL*6j*EFqb+Z*_D?$GcAl@LU(uIuiTKpVqm=YzDu
zzhX#|1Aqs=$I8XY2bqJG)ELK!OVcBOYmm07+WR1nz&u(-0|2h~c<}xu*#FY%qQ}Xy
z^1R@4RIkAs1q*;Mw*Y8(=2kAE73R>D8+mcjO6#2uQcoSEtYBA000000NkvXXu0mjf
D`cZEM

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over-graphite@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..d29b2144a0bb520a5a375c9939b50c58d5fa1949
GIT binary patch
literal 437
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@PcsmuVM5LX~wP*71+R8~|}UR+!b
zCX0)TfFdAvetvmjAw;mEwzjFYwX3VEzo%y+M7E};vA1_pb#()f+tk$F*w_{s8K<G4
ztFEqNZ|~yZ;0n<TF+5B_;|9<&<&q%3U<QTqosWOWFZ=snF6#4t5GeWwBuc={|Nkp~
zRz7)gy!#JO`3+AO$B+ufqmx1xwHolS7Fz6By5n7azyGDUqjr*W8n+3)4J$dkCFiyg
zZ|!24>&=IX|N4u!bUacyyUC<ex#i&Q)7(=uHG>)#RsCM?;G1uvG4KDcg(dIJN~V+q
z3T=(OE@ZooX<gUB?x02M-dis^ZrW=jIk7Qf-y8Nt8`C`v)uyQl$*l|j@PX53nplcR
zb4ha#yO_7Mq+yWI<is>f`IFxhkH6h;ocmUrk&ScYy2%T63benxJV)Sc;G>->XP2e;
zuVQ+%;>LM1#amlWE;~3UH(T$S)%n#sU)-AehpGIua_4W!uTz13WbkzLb6Mw<&;$S<
Cbj7p)

literal 0
HcmV?d00001

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 0000000000000000000000000000000000000000..7310bee4cffa41ad6555981c72c2482d029f5150
GIT binary patch
literal 293
zcmeAS@N?(olHy`uVBq!ia0vp^d_XL~!3-n?z4mbcDZc=p5LY05HB|edoBcy~5PIV2
z@X*8lmB0Is=-__|5wHE-KZN-FPmH|n>DkWC3Y2PKVwft#-^R}J$jyGLAm2lGyN{v1
zK#lhu9PYb2+<p1+5zs`bk|4ie2DaQ|pJgun2Lty1c|iL3|NQ@#ISNuYe7XQsmE-B+
z7*fI5+Q%$*)Ih*Bd7sg}|4!X6A3o<jmQerDNlTTrUMF|W=X<P+HPe(jGM1ed5&PWp
z`{q-lrHA+A-QIP0>FE%;6R&46uD^G-ME&`mbN-t+W|ZI27m*5aymBqGS1hA<ndC+9
fAg$hW{|cF=FJKdT+a$;cw3ort)z4*}Q$iB}5V(6n

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close-over@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close-over@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..2be47eae525f58f1af0a305eb3d49ee0ac61e6a7
GIT binary patch
literal 449
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@Pcsr&$+5LY05-^1adyWK+%`-koz
zbkED_5tspF-*vHh0F-jKf8^otHqi51WZ<8;uzv{=55S7w1bF;UjC|nc@F~piW2o;w
z1D!@@#s(&ad6J^@CB^Q$In0v~ohu;<)PCQ?{%w#K(2AJC`{qC^RZD{Wf*BObcRv0h
zzwGaSxv0<oL7?d0|NkXm*8l$%|NsB2{QtyA{Co^h!yQi-$B+ufqmx1xwHSyvv#VR=
z7Eb@0|IyPpZ$HcPE!X|qPZ{XmF3dS?5;x)XPm9yvo7~0RIwqT({;cDh<nqu~SV&9z
z+$oWi%I*G(lon*2czsVnY4`Gp)opSifhM`PMUFmQ`Cy`C-5gQZ+of;qpBQ)7rllx7
zJikuAYvJQXEQ{O3f^yecd(ZYy%*<$x^hq)P+_-jO^PUSzPpbP|4?mS&5_#;<ii~g7
z4*e_7^mMIUbHDq;+L|fS3;zXFY+F-z-DuUHOF4Zfr=``a+_g}XXFpRbd-m$B>8abp
d9+xbsW4x-a>>HM)`X1;{22WQ%mvv4FO#tCo&5Hm4

literal 0
HcmV?d00001

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 0000000000000000000000000000000000000000..9c29567c51185a97924381d61b5502055e6cee22
GIT binary patch
literal 248
zcmeAS@N?(olHy`uVBq!ia0vp^d_XL~!3-n?z4mbcDf<AQ5LY05HB|eyr{{eKhbNv6
z58dn^de}d7x4ZA|@X+1<5tIuQv47?7{@UODLx|7EP~RWX!T%B>{wGFGHERXg!B-OG
z7tFxM&LNYVmtSz~_@&FAv&@tVfih8^E{-7_vaAOid6^7(SPax{kNmsc<gxDtP|jiD
zq!}~4Cw}+bX?<VtYaQ#=r<GBD4RbO$9TqKRc$LAh;4SNp)qlkj!e>V&l*{DZe{`-U
j?BNrc-+#n_nji32_p3;o{@!yP$YJnw^>bP0l+XkK+uB=+

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/Resources/Button-Icons/window-close@2x.png b/modules/gui/macosx/Resources/Button-Icons/window-close@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..f32df18a6c3eca03df8ec97a9a090aa3a3d4aebb
GIT binary patch
literal 379
zcmeAS@N?(olHy`uVBq!ia0vp^GC-`r!3-qLvR@Pcsi**-5LY05-^1adyWK+%`-koz
zbkED_5tspF-*vHh0F-jKf8^otHqi51WZ<8;uzv{=55S7w1bF;UjC|nc@F~piW2o<a
zH=sH8_dV?226+KZt1%Ty2bwNd666=mpisW^@elcBfB(xxef|#uMgRW)FZut!;%DXm
zCoSv$Z3C*@<muuVQo(rilIx;210I$HnPsycRsB!4JE*u{XXe{*-$%Am_8f~X`VJjP
zpRz>qTFS~DvqCN$n^c_A+cqivH20K{wF`w@Yj1@wSm~D;_@=sb*4sr|k%q33cY~B-
z|4+!=rTp^De8Yy75j?vjog@0h9`*=!C@an~Y<v9T!ucEZhxm`zRa|Ia&vU=~!^WDp
zMHfCDnjdv-)3moMBR9WKHj4TsY<=(86T1XX`Ll|1e${cY->){>Z|kKnCsdVrD$w-|
Mp00i_>zopr084hP0ssI2

literal 0
HcmV?d00001

diff --git a/modules/gui/macosx/views/VLCCustomWindowButton.h b/modules/gui/macosx/views/VLCCustomWindowButton.h
new file mode 100644
index 000000000000..4170008af490
--- /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
+
+@interface VLCWindowButtonCell : NSButtonCell
+
+@end
+
+@interface VLCCustomWindowButtonPrototype : NSButton
+
+- (void)performDefaultButtonAction:(id)sender;
+
+@end
+
+@interface VLCCustomWindowCloseButton : VLCCustomWindowButtonPrototype
+
+@end
+
+
+@interface VLCCustomWindowMinimizeButton : VLCCustomWindowButtonPrototype
+
+@end
+
+
+@interface VLCCustomWindowZoomButton : VLCCustomWindowButtonPrototype
+
+@end
+
+@interface VLCCustomWindowFullscreenButton : VLCCustomWindowButtonPrototype
+
+@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 000000000000..260a70f74959
--- /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"
+
+@interface VLCCustomWindowButtonPrototype()
+
+@property (readwrite, retain) NSImage *buttonImage;
+@property (readwrite, retain) NSImage *hoverButtonImage;
+@property (readwrite, retain) NSImage *onClickButtonImage;
+
+- (void)loadButtonIcons;
+- (NSArray *)extendedAccessibilityAttributeNames:(NSArray *)theAttributeNames;
+- (id)extendedAccessibilityAttributeValue:(NSString *)theAttributeName;
+- (NSNumber *)extendedAccessibilityIsAttributeSettable:(NSString *)theAttributeName;
+
+@end
+
+@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];
+}
+
+@end
+
+@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];
+}
+
+@end
+
+@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];
+    }
+}
+
+@end
+
+@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];
+}
+
+@end
+
+@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];
+}
+
+@end
+
+@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];
+}
+
+@end
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 156bfd4837fa..d2771b57ec99 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
-- 
GitLab