comparison win/dw.c @ 1973:69d0b37082d0

Win: Continuing work on dark mode... added a full dark mode setting. This will try to set the window theme to DarkMode_Explorer in addition, it will override system colors with our own dark mode values and attempt to set all the control colors accordingly. Currently it works on most controls with some exceptions: tree, container, notebook and status.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 06 Aug 2019 21:44:58 +0000
parents 8e650172d8cf
children b2cb0ef3ec3d
comparison
equal deleted inserted replaced
1972:8e650172d8cf 1973:69d0b37082d0
671 return NULL; 671 return NULL;
672 } 672 }
673 #endif 673 #endif
674 674
675 #ifdef AEROGLASS 675 #ifdef AEROGLASS
676 /* Set _DW_DARK_MODE_ALLOWED to FALSE to disable dark mode.
677 * Set _DW_DARK_MODE_ALLOWED to TRUE for basic dark mode.
678 * Set _DW_DARK_MODE_ALLOWED to 2 for full dark mode.
679 */
676 int _DW_DARK_MODE_ALLOWED = TRUE; 680 int _DW_DARK_MODE_ALLOWED = TRUE;
677 int _DW_DARK_MODE_SUPPORTED = FALSE; 681 int _DW_DARK_MODE_SUPPORTED = FALSE;
678 int _DW_DARK_MODE_ENABLED = FALSE; 682 int _DW_DARK_MODE_ENABLED = FALSE;
679 683
680 typedef enum IMMERSIVE_HC_CACHE_MODE 684 typedef enum IMMERSIVE_HC_CACHE_MODE
737 } 741 }
738 742
739 BOOL AllowDarkModeForWindow(HWND window, BOOL allow) 743 BOOL AllowDarkModeForWindow(HWND window, BOOL allow)
740 { 744 {
741 if(_DW_DARK_MODE_SUPPORTED) 745 if(_DW_DARK_MODE_SUPPORTED)
746 {
747 if(_DW_DARK_MODE_ALLOWED == 2)
748 {
749 if(_DW_DARK_MODE_ENABLED)
750 _SetWindowTheme(window, L"DarkMode_Explorer", NULL);
751 else
752 _SetWindowTheme(window, L"Explorer", NULL);
753 }
742 return _AllowDarkModeForWindow(window, allow); 754 return _AllowDarkModeForWindow(window, allow);
755 }
743 return FALSE; 756 return FALSE;
744 } 757 }
745 758
746 BOOL IsHighContrast(VOID) 759 BOOL IsHighContrast(VOID)
747 { 760 {
780 SendMessageW(window, WM_THEMECHANGED, 0, 0); 793 SendMessageW(window, WM_THEMECHANGED, 0, 0);
781 } 794 }
782 return TRUE; 795 return TRUE;
783 } 796 }
784 #endif 797 #endif
798
799 /* Special wrappers for GetSysColor*() since they currently don't support
800 * dark mode, we will have to return modified colors when dark mode is enabled.
801 */
802 DWORD _DW_GetSysColor(int nIndex)
803 {
804 DWORD retval = GetSysColor(nIndex);
805 #ifdef AEROGLASS
806 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED)
807 {
808 const COLORREF darkBkColor = 0x383838;
809 const COLORREF darkTextColor = 0xFFFFFF;
810
811 switch(nIndex)
812 {
813 case COLOR_3DFACE:
814 case COLOR_WINDOW:
815 retval = darkBkColor;
816 break;
817 case COLOR_WINDOWTEXT:
818 retval = darkTextColor;
819 break;
820 }
821 }
822 #endif
823 return retval;
824 }
825
826 HBRUSH _DW_GetSysColorBrush(int nIndex)
827 {
828 HBRUSH retval = GetSysColorBrush(nIndex);
829 #ifdef AEROGLASS
830 static HBRUSH darkBkColorBrush = 0;
831
832 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED)
833 {
834 if(!darkBkColorBrush)
835 darkBkColorBrush = CreateSolidBrush(0x383838);
836
837 switch(nIndex)
838 {
839 case COLOR_3DFACE:
840 case COLOR_WINDOW:
841 retval = darkBkColorBrush;
842 break;
843 case COLOR_WINDOWTEXT:
844 retval = _colors[DW_CLR_WHITE];
845 break;
846 }
847 }
848 #endif
849 return retval;
850 }
785 851
786 /* This function adds a signal handler callback into the linked list. 852 /* This function adds a signal handler callback into the linked list.
787 */ 853 */
788 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) 854 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data)
789 { 855 {
2519 case WM_COMMAND: 2585 case WM_COMMAND:
2520 case WM_NOTIFY: 2586 case WM_NOTIFY:
2521 case WM_MOUSEMOVE: 2587 case WM_MOUSEMOVE:
2522 _wndproc(hWnd, msg, mp1, mp2); 2588 _wndproc(hWnd, msg, mp1, mp2);
2523 break; 2589 break;
2524 #ifdef AEROGLASS 2590 #ifdef AEROGLASS
2591 case WM_THEMECHANGED:
2592 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_SUPPORTED)
2593 {
2594 SetClassLongPtr(hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)_DW_GetSysColorBrush(COLOR_3DFACE));
2595 InvalidateRect(hWnd, NULL, TRUE);
2596 }
2597 break;
2525 case WM_ERASEBKGND: 2598 case WM_ERASEBKGND:
2526 if(_dw_composition && (GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED)) 2599 if(_dw_composition && (GetWindowLongPtr(_toplevel_window(hWnd), GWL_EXSTYLE) & WS_EX_LAYERED))
2527 { 2600 {
2528 static HBRUSH hbrush = 0; 2601 static HBRUSH hbrush = 0;
2529 RECT rect; 2602 RECT rect;
2955 3028
2956 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(fore), 3029 SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(fore),
2957 DW_GREEN_VALUE(fore), 3030 DW_GREEN_VALUE(fore),
2958 DW_BLUE_VALUE(fore))); 3031 DW_BLUE_VALUE(fore)));
2959 } 3032 }
3033 #ifdef AEROGLASS
3034 else if(thiscinfo->fore == DW_CLR_DEFAULT && _DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED)
3035 SetTextColor((HDC)mp1, _DW_GetSysColor(COLOR_WINDOWTEXT));
3036 #endif
2960 /* Handle background */ 3037 /* Handle background */
2961 if(thiscinfo->back == DW_RGB_TRANSPARENT) 3038 if(thiscinfo->back == DW_RGB_TRANSPARENT)
2962 { 3039 {
2963 ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 3040 ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2964 3041
2965 if(parentcinfo && parentcinfo->back != -1) 3042 if(parentcinfo && parentcinfo->back != -1)
2966 thisback = parentcinfo->back; 3043 thisback = parentcinfo->back;
2967 } 3044 }
2968 if(thisback == DW_CLR_DEFAULT) 3045 if(thisback == DW_CLR_DEFAULT)
2969 { 3046 {
2970 HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE); 3047 HBRUSH hbr = _DW_GetSysColorBrush(COLOR_3DFACE);
2971 3048
2972 SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE)); 3049 SetBkColor((HDC)mp1, _DW_GetSysColor(COLOR_3DFACE));
2973 3050
2974 SelectObject((HDC)mp1, hbr); 3051 SelectObject((HDC)mp1, hbr);
2975 return (LONG)(intptr_t)hbr; 3052 return (LRESULT)(intptr_t)hbr;
2976 } 3053 }
2977 else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT) 3054 else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT)
2978 { 3055 {
2979 int back = _internal_color(thisback); 3056 int back = _internal_color(thisback);
2980 3057
2989 SelectObject((HDC)mp1, thiscinfo->hbrush); 3066 SelectObject((HDC)mp1, thiscinfo->hbrush);
2990 return (LRESULT)(intptr_t)thiscinfo->hbrush; 3067 return (LRESULT)(intptr_t)thiscinfo->hbrush;
2991 } 3068 }
2992 } 3069 }
2993 #ifdef AEROGLASS 3070 #ifdef AEROGLASS
3071 /* First handle the transparent or layered cases */
2994 switch(msg) 3072 switch(msg)
2995 { 3073 {
2996 case WM_CTLCOLORSTATIC: 3074 case WM_CTLCOLORSTATIC:
2997 case WM_CTLCOLORBTN: 3075 case WM_CTLCOLORBTN:
2998 case WM_CTLCOLORDLG: 3076 case WM_CTLCOLORDLG:
3010 SelectObject((HDC)mp1, thiscinfo->hbrush); 3088 SelectObject((HDC)mp1, thiscinfo->hbrush);
3011 return (LRESULT)thiscinfo->hbrush; 3089 return (LRESULT)thiscinfo->hbrush;
3012 } 3090 }
3013 } 3091 }
3014 } 3092 }
3093 }
3094 /* Second we handle the dark mode cases */
3095 switch(msg)
3096 {
3097 case WM_CTLCOLORSTATIC:
3098 case WM_CTLCOLORLISTBOX:
3099 case WM_CTLCOLORBTN:
3100 case WM_CTLCOLOREDIT:
3101 case WM_CTLCOLORMSGBOX:
3102 case WM_CTLCOLORSCROLLBAR:
3103 case WM_CTLCOLORDLG:
3104 {
3105 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED)
3106 {
3107 ColorInfo *parentcinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
3108 int thisback = thiscinfo ? thiscinfo->back : -1;
3109
3110 if(thisback == DW_RGB_TRANSPARENT && parentcinfo)
3111 thisback = parentcinfo->back;
3112
3113 if(!thiscinfo || (thiscinfo && (thiscinfo->fore == DW_CLR_DEFAULT || thiscinfo->fore == -1)))
3114 SetTextColor((HDC)mp1, _DW_GetSysColor(COLOR_WINDOWTEXT));
3115 if(!thiscinfo || (thiscinfo && (thisback == DW_CLR_DEFAULT || thisback == -1 || thisback == DW_RGB_TRANSPARENT)))
3116 {
3117 HBRUSH hbr = _DW_GetSysColorBrush(COLOR_3DFACE);
3118
3119 SetBkColor((HDC)mp1, _DW_GetSysColor(COLOR_3DFACE));
3120
3121 SelectObject((HDC)mp1, hbr);
3122 return (LRESULT)(intptr_t)hbr;
3123 }
3124 }
3125 }
3015 } 3126 }
3016 #endif 3127 #endif
3017 } 3128 }
3018 break; 3129 break;
3019 } 3130 }
3369 switch (msg) 3480 switch (msg)
3370 { 3481 {
3371 case WM_ACTIVATE: 3482 case WM_ACTIVATE:
3372 case WM_SETFOCUS: 3483 case WM_SETFOCUS:
3373 return FALSE; 3484 return FALSE;
3374 3485 #ifdef AEROGLASS
3486 case WM_THEMECHANGED:
3487 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_SUPPORTED)
3488 InvalidateRect(hwnd, NULL, TRUE);
3489 break;
3490 #endif
3375 case WM_PAINT: 3491 case WM_PAINT:
3376 { 3492 {
3377 PAINTSTRUCT ps; 3493 PAINTSTRUCT ps;
3378 HDC hdcPaint; 3494 HDC hdcPaint;
3379 int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type")); 3495 int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type"));
3382 BeginPaint(hwnd, &ps); 3498 BeginPaint(hwnd, &ps);
3383 3499
3384 if((hdcPaint = GetDC(hwnd)) != NULL) 3500 if((hdcPaint = GetDC(hwnd)) != NULL)
3385 { 3501 {
3386 unsigned long cx, cy; 3502 unsigned long cx, cy;
3387 HBRUSH oldBrush = SelectObject(hdcPaint, GetSysColorBrush(COLOR_3DFACE)); 3503 HBRUSH oldBrush = SelectObject(hdcPaint, _DW_GetSysColorBrush(COLOR_3DFACE));
3388 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); 3504 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, _DW_GetSysColor(COLOR_3DFACE)));
3389 3505
3390 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); 3506 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy);
3391 3507
3392 if(type == DW_HORZ) 3508 if(type == DW_HORZ)
3393 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); 3509 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy);
3476 int ret = (int)DefWindowProc(hwnd, msg, mp1, mp2); 3592 int ret = (int)DefWindowProc(hwnd, msg, mp1, mp2);
3477 3593
3478 InvalidateRgn(hwnd, NULL, TRUE); 3594 InvalidateRgn(hwnd, NULL, TRUE);
3479 return ret; 3595 return ret;
3480 } 3596 }
3597 #ifdef AEROGLASS
3598 case WM_THEMECHANGED:
3599 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_SUPPORTED)
3600 InvalidateRect(hwnd, NULL, TRUE);
3601 break;
3602 #endif
3481 case WM_PAINT: 3603 case WM_PAINT:
3482 { 3604 {
3483 HDC hdcPaint; 3605 HDC hdcPaint;
3484 PAINTSTRUCT ps; 3606 PAINTSTRUCT ps;
3485 RECT rc; 3607 RECT rc;
3935 4057
3936 InitCommonControlsEx(&icc); 4058 InitCommonControlsEx(&icc);
3937 4059
3938 memset(lookup, 0, sizeof(HICON) * ICON_INDEX_LIMIT); 4060 memset(lookup, 0, sizeof(HICON) * ICON_INDEX_LIMIT);
3939 4061
4062 /* We need the version to check capability like up-down controls */
4063 dwVersion = GetVersion();
4064 dwComctlVer = GetDllVersion(TEXT("comctl32.dll"));
4065
4066 /* We need to initialize dark mode, and thus the aero/theme subsystems before registering our window classes */
4067 if((huxtheme = LoadLibrary(TEXT("uxtheme"))))
4068 _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme");
4069 #ifdef AEROGLASS
4070 /* Attempt to load the Desktop Window Manager and Theme library */
4071 if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi"))))
4072 {
4073 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
4074 _DwmSetWindowAttribute = (HRESULT (WINAPI *)(HWND, DWORD, LPCVOID, DWORD))GetProcAddress(hdwm, "DwmSetWindowAttribute");
4075 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled")))
4076 _DwmIsCompositionEnabled(&_dw_composition);
4077 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData");
4078 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint");
4079 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha");
4080 _DrawThemeTextEx = (HRESULT (WINAPI *)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const DTTOPTS *))GetProcAddress(huxtheme, "DrawThemeTextEx");
4081 _EndBufferedPaint = (HRESULT (WINAPI *)(HPAINTBUFFER, BOOL))GetProcAddress(huxtheme, "EndBufferedPaint");
4082 _CloseThemeData = (HRESULT (WINAPI *)(HTHEME))GetProcAddress(huxtheme, "CloseThemeData");
4083 _dw_init_dark_mode();
4084 }
4085 /* In case of error close the library if needed */
4086 else if(hdwm)
4087 {
4088 FreeLibrary(hdwm);
4089 hdwm = 0;
4090 }
4091 #endif
4092
3940 /* Register the generic Dynamic Windows class */ 4093 /* Register the generic Dynamic Windows class */
3941 memset(&wc, 0, sizeof(WNDCLASS)); 4094 memset(&wc, 0, sizeof(WNDCLASS));
3942 wc.style = CS_DBLCLKS; 4095 wc.style = CS_DBLCLKS;
3943 wc.lpfnWndProc = (WNDPROC)_wndproc; 4096 wc.lpfnWndProc = (WNDPROC)_wndproc;
3944 wc.cbClsExtra = 0; 4097 wc.cbClsExtra = 0;
3977 memset(&wc, 0, sizeof(WNDCLASS)); 4130 memset(&wc, 0, sizeof(WNDCLASS));
3978 wc.style = CS_DBLCLKS; 4131 wc.style = CS_DBLCLKS;
3979 wc.lpfnWndProc = (WNDPROC)_framewndproc; 4132 wc.lpfnWndProc = (WNDPROC)_framewndproc;
3980 wc.cbClsExtra = 0; 4133 wc.cbClsExtra = 0;
3981 wc.cbWndExtra = 32; 4134 wc.cbWndExtra = 32;
3982 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); 4135 wc.hbrBackground = (HBRUSH)_DW_GetSysColorBrush(COLOR_3DFACE);
3983 wc.hCursor = LoadCursor(NULL, IDC_ARROW); 4136 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
3984 wc.lpszMenuName = NULL; 4137 wc.lpszMenuName = NULL;
3985 wc.lpszClassName = FRAMECLASSNAME; 4138 wc.lpszClassName = FRAMECLASSNAME;
3986 4139
3987 RegisterClass(&wc); 4140 RegisterClass(&wc);
3990 memset(&wc, 0, sizeof(WNDCLASS)); 4143 memset(&wc, 0, sizeof(WNDCLASS));
3991 wc.style = CS_DBLCLKS; 4144 wc.style = CS_DBLCLKS;
3992 wc.lpfnWndProc = (WNDPROC)_statuswndproc; 4145 wc.lpfnWndProc = (WNDPROC)_statuswndproc;
3993 wc.cbClsExtra = 0; 4146 wc.cbClsExtra = 0;
3994 wc.cbWndExtra = 32; 4147 wc.cbWndExtra = 32;
3995 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); 4148 wc.hbrBackground = NULL;
3996 wc.hCursor = LoadCursor(NULL, IDC_ARROW); 4149 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
3997 wc.lpszMenuName = NULL; 4150 wc.lpszMenuName = NULL;
3998 wc.lpszClassName = StatusbarClassName; 4151 wc.lpszClassName = StatusbarClassName;
3999 4152
4000 RegisterClass(&wc); 4153 RegisterClass(&wc);
4051 SetWindowPos(hwndTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); 4204 SetWindowPos(hwndTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
4052 4205
4053 /* Create empty box data */ 4206 /* Create empty box data */
4054 SetWindowLongPtr(DW_HWND_OBJECT, GWLP_USERDATA, (LONG_PTR)calloc(sizeof(Box), 1)); 4207 SetWindowLongPtr(DW_HWND_OBJECT, GWLP_USERDATA, (LONG_PTR)calloc(sizeof(Box), 1));
4055 4208
4056 /* We need the version to check capability like up-down controls */
4057 dwVersion = GetVersion();
4058 dwComctlVer = GetDllVersion(TEXT("comctl32.dll"));
4059
4060 /* Initialize Security for named events and memory */ 4209 /* Initialize Security for named events and memory */
4061 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION); 4210 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION);
4062 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE); 4211 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE);
4063 4212
4064 OleInitialize(NULL); 4213 OleInitialize(NULL);
4085 #endif 4234 #endif
4086 4235
4087 /* GDI+ Needs to be initialized before calling _dw_init_thread(); */ 4236 /* GDI+ Needs to be initialized before calling _dw_init_thread(); */
4088 _dw_init_thread(); 4237 _dw_init_thread();
4089 4238
4090 if((huxtheme = LoadLibrary(TEXT("uxtheme"))))
4091 _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme");
4092 #ifdef AEROGLASS
4093 /* Attempt to load the Desktop Window Manager and Theme library */
4094 if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi"))))
4095 {
4096 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
4097 _DwmSetWindowAttribute = (HRESULT (WINAPI *)(HWND, DWORD, LPCVOID, DWORD))GetProcAddress(hdwm, "DwmSetWindowAttribute");
4098 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled")))
4099 _DwmIsCompositionEnabled(&_dw_composition);
4100 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData");
4101 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint");
4102 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha");
4103 _DrawThemeTextEx = (HRESULT (WINAPI *)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const DTTOPTS *))GetProcAddress(huxtheme, "DrawThemeTextEx");
4104 _EndBufferedPaint = (HRESULT (WINAPI *)(HPAINTBUFFER, BOOL))GetProcAddress(huxtheme, "EndBufferedPaint");
4105 _CloseThemeData = (HRESULT (WINAPI *)(HTHEME))GetProcAddress(huxtheme, "CloseThemeData");
4106 _dw_init_dark_mode();
4107 }
4108 /* In case of error close the library if needed */
4109 else if(hdwm)
4110 {
4111 FreeLibrary(hdwm);
4112 hdwm = 0;
4113 }
4114 #endif
4115 #ifdef RICHEDIT 4239 #ifdef RICHEDIT
4116 /* Attempt to load rich edit library: 4.1, 3/2.0 and 1.0 */ 4240 /* Attempt to load rich edit library: 4.1, 3/2.0 and 1.0 */
4117 if(!(hmsftedit = LoadLibrary(TEXT("msftedit")))) 4241 if(!(hmsftedit = LoadLibrary(TEXT("msftedit"))))
4118 { 4242 {
4119 if(!(hrichedit = LoadLibrary(TEXT("riched20")))) 4243 if(!(hrichedit = LoadLibrary(TEXT("riched20"))))