summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2019-05-01 16:27:25 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2019-05-01 16:27:25 +0200
commitae25d8012939de481633fa3572e7cd598d8a5a5f (patch)
tree87d8222d6c27a8e5f041eeb86d85a846510eec43 /alf
parentf6dad4900a82c58a6666cdcdd46150b28bc2aa23 (diff)
redo compat function architecture
way less code at the expense of explicit initialization
Diffstat (limited to 'alf')
-rw-r--r--alf/alf.cpp17
-rw-r--r--alf/alfcompat.cpp573
-rw-r--r--alf/alfcompat.h85
-rw-r--r--alf/alfdpiaware.cpp3
4 files changed, 252 insertions, 426 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp
index 92ba1bf..06b0099 100644
--- a/alf/alf.cpp
+++ b/alf/alf.cpp
@@ -62,14 +62,17 @@ ALF_UpdateFontsPriv(HWND win, ALFWindowPriv *priv)
priv->fonts.hMessageFont = (HFONT)GetStockObject(SYSTEM_FONT);
GetObject(priv->fonts.hMessageFont, sizeof(priv->fonts.lfMessageFont), &priv->fonts.lfMessageFont);
} else {
- // XXX: SystemParametersInfoForDpi needs the Vista+ NONCLIENTMETRICS,
- // but we want to be able to build with WINVER = 0x0500 and PSDK2003
- ALF_NONCLIENTMETRICS_VISTA ncm;
+ // XXX: SystemParametersInfoForDpi is Unicode-only and needs Vista+ NONCLIENTMETRICS,
+ ALF_NONCLIENTMETRICSW_VISTA ncm;
ZeroMemory(&ncm, sizeof(ncm));
- ncm.cbSize = ALF_SizeOf_NONCLIENTMETRICS();
+ ncm.cbSize = sizeof(ncm);
if (ALF_Compat_SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0, priv->fonts.dpi)) {
+#ifdef UNICODE
priv->fonts.lfMessageFont = ncm.lfMessageFont;
+#else
+ ALF_Compat_LogFontWtoA(&ncm.lfMessageFont, &priv->fonts.lfMessageFont);
+#endif
} else {
// FIXME! fallback to default font, 8pt MS Shell Dlg
ZeroMemory(&priv->fonts.lfMessageFont, sizeof(priv->fonts.lfMessageFont));
@@ -356,6 +359,8 @@ ALF_Initialize(void)
if (!_alf_initCounter++) {
InitCommonControls();
+ ALF_LoadCompatFunctions();
+
ALF_RegisterComboClass();
ALF_RegisterPanelClass();
ALF_RegisterSpacerClass();
@@ -382,6 +387,8 @@ ALF_UnInitialize(void)
UnregisterClass(_alf_comboClass, ALF_HINSTANCE);
UnregisterClass(_alf_panelClass, ALF_HINSTANCE);
UnregisterClass(_alf_spacerClass, ALF_HINSTANCE);
+
+ ALF_UnloadCompatFunctions();
}
// release init lock
@@ -636,7 +643,7 @@ ALF_SetWidgetText(HWND parent, WORD id, const TCHAR *text)
TCHAR * // free with ALF_Free
ALF_Text(HWND hwnd)
{
- int len = GetWindowTextLengthA(hwnd);
+ int len = GetWindowTextLength(hwnd);
if (len > 0) {
TCHAR *buf = ALF_New(TCHAR, len+1);
if (GetWindowText(hwnd, buf, len)) {
diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp
index c0e11ba..5c743ce 100644
--- a/alf/alfcompat.cpp
+++ b/alf/alfcompat.cpp
@@ -2,58 +2,6 @@
#include <shlwapi.h>
-#if defined(_MSC_VER) && defined(_M_IX86)
-
-# pragma warning(push)
-# pragma warning(disable:4035)
-
- // HACK: inline assembly for MSVC 6
- // TODO: add version detection to use intrinsic on newer MSVC versions
-
- static inline LONG
- ALF_Compat_InterlockedIncrement(LONG volatile *addend)
- {
- __asm {
- mov eax,1
- mov edx,addend
- lock xadd [edx],eax
- }
- }
-# ifdef InterlockedIncrement
-# undef InterlockedIncrement
-# endif
-# define InterlockedIncrement(d) ALF_Compat_InterlockedIncrement(d)
-
- static inline LONG
- ALF_Compat_InterlockedCompareExchange(volatile LONG *destination, LONG exchange, LONG comparand)
- {
- __asm {
- mov eax,comparand
- mov ecx,exchange
- mov edx,destination
- lock cmpxchg [edx],ecx
- }
- }
-
-# ifdef InterlockedCompareExchange
-# undef InterlockedCompareExchange
-# endif
-# define InterlockedCompareExchange(d,e,c) ALF_Compat_InterlockedCompareExchange(d,e,c)
-
- static inline PVOID
- ALF_Compat_InterlockedCompareExchangePointer(PVOID volatile *destination, PVOID exchange, PVOID comparand)
- {
- return (void*)InterlockedCompareExchange((LONG volatile *)destination, (LONG)exchange, (LONG)comparand);
- }
-
-# ifdef InterlockedCompareExchangePointer
-# undef InterlockedCompareExchangePointer
-# endif
-# define InterlockedCompareExchangePointer(d,e,c) ALF_Compat_InterlockedCompareExchangePointer(d,e,c)
-
-# pragma warning(pop)
-#endif
-
static
DWORD ALF_DllGetVersion(const char *dll)
{
@@ -126,7 +74,62 @@ ALF_Compat_fallbackSystemParametersInfoForDpi(UINT uiAction, UINT uiParam, PVOID
{
(void)dpi;
- return SystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
+ // NOTE: we only use SystemParametersInfoForDpi for SPI_GETNONCLIENTMETRICS,
+ // therefore we only provide a fallback for that.
+ // SystemParametersInfoForDpi only accepts the Vista+ version of NONCLIENTMETRICSW.
+ if (uiAction == SPI_GETNONCLIENTMETRICS && uiParam == sizeof(ALF_NONCLIENTMETRICSW_VISTA)) {
+ ALF_NONCLIENTMETRICSW_VISTA *ncmw = (ALF_NONCLIENTMETRICSW_VISTA*)pvParam;
+
+ // SystemParametersInfoForDpi is Unicode-only, but
+ // we need to provide a fallback even on ANSI systems
+#ifdef UNICODE
+ SIZE_T s = sizeof(*ncmw);
+ if (LOBYTE(LOWORD(GetVersion())) < 6) {
+ // pre-vista OS doesn't contain last member
+ s -= sizeof(ncmw->iPaddedBorderWidth);
+ ncmw->iPaddedBorderWidth = 0;
+ }
+
+ ncmw->cbSize = s;
+ return SystemParametersInfo(SPI_GETNONCLIENTMETRICS, s, ncmw, fWinIni);
+#else
+ ALF_NONCLIENTMETRICSA_VISTA ncma;
+ ZeroMemory(&ncma, sizeof(ncma));
+
+ SIZE_T s = sizeof(ncma);
+ if (LOBYTE(LOWORD(GetVersion())) < 6) {
+ // pre-vista OS doesn't contain last member
+ s -= sizeof(ncma.iPaddedBorderWidth);
+ ncma.iPaddedBorderWidth = 0;
+ }
+
+ ncma.cbSize = s;
+
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, s, &ncma, fWinIni)) {
+ ncmw->iBorderWidth = ncma.iBorderWidth;
+ ncmw->iScrollWidth = ncma.iScrollWidth;
+ ncmw->iScrollHeight = ncma.iScrollHeight;
+ ncmw->iCaptionWidth = ncma.iCaptionWidth;
+ ncmw->iCaptionHeight = ncma.iCaptionHeight;
+ ALF_Compat_LogFontAtoW(&ncma.lfCaptionFont, &ncmw->lfCaptionFont);
+ ncmw->iSmCaptionWidth = ncma.iSmCaptionWidth;
+ ncmw->iSmCaptionHeight = ncma.iSmCaptionHeight;
+ ALF_Compat_LogFontAtoW(&ncma.lfSmCaptionFont, &ncmw->lfSmCaptionFont);
+ ncmw->iMenuWidth = ncma.iMenuWidth;
+ ncmw->iMenuHeight = ncma.iMenuHeight;
+ ALF_Compat_LogFontAtoW(&ncma.lfMenuFont, &ncmw->lfMenuFont);
+ ALF_Compat_LogFontAtoW(&ncma.lfStatusFont, &ncmw->lfStatusFont);
+ ALF_Compat_LogFontAtoW(&ncma.lfMessageFont, &ncmw->lfMessageFont);
+ ncmw->iPaddedBorderWidth = ncma.iPaddedBorderWidth;
+
+ return TRUE;
+ }
+
+ return FALSE;
+#endif
+ }
+
+ return FALSE;
}
static BOOL WINAPI
@@ -239,125 +242,6 @@ ALF_UniqueCounterValue(LONG_PTR *pCounterId, LONG_PTR *pCounterValue)
*pCounterValue = r;
}
-static BOOL WINAPI
-ALF_Compat_loadIsAppThemed(void)
-{
- HMODULE hUxTheme = GetModuleHandleA("uxtheme.dll");
- FARPROC p = GetProcAddress(hUxTheme, "IsAppThemed");
-
- if (!p || ALF_DllGetVersion("comctl32.dll") < 0x60000)
- p = (FARPROC)ALF_Compat_fallbackIsAppThemed;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_IsAppThemed, (void*)p, (void*)ALF_Compat_loadIsAppThemed);
-
- return ALF_Compat_IsAppThemed();
-}
-
-static UINT WINAPI
-ALF_Compat_loadGetDpiForWindow(HWND window)
-{
- FARPROC p = GetProcAddress(GetModuleHandleA("user32.dll"), "GetDpiForWindow");
-
- if (!p)
- p = (FARPROC)(void*)ALF_Compat_fallbackGetDpiForWindow;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_GetDpiForWindow, (void*)p, (void*)ALF_Compat_loadGetDpiForWindow);
-
- return ALF_Compat_GetDpiForWindow(window);
-}
-
-static BOOL WINAPI
-ALF_Compat_loadAdjustWindowRectExForDpi(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi)
-{
- FARPROC p = GetProcAddress(GetModuleHandleA("user32.dll"), "AdjustWindowRectExForDpi");
-
- if (!p)
- p = (FARPROC)(void*)ALF_Compat_fallbackAdjustWindowRectExForDpi;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_AdjustWindowRectExForDpi, (void*)p, (void*)ALF_Compat_loadAdjustWindowRectExForDpi);
-
- return ALF_Compat_AdjustWindowRectExForDpi(lpRect, dwStyle, bMenu, dwExStyle, dpi);
-}
-
-static int WINAPI
-ALF_Compat_loadGetSystemMetricsForDpi(int nIndex, UINT dpi)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetSystemMetricsForDpi");
-
- if (!p)
- p = (void*)ALF_Compat_fallbackGetSystemMetricsForDpi;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_GetSystemMetricsForDpi, p, (void*)ALF_Compat_loadGetSystemMetricsForDpi);
-
- return ALF_Compat_GetSystemMetricsForDpi(nIndex, dpi);
-}
-
-static BOOL WINAPI
-ALF_Compat_loadSetWindowSubclass(HWND hwnd, ALF_COMPAT_SUBCLASSPROC pfnSubclass, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
-{
- HMODULE comctl32 = GetModuleHandleA("comctl32.dll");
-
- void *p = (void*)GetProcAddress(comctl32, "SetWindowSubclass");
- if (!p) {
- p = (void*)GetProcAddress(comctl32, (char*)410);
- if (!p) {
- p = (void*)ALF_Compat_fallbackSetWindowSubclass;
- }
- }
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_SetWindowSubclass, p, (void*)ALF_Compat_loadSetWindowSubclass);
-
- return ALF_Compat_SetWindowSubclass(hwnd, pfnSubclass, uIdSubclass, dwRefData);
-}
-
-static BOOL WINAPI
-ALF_Compat_loadRemoveWindowSubclass(HWND hwnd, ALF_COMPAT_SUBCLASSPROC pfnSubclass, UINT_PTR uIdSubclass)
-{
- HMODULE comctl32 = GetModuleHandleA("comctl32.dll");
-
- void *p = (void*)GetProcAddress(comctl32, "RemoveWindowSubclass");
- if (!p) {
- p = (void*)GetProcAddress(comctl32, (char*)412);
- if (!p) {
- p = (void*)ALF_Compat_fallbackRemoveWindowSubclass;
- }
- }
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_RemoveWindowSubclass, p, (void*)ALF_Compat_loadRemoveWindowSubclass);
-
- return ALF_Compat_RemoveWindowSubclass(hwnd, pfnSubclass, uIdSubclass);
-}
-
-static LRESULT WINAPI
-ALF_Compat_loadDefSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- HMODULE comctl32 = GetModuleHandleA("comctl32.dll");
-
- void *p = (void*)GetProcAddress(comctl32, "DefSubclassProc");
- if (!p) {
- p = (void*)GetProcAddress(comctl32, (char*)413);
- if (!p) {
- p = (void*)ALF_Compat_fallbackDefSubclassProc;
- }
- }
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_DefSubclassProc, p, (void*)ALF_Compat_loadDefSubclassProc);
-
- return ALF_Compat_DefSubclassProc(hwnd, uMsg, wParam, lParam);
-}
-
-static BOOL WINAPI
-ALF_Compat_loadSystemParametersInfoForDpi(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni, UINT dpi)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "SystemParametersInfoForDpi");
- if (!p)
- p = (void*)ALF_Compat_fallbackSystemParametersInfoForDpi;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_SystemParametersInfoForDpi, p, (void*)ALF_Compat_loadSystemParametersInfoForDpi);
-
- return ALF_Compat_SystemParametersInfoForDpi(uiAction, uiParam, pvParam, fWinIni, dpi);
-}
-
static HTHEME WINAPI
ALF_Compat_fallbackOpenThemeData(HWND window, LPCWSTR classNames)
{
@@ -367,18 +251,6 @@ ALF_Compat_fallbackOpenThemeData(HWND window, LPCWSTR classNames)
return NULL;
}
-static HTHEME WINAPI
-ALF_Compat_loadOpenThemeData(HWND window, LPCWSTR classNames)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "OpenThemeData");
- if (!p)
- p = (void*)ALF_Compat_fallbackOpenThemeData;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_OpenThemeData, p, (void*)ALF_Compat_loadOpenThemeData);
-
- return ALF_Compat_OpenThemeData(window, classNames);
-}
-
static HRESULT WINAPI
ALF_Compat_fallbackCloseThemeData(HTHEME hTheme)
{
@@ -387,18 +259,6 @@ ALF_Compat_fallbackCloseThemeData(HTHEME hTheme)
return S_OK;
}
-static HRESULT WINAPI
-ALF_Compat_loadCloseThemeData(HTHEME hTheme)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "CloseThemeData");
- if (!p)
- p = (void*)ALF_Compat_fallbackCloseThemeData;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_CloseThemeData, p, (void*)ALF_Compat_loadCloseThemeData);
-
- return ALF_Compat_CloseThemeData(hTheme);
-}
-
static BOOL WINAPI
ALF_Compat_fallbackIsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
{
@@ -407,18 +267,6 @@ ALF_Compat_fallbackIsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPar
return TRUE;
}
-static BOOL WINAPI
-ALF_Compat_loadIsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "IsThemeBackgroundPartiallyTransparent");
- if (!p)
- p = (void*)ALF_Compat_fallbackIsThemeBackgroundPartiallyTransparent;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_IsThemeBackgroundPartiallyTransparent, p, (void*)ALF_Compat_loadIsThemeBackgroundPartiallyTransparent);
-
- return ALF_Compat_IsThemeBackgroundPartiallyTransparent(hTheme, iPartId, iStateId);
-}
-
static HRESULT WINAPI
ALF_Compat_fallbackDrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
{
@@ -430,18 +278,6 @@ ALF_Compat_fallbackDrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
}
static HRESULT WINAPI
-ALF_Compat_loadDrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "DrawThemeParentBackground");
- if (!p)
- p = (void*)ALF_Compat_fallbackDrawThemeParentBackground;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_DrawThemeParentBackground, p, (void*)ALF_Compat_loadDrawThemeParentBackground);
-
- return ALF_Compat_DrawThemeParentBackground(hwnd, hdc, prc);
-}
-
-static HRESULT WINAPI
ALF_Compat_fallbackDrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
{
(void)hTheme;
@@ -455,18 +291,6 @@ ALF_Compat_fallbackDrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int
}
static HRESULT WINAPI
-ALF_Compat_loadDrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "DrawThemeBackground");
- if (!p)
- p = (void*)ALF_Compat_fallbackDrawThemeBackground;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_DrawThemeBackground, p, (void*)ALF_Compat_loadDrawThemeBackground);
-
- return ALF_Compat_DrawThemeBackground(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);
-}
-
-static HRESULT WINAPI
ALF_Compat_fallbackGetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
{
(void)hTheme;
@@ -480,18 +304,6 @@ ALF_Compat_fallbackGetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPa
}
static HRESULT WINAPI
-ALF_Compat_loadGetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPArtId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "GetThemeBackgroundContentRect");
- if (!p)
- p = (void*)ALF_Compat_fallbackGetThemeBackgroundContentRect;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_GetThemeBackgroundContentRect, p, (void*)ALF_Compat_loadGetThemeBackgroundContentRect);
-
- return ALF_Compat_GetThemeBackgroundContentRect(hTheme, hdc, iPArtId, iStateId, pBoundingRect, pContentRect);
-}
-
-static HRESULT WINAPI
ALF_Compat_fallbackGetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, LPCWSTR pszText, int iCharCount,
DWORD dwTextFlags, const RECT *pBoundingRect,
@@ -504,21 +316,6 @@ ALF_Compat_fallbackGetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId,
}
static HRESULT WINAPI
-ALF_Compat_loadGetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId,
- int iStateId, LPCWSTR pszText, int iCharCount,
- DWORD dwTextFlags, const RECT *pBoundingRect,
- RECT *pExtentRect)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "GetThemeTextExtent");
- if (!p)
- p = (void*)ALF_Compat_fallbackGetThemeTextExtent;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_GetThemeTextExtent, p, (void*)ALF_Compat_loadGetThemeTextExtent);
-
- return ALF_Compat_GetThemeTextExtent(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect);
-}
-
-static HRESULT WINAPI
ALF_Compat_fallbackDrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
DWORD dwTextFlags2, const RECT *pRect)
@@ -529,20 +326,6 @@ ALF_Compat_fallbackDrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iState
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ALF_Compat_loadDrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
- LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
- DWORD dwTextFlags2, const RECT *pRect)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "DrawThemeText");
- if (!p)
- p = (void*)ALF_Compat_fallbackDrawThemeText;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_DrawThemeText, p, (void*)ALF_Compat_loadDrawThemeText);
-
- return ALF_Compat_DrawThemeText(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect);
-}
-
static BOOL WINAPI
ALF_Compat_fallbackTrackMouseEvent(LPTRACKMOUSEEVENT tme)
{
@@ -551,18 +334,6 @@ ALF_Compat_fallbackTrackMouseEvent(LPTRACKMOUSEEVENT tme)
return FALSE;
}
-static BOOL WINAPI
-ALF_Compat_loadTrackMouseEvent(LPTRACKMOUSEEVENT tme)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("comctl32.dll"), "_TrackMouseEvent");
- if (!p)
- p = (void*)ALF_Compat_fallbackTrackMouseEvent;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_TrackMouseEvent, p, (void*)ALF_Compat_loadTrackMouseEvent);
-
- return ALF_Compat_TrackMouseEvent(tme);
-}
-
static HRESULT WINAPI
ALF_Compat_fallbackBufferedPaintInit(void)
{
@@ -570,35 +341,11 @@ ALF_Compat_fallbackBufferedPaintInit(void)
}
static HRESULT WINAPI
-ALF_Compat_loadBufferedPaintInit(void)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "BufferedPaintInit");
- if (!p)
- p = (void*)ALF_Compat_fallbackBufferedPaintInit;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_BufferedPaintInit, p, (void*)ALF_Compat_loadBufferedPaintInit);
-
- return ALF_Compat_BufferedPaintInit();
-}
-
-static HRESULT WINAPI
ALF_Compat_fallbackBufferedPaintUnInit(void)
{
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ALF_Compat_loadBufferedPaintUnInit(void)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "BufferedPaintUnInit");
- if (!p)
- p = (void*)ALF_Compat_fallbackBufferedPaintUnInit;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_BufferedPaintUnInit, p, (void*)ALF_Compat_loadBufferedPaintUnInit);
-
- return ALF_Compat_BufferedPaintUnInit();
-}
-
static ALF_Compat_HANIMATIONBUFFER WINAPI
ALF_Compat_fallbackBeginBufferedAnimation(HWND hwnd, HDC hdcTarget,
const RECT *prcTarget, DWORD dwFormat,
@@ -612,22 +359,6 @@ ALF_Compat_fallbackBeginBufferedAnimation(HWND hwnd, HDC hdcTarget,
return NULL;
}
-static ALF_Compat_HANIMATIONBUFFER WINAPI
-ALF_Compat_loadBeginBufferedAnimation(HWND hwnd, HDC hdcTarget,
- const RECT *prcTarget, DWORD dwFormat,
- ALF_Compat_BP_PAINTPARAMS *pPaintParams,
- ALF_Compat_BP_ANIMATIONPARAMS *pAnimationParams,
- HDC *phdcFrom, HDC *phdcTo)
-{
- void *p = (void *)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "BeginBufferedAnimation");
- if (!p)
- p = (void*)ALF_Compat_fallbackBeginBufferedAnimation;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_BeginBufferedAnimation, p, (void*)ALF_Compat_loadBeginBufferedAnimation);
-
- return ALF_Compat_BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo);
-}
-
static HRESULT WINAPI
ALF_Compat_fallbackEndBufferedAnimation(ALF_Compat_HANIMATIONBUFFER hbpAnimation, BOOL fUpdateTarget)
{
@@ -636,18 +367,6 @@ ALF_Compat_fallbackEndBufferedAnimation(ALF_Compat_HANIMATIONBUFFER hbpAnimation
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ALF_Compat_loadEndBufferedAnimation(ALF_Compat_HANIMATIONBUFFER hbpAnimation, BOOL fUpdateTarget)
-{
- void *p = (void *)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "EndBufferedAnimation");
- if (!p)
- p = (void*)ALF_Compat_fallbackEndBufferedAnimation;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_EndBufferedAnimation, p, (void*)ALF_Compat_loadEndBufferedAnimation);
-
- return ALF_Compat_EndBufferedAnimation(hbpAnimation, fUpdateTarget);
-}
-
static BOOL WINAPI
ALF_Compat_fallbackBufferedPaintRenderAnimation(HWND hwnd, HDC hdc)
{
@@ -656,18 +375,6 @@ ALF_Compat_fallbackBufferedPaintRenderAnimation(HWND hwnd, HDC hdc)
return FALSE;
}
-static BOOL WINAPI
-ALF_Compat_loadBufferedPaintRenderAnimation(HWND hwnd, HDC hdc)
-{
- void *p = (void *)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "BufferedPaintRenderAnimation");
- if (!p)
- p = (void *)ALF_Compat_fallbackBufferedPaintRenderAnimation;
-
- InterlockedCompareExchangePointer((void**)&ALF_Compat_BufferedPaintRenderAnimation, p, (void*)ALF_Compat_loadBufferedPaintRenderAnimation);
-
- return ALF_Compat_BufferedPaintRenderAnimation(hwnd, hdc);
-}
-
static HRESULT WINAPI
ALF_Compat_fallbackGetThemeTransitionDuration(HTHEME hTheme,
int iPartId,
@@ -681,51 +388,135 @@ ALF_Compat_fallbackGetThemeTransitionDuration(HTHEME hTheme,
return E_NOTIMPL;
}
-static HRESULT WINAPI
-ALF_Compat_loadGetThemeTransitionDuration(HTHEME hTheme,
- int iPartId,
- int iStateIdFrom,
- int iStateIdTo,
- int iPropId,
- DWORD *pdwDuration)
-{
- void *p = (void*)GetProcAddress(GetModuleHandleA("uxtheme.dll"), "GetThemeTransitionDuration");
+#define LOAD_FUNC(dll, name) do { \
+ if (_alf_dll_##dll) \
+ *((FARPROC*)&ALF_Compat_##name) = GetProcAddress(_alf_dll_##dll, #name); \
+ else \
+ ALF_Compat_##name = NULL; \
+ \
+ if (!ALF_Compat_##name) \
+ ALF_Compat_##name = ALF_Compat_fallback##name; \
+ } while (0)
- if (!p)
- p = (void*)ALF_Compat_fallbackGetThemeTransitionDuration;
+#define UNLOAD_FUNC(name) do { ALF_Compat_##name = NULL; } while (0)
- InterlockedCompareExchangePointer((void**)&ALF_Compat_GetThemeTransitionDuration, p, (void*)ALF_Compat_loadGetThemeTransitionDuration);
+static HMODULE _alf_dll_uxtheme = NULL;
+static HMODULE _alf_dll_user32 = NULL;
+static HMODULE _alf_dll_comctl32 = NULL;
- return ALF_Compat_GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration);
-}
+void ALF_LoadCompatFunctions(void)
+{
+ if (GetVersion() < 0x80000000) // don't attempt to load uxtheme.dll on non-NT platforms (ugly error on Win32s)
+ _alf_dll_uxtheme = LoadLibraryA("uxtheme.dll");
-BOOL (WINAPI *ALF_Compat_IsAppThemed)(void) = ALF_Compat_loadIsAppThemed;
-UINT (WINAPI *ALF_Compat_GetDpiForWindow)(HWND /*window*/) = ALF_Compat_loadGetDpiForWindow;
-BOOL (WINAPI *ALF_Compat_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT) = ALF_Compat_loadAdjustWindowRectExForDpi;
-int (WINAPI *ALF_Compat_GetSystemMetricsForDpi)(int, UINT) = ALF_Compat_loadGetSystemMetricsForDpi;
-BOOL (WINAPI *ALF_Compat_SetWindowSubclass)(HWND, ALF_COMPAT_SUBCLASSPROC, UINT_PTR, DWORD_PTR) = ALF_Compat_loadSetWindowSubclass;
-LRESULT (WINAPI *ALF_Compat_DefSubclassProc)(HWND, UINT, WPARAM, LPARAM) = ALF_Compat_loadDefSubclassProc;
-BOOL (WINAPI *ALF_Compat_RemoveWindowSubclass)(HWND, ALF_COMPAT_SUBCLASSPROC, UINT_PTR) = ALF_Compat_loadRemoveWindowSubclass;
+ _alf_dll_user32 = LoadLibraryA("user32.dll");
+ _alf_dll_comctl32 = LoadLibraryA("comctl32.dll");
-// FIXME! do Unicode properly for SystemParametersInfoForDpi
-#ifdef UNICODE
-BOOL (WINAPI *ALF_Compat_SystemParametersInfoForDpi)(UINT,UINT,PVOID,UINT,UINT) = ALF_Compat_loadSystemParametersInfoForDpi;
-#else
-BOOL (WINAPI *ALF_Compat_SystemParametersInfoForDpi)(UINT,UINT,PVOID,UINT,UINT) = ALF_Compat_fallbackSystemParametersInfoForDpi;
-#endif
-HTHEME (WINAPI *ALF_Compat_OpenThemeData)(HWND, LPCWSTR) = ALF_Compat_loadOpenThemeData;
-HRESULT (WINAPI *ALF_Compat_CloseThemeData)(HTHEME) = ALF_Compat_loadCloseThemeData;
-BOOL (WINAPI *ALF_Compat_IsThemeBackgroundPartiallyTransparent)(HTHEME,int,int) = ALF_Compat_loadIsThemeBackgroundPartiallyTransparent;
-HRESULT (WINAPI *ALF_Compat_DrawThemeParentBackground)(HWND,HDC,RECT *) = ALF_Compat_loadDrawThemeParentBackground;
-HRESULT (WINAPI *ALF_Compat_DrawThemeBackground)(HTHEME, HDC, int, int, const RECT *, const RECT *) = ALF_Compat_loadDrawThemeBackground;
-HRESULT (WINAPI *ALF_Compat_GetThemeBackgroundContentRect)(HTHEME,HDC,int,int,const RECT *,RECT *) = ALF_Compat_loadGetThemeBackgroundContentRect;
-HRESULT (WINAPI *ALF_Compat_GetThemeTextExtent)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT *, RECT *) = ALF_Compat_loadGetThemeTextExtent;
-HRESULT (WINAPI *ALF_Compat_DrawThemeText)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *) = ALF_Compat_loadDrawThemeText;
-BOOL (WINAPI *ALF_Compat_TrackMouseEvent)(LPTRACKMOUSEEVENT tme) = ALF_Compat_loadTrackMouseEvent;
-HRESULT (WINAPI *ALF_Compat_BufferedPaintInit)(void) = ALF_Compat_loadBufferedPaintInit;
-HRESULT (WINAPI *ALF_Compat_BufferedPaintUnInit)(void) = ALF_Compat_loadBufferedPaintUnInit;
-ALF_Compat_HANIMATIONBUFFER (WINAPI *ALF_Compat_BeginBufferedAnimation)(HWND,HDC,const RECT *,DWORD,ALF_Compat_BP_PAINTPARAMS *,ALF_Compat_BP_ANIMATIONPARAMS *,HDC *,HDC *) = ALF_Compat_loadBeginBufferedAnimation;
-HRESULT (WINAPI *ALF_Compat_EndBufferedAnimation)(ALF_Compat_HANIMATIONBUFFER,BOOL) = ALF_Compat_loadEndBufferedAnimation;
-BOOL (WINAPI *ALF_Compat_BufferedPaintRenderAnimation)(HWND,HDC) = ALF_Compat_loadBufferedPaintRenderAnimation;
-HRESULT (WINAPI *ALF_Compat_GetThemeTransitionDuration)(HTHEME,int,int,int,int,DWORD*) = ALF_Compat_loadGetThemeTransitionDuration;
+ if (ALF_DllGetVersion("comctl32.dll") >= 0x60000)
+ LOAD_FUNC(uxtheme, IsAppThemed);
+ else
+ ALF_Compat_IsAppThemed = ALF_Compat_fallbackIsAppThemed;
+
+ LOAD_FUNC(user32, GetDpiForWindow);
+ LOAD_FUNC(user32, AdjustWindowRectExForDpi);
+ LOAD_FUNC(user32, GetSystemMetricsForDpi);
+
+ *((FARPROC*)&ALF_Compat_SetWindowSubclass) = GetProcAddress(_alf_dll_comctl32, "SetWindowSubclass");
+ if (!ALF_Compat_SetWindowSubclass)
+ *((FARPROC*)&ALF_Compat_SetWindowSubclass) = GetProcAddress(_alf_dll_comctl32, (char*)410);
+ if (!ALF_Compat_SetWindowSubclass)
+ ALF_Compat_SetWindowSubclass = ALF_Compat_fallbackSetWindowSubclass;
+
+ *((FARPROC*)&ALF_Compat_DefSubclassProc) = GetProcAddress(_alf_dll_comctl32, "DefSubclassProc");
+ if (!ALF_Compat_DefSubclassProc)
+ *((FARPROC*)&ALF_Compat_DefSubclassProc) = GetProcAddress(_alf_dll_comctl32, (char*)413);
+ if (!ALF_Compat_DefSubclassProc)
+ ALF_Compat_DefSubclassProc = ALF_Compat_fallbackDefSubclassProc;
+
+ *((FARPROC*)&ALF_Compat_RemoveWindowSubclass) = GetProcAddress(_alf_dll_comctl32, "RemoveWindowSubclass");
+ if (!ALF_Compat_RemoveWindowSubclass)
+ *((FARPROC*)&ALF_Compat_RemoveWindowSubclass) = GetProcAddress(_alf_dll_comctl32, (char*)412);
+ if (!ALF_Compat_RemoveWindowSubclass)
+ ALF_Compat_RemoveWindowSubclass = ALF_Compat_fallbackRemoveWindowSubclass;
+
+ LOAD_FUNC(user32, SystemParametersInfoForDpi);
+
+ *((FARPROC*)&ALF_Compat_TrackMouseEvent) = GetProcAddress(_alf_dll_comctl32, "_TrackMouseEvent");
+ if (!ALF_Compat_TrackMouseEvent)
+ ALF_Compat_TrackMouseEvent = ALF_Compat_fallbackTrackMouseEvent;
+
+ LOAD_FUNC(uxtheme, OpenThemeData);
+ LOAD_FUNC(uxtheme, CloseThemeData);
+ LOAD_FUNC(uxtheme, IsThemeBackgroundPartiallyTransparent);
+ LOAD_FUNC(uxtheme, DrawThemeParentBackground);
+ LOAD_FUNC(uxtheme, DrawThemeBackground);
+ LOAD_FUNC(uxtheme, GetThemeBackgroundContentRect);
+ LOAD_FUNC(uxtheme, GetThemeTextExtent);
+ LOAD_FUNC(uxtheme, DrawThemeText);
+ LOAD_FUNC(uxtheme, BufferedPaintInit);
+ LOAD_FUNC(uxtheme, BufferedPaintUnInit);
+ LOAD_FUNC(uxtheme, BeginBufferedAnimation);
+ LOAD_FUNC(uxtheme, EndBufferedAnimation);
+ LOAD_FUNC(uxtheme, BufferedPaintRenderAnimation);
+ LOAD_FUNC(uxtheme, GetThemeTransitionDuration);
+}
+
+void ALF_UnloadCompatFunctions(void)
+{
+ UNLOAD_FUNC(IsAppThemed);
+ UNLOAD_FUNC(GetDpiForWindow);
+ UNLOAD_FUNC(AdjustWindowRectExForDpi);
+ UNLOAD_FUNC(GetSystemMetricsForDpi);
+ UNLOAD_FUNC(SetWindowSubclass);
+ UNLOAD_FUNC(DefSubclassProc);
+ UNLOAD_FUNC(RemoveWindowSubclass);
+ UNLOAD_FUNC(SystemParametersInfoForDpi);
+ UNLOAD_FUNC(TrackMouseEvent);
+ UNLOAD_FUNC(OpenThemeData);
+ UNLOAD_FUNC(CloseThemeData);
+ UNLOAD_FUNC(IsThemeBackgroundPartiallyTransparent);
+ UNLOAD_FUNC(DrawThemeParentBackground);
+ UNLOAD_FUNC(DrawThemeBackground);
+ UNLOAD_FUNC(GetThemeBackgroundContentRect);
+ UNLOAD_FUNC(GetThemeTextExtent);
+ UNLOAD_FUNC(DrawThemeText);
+ UNLOAD_FUNC(BufferedPaintInit);
+ UNLOAD_FUNC(BufferedPaintUnInit);
+ UNLOAD_FUNC(BeginBufferedAnimation);
+ UNLOAD_FUNC(EndBufferedAnimation);
+ UNLOAD_FUNC(BufferedPaintRenderAnimation);
+ UNLOAD_FUNC(GetThemeTransitionDuration);
+
+ FreeLibrary(_alf_dll_uxtheme);
+ FreeLibrary(_alf_dll_user32);
+ FreeLibrary(_alf_dll_comctl32);
+}
+
+#undef LOAD_FUNC
+#undef UNLOAD_FUNC
+
+BOOL (WINAPI *ALF_Compat_IsAppThemed)(void) = NULL;
+UINT (WINAPI *ALF_Compat_GetDpiForWindow)(HWND /*window*/) = NULL;
+BOOL (WINAPI *ALF_Compat_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT) = NULL;
+int (WINAPI *ALF_Compat_GetSystemMetricsForDpi)(int, UINT) = NULL;
+BOOL (WINAPI *ALF_Compat_SetWindowSubclass)(HWND, ALF_COMPAT_SUBCLASSPROC, UINT_PTR, DWORD_PTR) = NULL;
+LRESULT (WINAPI *ALF_Compat_DefSubclassProc)(HWND, UINT, WPARAM, LPARAM) = NULL;
+BOOL (WINAPI *ALF_Compat_RemoveWindowSubclass)(HWND, ALF_COMPAT_SUBCLASSPROC, UINT_PTR) = NULL;
+BOOL (WINAPI *ALF_Compat_SystemParametersInfoForDpi)(UINT,UINT,PVOID,UINT,UINT) = NULL;
+
+HTHEME (WINAPI *ALF_Compat_OpenThemeData)(HWND, LPCWSTR) = NULL;
+HRESULT (WINAPI *ALF_Compat_CloseThemeData)(HTHEME) = NULL;
+BOOL (WINAPI *ALF_Compat_IsThemeBackgroundPartiallyTransparent)(HTHEME,int,int) = NULL;
+HRESULT (WINAPI *ALF_Compat_DrawThemeParentBackground)(HWND,HDC,RECT *) = NULL;
+HRESULT (WINAPI *ALF_Compat_DrawThemeBackground)(HTHEME, HDC, int, int, const RECT *, const RECT *) = NULL;
+HRESULT (WINAPI *ALF_Compat_GetThemeBackgroundContentRect)(HTHEME,HDC,int,int,const RECT *,RECT *) = NULL;
+HRESULT (WINAPI *ALF_Compat_GetThemeTextExtent)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT *, RECT *) = NULL;
+HRESULT (WINAPI *ALF_Compat_DrawThemeText)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *) = NULL;
+BOOL (WINAPI *ALF_Compat_TrackMouseEvent)(LPTRACKMOUSEEVENT tme) = NULL;
+HRESULT (WINAPI *ALF_Compat_BufferedPaintInit)(void) = NULL;
+HRESULT (WINAPI *ALF_Compat_BufferedPaintUnInit)(void) = NULL;
+ALF_Compat_HANIMATIONBUFFER (WINAPI *ALF_Compat_BeginBufferedAnimation)(HWND,HDC,const RECT *,DWORD,ALF_Compat_BP_PAINTPARAMS *,ALF_Compat_BP_ANIMATIONPARAMS *,HDC *,HDC *) = NULL;
+HRESULT (WINAPI *ALF_Compat_EndBufferedAnimation)(ALF_Compat_HANIMATIONBUFFER,BOOL) = NULL;
+BOOL (WINAPI *ALF_Compat_BufferedPaintRenderAnimation)(HWND,HDC) = NULL;
+HRESULT (WINAPI *ALF_Compat_GetThemeTransitionDuration)(HTHEME,int,int,int,int,DWORD*) = NULL;
diff --git a/alf/alfcompat.h b/alf/alfcompat.h
index 0d5a7d4..6926de5 100644
--- a/alf/alfcompat.h
+++ b/alf/alfcompat.h
@@ -8,39 +8,51 @@
#define WM_DPICHANGED 0x02E0
#endif
+#ifdef __cplusplus
extern "C" IMAGE_DOS_HEADER __ImageBase;
+#else
+extern IMAGE_DOS_HEADER __ImageBase;
+#endif
#define ALF_HINSTANCE ((HINSTANCE)&__ImageBase)
typedef LRESULT (CALLBACK *ALF_COMPAT_SUBCLASSPROC)(HWND,UINT,WPARAM,LPARAM,UINT_PTR,DWORD_PTR);
typedef struct {
- UINT cbSize;
- int iBorderWidth;
- int iScrollWidth;
- int iScrollHeight;
- int iCaptionWidth;
- int iCaptionHeight;
- LOGFONT lfCaptionFont;
- int iSmCaptionWidth;
- int iSmCaptionHeight;
- LOGFONT lfSmCaptionFont;
- int iMenuWidth;
- int iMenuHeight;
- LOGFONT lfMenuFont;
- LOGFONT lfStatusFont;
- LOGFONT lfMessageFont;
- int iPaddedBorderWidth; // new in Vista
-} ALF_NONCLIENTMETRICS_VISTA;
-
-static inline SIZE_T
-ALF_SizeOf_NONCLIENTMETRICS(void)
-{
- if (LOBYTE(LOWORD(GetVersion())) >= 6) {
- return sizeof(ALF_NONCLIENTMETRICS_VISTA);
- } else {
- return sizeof(ALF_NONCLIENTMETRICS_VISTA) - sizeof(int);
- }
-}
+ UINT cbSize;
+ int iBorderWidth;
+ int iScrollWidth;
+ int iScrollHeight;
+ int iCaptionWidth;
+ int iCaptionHeight;
+ LOGFONTW lfCaptionFont;
+ int iSmCaptionWidth;
+ int iSmCaptionHeight;
+ LOGFONTW lfSmCaptionFont;
+ int iMenuWidth;
+ int iMenuHeight;
+ LOGFONTW lfMenuFont;
+ LOGFONTW lfStatusFont;
+ LOGFONTW lfMessageFont;
+ int iPaddedBorderWidth; // new in Vista
+} ALF_NONCLIENTMETRICSW_VISTA;
+typedef struct {
+ UINT cbSize;
+ int iBorderWidth;
+ int iScrollWidth;
+ int iScrollHeight;
+ int iCaptionWidth;
+ int iCaptionHeight;
+ LOGFONTA lfCaptionFont;
+ int iSmCaptionWidth;
+ int iSmCaptionHeight;
+ LOGFONTA lfSmCaptionFont;
+ int iMenuWidth;
+ int iMenuHeight;
+ LOGFONTA lfMenuFont;
+ LOGFONTA lfStatusFont;
+ LOGFONTA lfMessageFont;
+ int iPaddedBorderWidth; // new in Vista
+} ALF_NONCLIENTMETRICSA_VISTA;
long
ALF_GetAveCharWidth(HDC hdc);
@@ -75,6 +87,25 @@ typedef struct {
#define TMT_TRANSITIONDURATION 6000
#endif
+void ALF_LoadCompatFunctions(void);
+void ALF_UnloadCompatFunctions(void);
+
+inline static void
+ALF_Compat_LogFontWtoA(const LOGFONTW *w, LOGFONTA *a)
+{
+ CopyMemory(a, w, sizeof(LOGFONTA) - LF_FACESIZE);
+ WideCharToMultiByte(CP_ACP, 0, w->lfFaceName, -1, a->lfFaceName, LF_FACESIZE, NULL, NULL);
+ a->lfFaceName[LF_FACESIZE - 1] = '\0';
+}
+
+inline static void
+ALF_Compat_LogFontAtoW(const LOGFONTA *a, LOGFONTW *w)
+{
+ CopyMemory(w, a, sizeof(LOGFONTA) - LF_FACESIZE);
+ MultiByteToWideChar(CP_ACP, 0, a->lfFaceName, -1, w->lfFaceName, LF_FACESIZE);
+ w->lfFaceName[LF_FACESIZE - 1] = 0;
+}
+
extern BOOL (WINAPI *ALF_Compat_IsAppThemed)(void);
extern UINT (WINAPI *ALF_Compat_GetDpiForWindow)(HWND);
extern BOOL (WINAPI *ALF_Compat_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
diff --git a/alf/alfdpiaware.cpp b/alf/alfdpiaware.cpp
index de265b7..8f998f7 100644
--- a/alf/alfdpiaware.cpp
+++ b/alf/alfdpiaware.cpp
@@ -34,11 +34,8 @@ ALF_SetDpiAwareness(ALFDpiAwareness awareness)
{
switch (awareness) {
case ALF_DPI_AWARENESS_PER_MONITOR_AWARE_V2:
- //FIXME: per-monitor DPI awareness is broken on ANSI builds
-#ifdef UNICODE
ALF_SetPerMonitorAwareness();
return;
-#endif
case ALF_DPI_AWARENESS_SYSTEM_AWARE:
ALF_SetSystemDpiAwareness();
return;