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
4233caa7
Commit
4233caa7
authored
Aug 23, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Scale window dimensions in SetWindowPos() based on DPI awareness.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
110443ac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
winpos.c
dlls/user32/winpos.c
+32
-8
No files found.
dlls/user32/winpos.c
View file @
4233caa7
...
...
@@ -1643,6 +1643,23 @@ static void dump_winpos_flags(UINT flags)
TRACE
(
"
\n
"
);
}
/***********************************************************************
* map_dpi_winpos
*/
static
void
map_dpi_winpos
(
WINDOWPOS
*
winpos
)
{
UINT
dpi_from
=
get_thread_dpi
();
UINT
dpi_to
=
GetDpiForWindow
(
winpos
->
hwnd
);
if
(
!
dpi_from
)
dpi_from
=
get_win_monitor_dpi
(
winpos
->
hwnd
);
if
(
dpi_from
==
dpi_to
)
return
;
winpos
->
x
=
MulDiv
(
winpos
->
x
,
dpi_to
,
dpi_from
);
winpos
->
y
=
MulDiv
(
winpos
->
y
,
dpi_to
,
dpi_from
);
winpos
->
cx
=
MulDiv
(
winpos
->
cx
,
dpi_to
,
dpi_from
);
winpos
->
cy
=
MulDiv
(
winpos
->
cy
,
dpi_to
,
dpi_from
);
}
/***********************************************************************
* SWP_DoWinPosChanging
*/
...
...
@@ -1691,10 +1708,9 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS *pWinpos, RECT *old_window_rect, REC
}
pWinpos
->
flags
|=
SWP_NOCLIENTMOVE
|
SWP_NOCLIENTSIZE
;
TRACE
(
"hwnd %p, after %p, swp %d,%d %dx%d flags %08x
\n
"
,
TRACE
(
"hwnd %p, after %p, swp %d,%d %dx%d flags %08x
current %s style %08x new %s
\n
"
,
pWinpos
->
hwnd
,
pWinpos
->
hwndInsertAfter
,
pWinpos
->
x
,
pWinpos
->
y
,
pWinpos
->
cx
,
pWinpos
->
cy
,
pWinpos
->
flags
);
TRACE
(
"current %s style %08x new %s
\n
"
,
pWinpos
->
cx
,
pWinpos
->
cy
,
pWinpos
->
flags
,
wine_dbgstr_rect
(
old_window_rect
),
wndPtr
->
dwStyle
,
wine_dbgstr_rect
(
new_window_rect
));
...
...
@@ -2216,6 +2232,8 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y )
{
RECT
old_window_rect
,
old_client_rect
,
new_window_rect
,
new_client_rect
,
valid_rects
[
2
];
UINT
orig_flags
;
BOOL
ret
=
FALSE
;
DPI_AWARENESS_CONTEXT
context
;
orig_flags
=
winpos
->
flags
;
...
...
@@ -2256,11 +2274,13 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y )
else
if
(
winpos
->
cy
>
32767
)
winpos
->
cy
=
32767
;
}
context
=
SetThreadDpiAwarenessContext
(
GetWindowDpiAwarenessContext
(
winpos
->
hwnd
));
if
(
!
SWP_DoWinPosChanging
(
winpos
,
&
old_window_rect
,
&
old_client_rect
,
&
new_window_rect
,
&
new_client_rect
))
return
FALSE
;
&
new_window_rect
,
&
new_client_rect
))
goto
done
;
/* Fix redundant flags */
if
(
!
fixup_flags
(
winpos
,
&
old_window_rect
,
parent_x
,
parent_y
))
return
FALSE
;
if
(
!
fixup_flags
(
winpos
,
&
old_window_rect
,
parent_x
,
parent_y
))
goto
done
;
if
((
winpos
->
flags
&
(
SWP_NOZORDER
|
SWP_HIDEWINDOW
|
SWP_SHOWWINDOW
))
!=
SWP_NOZORDER
)
{
...
...
@@ -2275,8 +2295,7 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y )
if
(
!
set_window_pos
(
winpos
->
hwnd
,
winpos
->
hwndInsertAfter
,
winpos
->
flags
,
&
new_window_rect
,
&
new_client_rect
,
valid_rects
))
return
FALSE
;
goto
done
;
if
(
winpos
->
flags
&
SWP_HIDEWINDOW
)
...
...
@@ -2329,7 +2348,10 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos, int parent_x, int parent_y )
winpos
->
cy
=
new_window_rect
.
bottom
-
new_window_rect
.
top
;
SendMessageW
(
winpos
->
hwnd
,
WM_WINDOWPOSCHANGED
,
0
,
(
LPARAM
)
winpos
);
}
return
TRUE
;
ret
=
TRUE
;
done:
SetThreadDpiAwarenessContext
(
context
);
return
ret
;
}
/***********************************************************************
...
...
@@ -2358,6 +2380,8 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
winpos
.
cy
=
cy
;
winpos
.
flags
=
flags
;
map_dpi_winpos
(
&
winpos
);
if
(
WIN_IsCurrentThread
(
hwnd
))
return
USER_SetWindowPos
(
&
winpos
,
0
,
0
);
...
...
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