comparison win/dw.c @ 1981:ccd34ec31971

Win: Temporary fix for toolbar display issues with partial dark mode. All controls are currently supported, except menubars and notebooks. The toolbar buttons have occasional display issues which still need improvement and this fix is a bit hacky and I'd prefer a better one. With menubars and notebooks unsupported, partial dark mode is prefered.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 13 Aug 2019 09:12:05 +0000
parents 38a455d2096c
children c35b68443905
comparison
equal deleted inserted replaced
1980:38a455d2096c 1981:ccd34ec31971
760 if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0 && 760 if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0 &&
761 (style & (BS_AUTOCHECKBOX | BS_CHECKBOX | BS_RADIOBUTTON))) 761 (style & (BS_AUTOCHECKBOX | BS_CHECKBOX | BS_RADIOBUTTON)))
762 return FALSE; 762 return FALSE;
763 #ifdef TOOLBAR 763 #ifdef TOOLBAR
764 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) 764 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
765 {
766 /* If we aren't in full dark mode */
767 if(_DW_DARK_MODE_ALLOWED != 2)
768 {
769 /* Enable or disable visual themes */
770 if(_SetWindowTheme)
771 _SetWindowTheme(window, (style & TBSTYLE_FLAT) ? L"" : NULL, (style & TBSTYLE_FLAT) ? L"" : NULL);
772 }
765 return FALSE; 773 return FALSE;
774 }
766 #endif 775 #endif
767 return TRUE; 776 return TRUE;
768 } 777 }
769 778
770 BOOL AllowDarkModeForWindow(HWND window, BOOL allow) 779 BOOL AllowDarkModeForWindow(HWND window, BOOL allow)
771 { 780 {
772 if(_DW_DARK_MODE_SUPPORTED) 781 if(_DW_DARK_MODE_SUPPORTED)
773 { 782 {
774 if(_DW_DARK_MODE_ALLOWED == 2) 783 if(_CanThemeWindow(window))
775 { 784 {
776 if(_CanThemeWindow(window)) 785 if(_DW_DARK_MODE_ALLOWED == 2)
777 { 786 {
778 if(_DW_DARK_MODE_ENABLED) 787 if(_DW_DARK_MODE_ENABLED)
779 _SetWindowTheme(window, L"DarkMode_Explorer", NULL); 788 _SetWindowTheme(window, L"DarkMode_Explorer", NULL);
780 else 789 else
781 _SetWindowTheme(window, L"Explorer", NULL); 790 _SetWindowTheme(window, L"Explorer", NULL);