comparison win/dw.c @ 1964:cdd0561de878

Win: Initial code to handle the new dark mode in Windows 10 build 1809.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 27 Jul 2019 20:50:48 +0000
parents 22e3e829be13
children d510e9bb61c2
comparison
equal deleted inserted replaced
1963:80f6be39b7fe 1964:cdd0561de878
1 /* 1 /*
2 * Dynamic Windows: 2 * Dynamic Windows:
3 * A GTK like implementation of the Win32 GUI 3 * A GTK like implementation of the Win32 GUI
4 * 4 *
5 * (C) 2000-2017 Brian Smith <brian@dbsoft.org> 5 * (C) 2000-2019 Brian Smith <brian@dbsoft.org>
6 * (C) 2003-2011 Mark Hessling <mark@rexx.org> 6 * (C) 2003-2011 Mark Hessling <mark@rexx.org>
7 * 7 *
8 */ 8 */
9 9
10 #ifdef AEROGLASS 10 #ifdef AEROGLASS
668 return hicon; 668 return hicon;
669 } 669 }
670 return NULL; 670 return NULL;
671 } 671 }
672 #endif 672 #endif
673
674 int _DW_DARK_MODE_ALLOWED = TRUE;
675
676 /* Call this on a window to apply the style */
677 void _set_window_theme(HWND window)
678 {
679 static int initialized = FALSE;
680 BOOL (WINAPI * AllowDarkModeForWindow)(HWND a_HWND, BOOL a_Allow) = NULL;
681
682 if(initialized == FALSE && dwVersion)
683 {
684 /* Dark mode is introduced in Windows 10 build 1809 */
685 if(LOBYTE(LOWORD(dwVersion)) == 10 && HIWORD(dwVersion) >= 1809)
686 AllowDarkModeForWindow = (BOOL (WINAPI *)(HWND, BOOL))GetProcAddress(huxtheme, MAKEINTRESOURCEA(133));
687 initialized = TRUE;
688 }
689 if(AllowDarkModeForWindow)
690 {
691 AllowDarkModeForWindow(window, _DW_DARK_MODE_ALLOWED);
692 if(_DW_DARK_MODE_ALLOWED && _SetWindowTheme)
693 _SetWindowTheme(window, L"Explorer", NULL);
694 }
695 }
673 696
674 /* This function adds a signal handler callback into the linked list. 697 /* This function adds a signal handler callback into the linked list.
675 */ 698 */
676 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) 699 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data)
677 { 700 {