DXGL r670 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r669‎ | r670 | r671 >
Date:23:36, 21 July 2016
Author:admin
Status:new
Tags:
Comment:
Fix background on tabbed dialogs.
Modified paths:
  • /dxglcfg2/dxglcfg2.c (modified) (history)
  • /dxgltest/common.h (modified) (history)
  • /dxgltest/dxgltest.cpp (modified) (history)

Diff [purge]

Index: dxglcfg2/dxglcfg2.c
@@ -64,6 +64,7 @@
6565 HRESULT(WINAPI *_CloseThemeData)(HTHEME hTheme) = NULL;
6666 HRESULT(WINAPI *_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartID,
6767 int iStateID, const RECT *pRect, const RECT *pClipRect) = NULL;
 68+HRESULT(WINAPI *_EnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags) = NULL;
6869
6970
7071 typedef struct
@@ -486,6 +487,7 @@
487488 case WM_INITDIALOG:
488489 if (uxtheme) hThemeDisplay = _OpenThemeData(hWnd, L"Button");
489490 else hThemeDisplay = NULL;
 491+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
490492 return TRUE;
491493 case WM_MEASUREITEM:
492494 switch (wParam)
@@ -546,6 +548,7 @@
547549 switch (Msg)
548550 {
549551 case WM_INITDIALOG:
 552+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
550553 return TRUE;
551554 default:
552555 return FALSE;
@@ -557,6 +560,7 @@
558561 switch (Msg)
559562 {
560563 case WM_INITDIALOG:
 564+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
561565 return TRUE;
562566 default:
563567 return FALSE;
@@ -568,6 +572,7 @@
569573 switch (Msg)
570574 {
571575 case WM_INITDIALOG:
 576+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
572577 return TRUE;
573578 default:
574579 return FALSE;
@@ -579,6 +584,7 @@
580585 switch (Msg)
581586 {
582587 case WM_INITDIALOG:
 588+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
583589 return TRUE;
584590 default:
585591 return FALSE;
@@ -590,6 +596,7 @@
591597 switch (Msg)
592598 {
593599 case WM_INITDIALOG:
 600+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
594601 return TRUE;
595602 default:
596603 return FALSE;
@@ -724,7 +731,9 @@
725732 _DrawThemeBackground =
726733 (HRESULT(WINAPI*)(HTHEME, HDC, int, int, const RECT*, const RECT*))
727734 GetProcAddress(uxtheme, "DrawThemeBackground");
728 - if (!(_OpenThemeData && _CloseThemeData && _DrawThemeBackground))
 735+ _EnableThemeDialogTexture = (HRESULT(WINAPI*)(HWND, DWORD))
 736+ GetProcAddress(uxtheme, "EnableThemeDialogTexture");
 737+ if (!(_OpenThemeData && _CloseThemeData && _DrawThemeBackground && _EnableThemeDialogTexture))
729738 {
730739 FreeLibrary(uxtheme);
731740 uxtheme = NULL;
Index: dxgltest/common.h
@@ -26,6 +26,7 @@
2727 // Windows Header Files:
2828 #include <windows.h>
2929 #include <commctrl.h>
 30+#include <Uxtheme.h>
3031 extern bool gradientavailable;
3132 extern BOOL (WINAPI *_GradientFill)(HDC hdc, TRIVERTEX* pVertices, ULONG nVertices, void* pMesh, ULONG nMeshElements, DWORD dwMode);
3233
Index: dxgltest/dxgltest.cpp
@@ -23,6 +23,7 @@
2424 HINSTANCE hinstance;
2525 bool gradientavailable;
2626 BOOL (WINAPI *_GradientFill)(HDC hdc, TRIVERTEX* pVertices, ULONG nVertices, void* pMesh, ULONG nMeshElements, DWORD dwMode) = NULL;
 27+HRESULT (WINAPI *_EnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags) = NULL;
2728
2829 void GetFileVersion(tstring &version, LPCTSTR filename)
2930 {
@@ -165,6 +166,7 @@
166167 switch(Msg)
167168 {
168169 case WM_INITDIALOG:
 170+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
169171 mod_ddraw = LoadLibrary(_T("ddraw.dll"));
170172 IsDXGLDDraw = GetProcAddress(mod_ddraw,"IsDXGLDDraw");
171173 if(IsDXGLDDraw) SetWindowText(GetDlgItem(hWnd,IDC_DDTYPE),_T("DXGL"));
@@ -286,6 +288,7 @@
287289 switch(Msg)
288290 {
289291 case WM_INITDIALOG:
 292+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
290293 DestroyWindow(GetDlgItem(hWnd,IDC_FILTERLABEL));
291294 DestroyWindow(GetDlgItem(hWnd,IDC_FILTER));
292295 DestroyWindow(GetDlgItem(hWnd,IDC_FSAALABEL));
@@ -497,6 +500,7 @@
498501 switch(Msg)
499502 {
500503 case WM_INITDIALOG:
 504+ if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
501505 SendDlgItemMessage(hWnd,IDC_FULLSCREEN,BM_SETCHECK,1,0);
502506 SetDlgItemText(hWnd,IDC_TESTHEADER,_T("Test 3D graphics functionality in DXGL or Direct3D. Press ESC to quit any test."));
503507 for(i = 0; i < numtests3d; i++)
@@ -833,9 +837,13 @@
834838 if(iccex) iccex(&icc);
835839 else InitCommonControls();
836840 if(comctl32) FreeLibrary(comctl32);
 841+ HMODULE uxtheme = LoadLibrary(_T("uxtheme.dll"));
 842+ if (uxtheme) _EnableThemeDialogTexture = (HRESULT(WINAPI*)(HWND, DWORD))
 843+ GetProcAddress(uxtheme, "EnableThemeDialogTexture");
837844 hinstance = hInstance;
838845 DialogBox(hinstance,MAKEINTRESOURCE(IDD_DXGLTEST),NULL,DXGLTestCallback);
839846 if(msimg32) FreeLibrary(msimg32);
 847+ if (uxtheme) FreeLibrary(uxtheme);
840848 #ifdef _DEBUG
841849 _CrtDumpMemoryLeaks();
842850 #endif