user32: Switch to the window DPI awareness in SetParent().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
700b6182a4
commit
3bf279e7da
|
@ -3121,6 +3121,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
||||||
BOOL was_visible;
|
BOOL was_visible;
|
||||||
WND *wndPtr;
|
WND *wndPtr;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
DPI_AWARENESS_CONTEXT context;
|
||||||
RECT window_rect, old_screen_rect, new_screen_rect;
|
RECT window_rect, old_screen_rect, new_screen_rect;
|
||||||
|
|
||||||
TRACE("(%p %p)\n", hwnd, parent);
|
TRACE("(%p %p)\n", hwnd, parent);
|
||||||
|
@ -3164,8 +3165,11 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
||||||
wndPtr = WIN_GetPtr( hwnd );
|
wndPtr = WIN_GetPtr( hwnd );
|
||||||
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return 0;
|
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return 0;
|
||||||
|
|
||||||
|
context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
|
||||||
WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, NULL );
|
WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, NULL );
|
||||||
|
SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
|
||||||
WIN_GetRectangles( hwnd, COORDS_SCREEN, &old_screen_rect, NULL );
|
WIN_GetRectangles( hwnd, COORDS_SCREEN, &old_screen_rect, NULL );
|
||||||
|
SetThreadDpiAwarenessContext( context );
|
||||||
|
|
||||||
SERVER_START_REQ( set_parent )
|
SERVER_START_REQ( set_parent )
|
||||||
{
|
{
|
||||||
|
@ -3184,6 +3188,10 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
||||||
WIN_ReleasePtr( wndPtr );
|
WIN_ReleasePtr( wndPtr );
|
||||||
if (!ret) return 0;
|
if (!ret) return 0;
|
||||||
|
|
||||||
|
context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
|
||||||
|
WIN_GetRectangles( hwnd, COORDS_SCREEN, &new_screen_rect, NULL );
|
||||||
|
SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
|
||||||
|
|
||||||
USER_Driver->pSetParent( full_handle, parent, old_parent );
|
USER_Driver->pSetParent( full_handle, parent, old_parent );
|
||||||
|
|
||||||
winpos.hwnd = hwnd;
|
winpos.hwnd = hwnd;
|
||||||
|
@ -3194,12 +3202,12 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
||||||
winpos.cy = 0;
|
winpos.cy = 0;
|
||||||
winpos.flags = SWP_NOSIZE;
|
winpos.flags = SWP_NOSIZE;
|
||||||
|
|
||||||
WIN_GetRectangles( hwnd, COORDS_SCREEN, &new_screen_rect, NULL );
|
|
||||||
USER_SetWindowPos( &winpos, new_screen_rect.left - old_screen_rect.left,
|
USER_SetWindowPos( &winpos, new_screen_rect.left - old_screen_rect.left,
|
||||||
new_screen_rect.top - old_screen_rect.top );
|
new_screen_rect.top - old_screen_rect.top );
|
||||||
|
|
||||||
if (was_visible) ShowWindow( hwnd, SW_SHOW );
|
if (was_visible) ShowWindow( hwnd, SW_SHOW );
|
||||||
|
|
||||||
|
SetThreadDpiAwarenessContext( context );
|
||||||
return old_parent;
|
return old_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue