[PATCH 3/3] dwmapi: Add partial implementation of DWMWA_EXTENDED_FRAME_BOUNDS.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Fri Dec 6 10:22:06 CST 2019
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
This stops Unity games like Variables (steam appid 1054800) from complaining
when changing full-screen mode.
dlls/dwmapi/Makefile.in | 1 +
dlls/dwmapi/dwmapi_main.c | 7 +++++++
dlls/dwmapi/tests/dwmapi.c | 14 ++++++++++++++
3 files changed, 22 insertions(+)
diff --git a/dlls/dwmapi/Makefile.in b/dlls/dwmapi/Makefile.in
index 3a36913..d273a22 100644
--- a/dlls/dwmapi/Makefile.in
+++ b/dlls/dwmapi/Makefile.in
@@ -1,5 +1,6 @@
MODULE = dwmapi.dll
IMPORTLIB = dwmapi
+IMPORTS = user32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c
index e976fda..212c88c 100644
--- a/dlls/dwmapi/dwmapi_main.c
+++ b/dlls/dwmapi/dwmapi_main.c
@@ -217,6 +217,13 @@ HRESULT WINAPI DwmGetWindowAttribute(HWND hwnd, DWORD attribute, PVOID pv_attrib
*(BOOL*)(pv_attribute) = FALSE;
break;
+ case DWMWA_EXTENDED_FRAME_BOUNDS:
+ if (size < sizeof(RECT)) return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+
+ WARN("DWMWA_EXTENDED_FRAME_BOUNDS: returning window rect.\n");
+ GetWindowRect(hwnd, pv_attribute);
+ break;
+
case DWMWA_CLOAKED:
if (size < sizeof(DWORD)) return E_INVALIDARG;
diff --git a/dlls/dwmapi/tests/dwmapi.c b/dlls/dwmapi/tests/dwmapi.c
index a520991..1463140 100644
--- a/dlls/dwmapi/tests/dwmapi.c
+++ b/dlls/dwmapi/tests/dwmapi.c
@@ -31,6 +31,7 @@ static LRESULT WINAPI test_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARA
static void test_DwmGetWindowAttribute(void)
{
BOOL nc_rendering;
+ RECT rc, rc2;
HRESULT hr;
hr = pDwmGetWindowAttribute(NULL, DWMWA_NCRENDERING_ENABLED, &nc_rendering, sizeof(nc_rendering));
@@ -47,6 +48,19 @@ static void test_DwmGetWindowAttribute(void)
hr = pDwmGetWindowAttribute(test_wnd, DWMWA_NCRENDERING_ENABLED, &nc_rendering, sizeof(nc_rendering));
ok(hr == S_OK, "DwmGetWindowAttribute(DWMWA_NCRENDERING_ENABLED) failed 0x%08x.\n", hr);
ok(nc_rendering == FALSE || nc_rendering == TRUE, "non-boolean value 0x%x.\n", nc_rendering);
+
+ hr = pDwmGetWindowAttribute(test_wnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rc, sizeof(rc) - 1);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) || broken(hr == E_INVALIDARG) /* Vista */,
+ "DwmGetWindowAttribute(DWMWA_EXTENDED_FRAME_BOUNDS) returned 0x%08x.\n", hr);
+ hr = pDwmGetWindowAttribute(test_wnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rc, sizeof(rc));
+ if (hr != E_HANDLE && broken(hr != DWM_E_COMPOSITIONDISABLED) /* Vista */) /* composition is on */
+ {
+ /* For top-level Windows, the returned rect is always at least as large as GetWindowRect */
+ GetWindowRect(test_wnd, &rc2);
+ ok(hr == S_OK, "DwmGetWindowAttribute(DWMWA_EXTENDED_FRAME_BOUNDS) failed 0x%08x.\n", hr);
+ ok(rc.left >= rc2.left && rc.right <= rc2.right && rc.top >= rc2.top && rc.bottom <= rc2.bottom,
+ "returned rect %s not enclosed in window rect %s.\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(&rc2));
+ }
}
START_TEST(dwmapi)
--
2.21.0
More information about the wine-devel
mailing list