Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3681a68e
Commit
3681a68e
authored
Nov 30, 2023
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Dec 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwmapi: Implement DwmGetWindowAttribute(DWMWA_EXTENDED_FRAME_BOUNDS).
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55968
parent
4b458775
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
2 deletions
+97
-2
dwmapi_main.c
dlls/dwmapi/dwmapi_main.c
+39
-2
dwmapi.c
dlls/dwmapi/tests/dwmapi.c
+58
-0
No files found.
dlls/dwmapi/dwmapi_main.c
View file @
3681a68e
...
...
@@ -196,9 +196,46 @@ BOOL WINAPI DwmDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam,
*/
HRESULT
WINAPI
DwmGetWindowAttribute
(
HWND
hwnd
,
DWORD
attribute
,
PVOID
pv_attribute
,
DWORD
size
)
{
FIXME
(
"(%p %ld %p %ld) stub
\n
"
,
hwnd
,
attribute
,
pv_attribute
,
size
);
BOOL
enabled
=
FALSE
;
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"(%p %ld %p %ld)
\n
"
,
hwnd
,
attribute
,
pv_attribute
,
size
);
if
(
DwmIsCompositionEnabled
(
&
enabled
)
==
S_OK
&&
!
enabled
)
return
E_HANDLE
;
if
(
!
IsWindow
(
hwnd
))
return
E_HANDLE
;
switch
(
attribute
)
{
case
DWMWA_EXTENDED_FRAME_BOUNDS
:
{
RECT
*
rect
=
(
RECT
*
)
pv_attribute
;
DPI_AWARENESS_CONTEXT
context
;
if
(
!
rect
)
return
E_INVALIDARG
;
if
(
size
<
sizeof
(
*
rect
))
return
E_NOT_SUFFICIENT_BUFFER
;
if
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
WS_CHILD
)
return
E_HANDLE
;
/* DWM frame bounds are always in physical coords */
context
=
SetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
if
(
GetWindowRect
(
hwnd
,
rect
))
hr
=
S_OK
;
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
SetThreadDpiAwarenessContext
(
context
);
break
;
}
default:
FIXME
(
"attribute %ld not implemented.
\n
"
,
attribute
);
hr
=
E_NOTIMPL
;
break
;
}
return
hr
;
}
/**********************************************************************
...
...
dlls/dwmapi/tests/dwmapi.c
View file @
3681a68e
...
...
@@ -83,8 +83,66 @@ static void test_DwmGetCompositionTimingInfo(void)
"Got wrong monitor refresh period %s.
\n
"
,
wine_dbgstr_longlong
(
timing_info
.
qpcRefreshPeriod
));
}
static
void
test_DWMWA_EXTENDED_FRAME_BOUNDS
(
void
)
{
DPI_AWARENESS_CONTEXT
(
WINAPI
*
pSetThreadDpiAwarenessContext
)(
DPI_AWARENESS_CONTEXT
);
DPI_AWARENESS_CONTEXT
old_context
=
NULL
;
BOOL
enabled
;
HRESULT
hr
;
RECT
rect
,
window_rect
,
intersection
;
HWND
hwnd
,
child
;
pSetThreadDpiAwarenessContext
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"SetThreadDpiAwarenessContext"
);
if
(
pSetThreadDpiAwarenessContext
)
old_context
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
hwnd
=
CreateWindowW
(
L"static"
,
L"static"
,
WS_OVERLAPPEDWINDOW
|
WS_POPUP
|
WS_VISIBLE
,
10
,
10
,
200
,
200
,
NULL
,
NULL
,
NULL
,
NULL
);
child
=
CreateWindowW
(
L"edit"
,
L"edit"
,
WS_CHILD
|
WS_VISIBLE
,
0
,
0
,
50
,
50
,
hwnd
,
NULL
,
NULL
,
NULL
);
DwmIsCompositionEnabled
(
&
enabled
);
hr
=
DwmGetWindowAttribute
(
hwnd
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
rect
,
sizeof
(
rect
));
if
(
!
enabled
)
{
ok
(
hr
==
E_HANDLE
,
"Got hr %#lx.
\n
"
,
hr
);
skip
(
"DWM is disabled.
\n
"
);
goto
cleanup
;
}
hr
=
DwmGetWindowAttribute
(
NULL
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
rect
,
sizeof
(
rect
));
ok
(
hr
==
E_HANDLE
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
DwmGetWindowAttribute
(
hwnd
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
enabled
,
sizeof
(
enabled
));
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
DwmGetWindowAttribute
(
hwnd
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
NULL
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
DwmGetWindowAttribute
(
child
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
rect
,
sizeof
(
rect
));
ok
(
hr
==
E_HANDLE
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
DwmGetWindowAttribute
(
hwnd
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
rect
,
sizeof
(
rect
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
/* Window rectangle covers extended frame */
GetWindowRect
(
hwnd
,
&
window_rect
);
IntersectRect
(
&
intersection
,
&
window_rect
,
&
rect
);
ok
(
EqualRect
(
&
intersection
,
&
rect
),
"Got wrong frame %s, window %s.
\n
"
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
window_rect
));
/* Extended frame bounds aren't adjusted for DPI */
if
(
pSetThreadDpiAwarenessContext
)
{
RECT
unaware_rect
;
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_UNAWARE
);
hr
=
DwmGetWindowAttribute
(
hwnd
,
DWMWA_EXTENDED_FRAME_BOUNDS
,
&
unaware_rect
,
sizeof
(
unaware_rect
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
EqualRect
(
&
rect
,
&
unaware_rect
),
"Expected %s, got %s.
\n
"
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
unaware_rect
));
}
cleanup:
if
(
pSetThreadDpiAwarenessContext
)
pSetThreadDpiAwarenessContext
(
old_context
);
DestroyWindow
(
child
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
dwmapi
)
{
test_DwmIsCompositionEnabled
();
test_DwmGetCompositionTimingInfo
();
test_DWMWA_EXTENDED_FRAME_BOUNDS
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment