Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
96b2b4c0
Commit
96b2b4c0
authored
May 19, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Move NtUserSetWindowPlacement implementation from user32.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
295599e2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
152 additions
and
17 deletions
+152
-17
user32.spec
dlls/user32/user32.spec
+1
-1
winpos.c
dlls/user32/winpos.c
+0
-15
gdiobj.c
dlls/win32u/gdiobj.c
+1
-0
sysparams.c
dlls/win32u/sysparams.c
+20
-0
win32u.spec
dlls/win32u/win32u.spec
+1
-1
win32u_private.h
dlls/win32u/win32u_private.h
+3
-0
window.c
dlls/win32u/window.c
+119
-0
wrappers.c
dlls/win32u/wrappers.c
+6
-0
ntuser.h
include/ntuser.h
+1
-0
No files found.
dlls/user32/user32.spec
View file @
96b2b4c0
...
...
@@ -725,7 +725,7 @@
@ stdcall -arch=win64 SetWindowLongPtrA(long long long)
@ stdcall -arch=win64 SetWindowLongPtrW(long long long)
@ stdcall SetWindowLongW(long long long)
@ stdcall SetWindowPlacement(long ptr)
@ stdcall SetWindowPlacement(long ptr)
NtUserSetWindowPlacement
@ stdcall SetWindowPos(long long long long long long long) NtUserSetWindowPos
@ stdcall SetWindowRgn(long long long) NtUserSetWindowRgn
@ stdcall SetWindowStationUser(long long)
...
...
dlls/user32/winpos.c
View file @
96b2b4c0
...
...
@@ -429,21 +429,6 @@ static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT f
/***********************************************************************
* SetWindowPlacement (USER32.@)
*
* Win95:
* Fails if wndpl->length of Win95 (!) apps is invalid.
*/
BOOL
WINAPI
SetWindowPlacement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wpl
)
{
UINT
flags
=
PLACE_MAX
|
PLACE_RECT
;
if
(
!
wpl
)
return
FALSE
;
if
(
wpl
->
flags
&
WPF_SETMINPOSITION
)
flags
|=
PLACE_MIN
;
return
WINPOS_SetPlacement
(
hwnd
,
wpl
,
flags
);
}
/***********************************************************************
* AnimateWindow (USER32.@)
* Shows/Hides a window with an animation
* NO ANIMATION YET
...
...
dlls/win32u/gdiobj.c
View file @
96b2b4c0
...
...
@@ -1219,6 +1219,7 @@ static struct unix_funcs unix_funcs =
NtUserSetSystemMenu
,
NtUserSetWindowLong
,
NtUserSetWindowLongPtr
,
NtUserSetWindowPlacement
,
NtUserSetWindowPos
,
NtUserSetWindowRgn
,
NtUserSetWindowWord
,
...
...
dlls/win32u/sysparams.c
View file @
96b2b4c0
...
...
@@ -1515,6 +1515,26 @@ POINT point_phys_to_win_dpi( HWND hwnd, POINT pt )
return
map_dpi_point
(
pt
,
get_win_monitor_dpi
(
hwnd
),
get_dpi_for_window
(
hwnd
));
}
/**********************************************************************
* point_thread_to_win_dpi
*/
POINT
point_thread_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
{
UINT
dpi
=
get_thread_dpi
();
if
(
!
dpi
)
dpi
=
get_win_monitor_dpi
(
hwnd
);
return
map_dpi_point
(
pt
,
dpi
,
get_dpi_for_window
(
hwnd
));
}
/**********************************************************************
* rect_thread_to_win_dpi
*/
RECT
rect_thread_to_win_dpi
(
HWND
hwnd
,
RECT
rect
)
{
UINT
dpi
=
get_thread_dpi
();
if
(
!
dpi
)
dpi
=
get_win_monitor_dpi
(
hwnd
);
return
map_dpi_rect
(
rect
,
dpi
,
get_dpi_for_window
(
hwnd
)
);
}
/* map value from system dpi to standard 96 dpi for storing in the registry */
static
int
map_from_system_dpi
(
int
val
)
{
...
...
dlls/win32u/win32u.spec
View file @
96b2b4c0
...
...
@@ -1248,7 +1248,7 @@
@ stub NtUserSetWindowGroup
@ stdcall NtUserSetWindowLong(long long long long)
@ stdcall NtUserSetWindowLongPtr(long long long long)
@ st
ub NtUserSetWindowPlacement
@ st
dcall NtUserSetWindowPlacement(long ptr)
@ stdcall NtUserSetWindowPos(long long long long long long long)
@ stdcall NtUserSetWindowRgn(long long long)
@ stub NtUserSetWindowRgnEx
...
...
dlls/win32u/win32u_private.h
View file @
96b2b4c0
...
...
@@ -289,6 +289,7 @@ struct unix_funcs
BOOL
(
WINAPI
*
pNtUserSetSystemMenu
)(
HWND
hwnd
,
HMENU
menu
);
LONG
(
WINAPI
*
pNtUserSetWindowLong
)(
HWND
hwnd
,
INT
offset
,
LONG
newval
,
BOOL
ansi
);
LONG_PTR
(
WINAPI
*
pNtUserSetWindowLongPtr
)(
HWND
hwnd
,
INT
offset
,
LONG_PTR
newval
,
BOOL
ansi
);
BOOL
(
WINAPI
*
pNtUserSetWindowPlacement
)(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wpl
);
BOOL
(
WINAPI
*
pNtUserSetWindowPos
)(
HWND
hwnd
,
HWND
after
,
INT
x
,
INT
y
,
INT
cx
,
INT
cy
,
UINT
flags
);
int
(
WINAPI
*
pNtUserSetWindowRgn
)(
HWND
hwnd
,
HRGN
hrgn
,
BOOL
redraw
);
WORD
(
WINAPI
*
pNtUserSetWindowWord
)(
HWND
hwnd
,
INT
offset
,
WORD
newval
);
...
...
@@ -418,6 +419,8 @@ extern BOOL is_exiting_thread( DWORD tid ) DECLSPEC_HIDDEN;
extern
POINT
map_dpi_point
(
POINT
pt
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
RECT
map_dpi_rect
(
RECT
rect
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
POINT
point_phys_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_thread_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
RECT
rect_thread_to_win_dpi
(
HWND
hwnd
,
RECT
rect
)
DECLSPEC_HIDDEN
;
extern
HMONITOR
monitor_from_point
(
POINT
pt
,
DWORD
flags
,
UINT
dpi
)
DECLSPEC_HIDDEN
;
extern
HMONITOR
monitor_from_rect
(
const
RECT
*
rect
,
DWORD
flags
,
UINT
dpi
)
DECLSPEC_HIDDEN
;
extern
HMONITOR
monitor_from_window
(
HWND
hwnd
,
DWORD
flags
,
UINT
dpi
)
DECLSPEC_HIDDEN
;
...
...
dlls/win32u/window.c
View file @
96b2b4c0
...
...
@@ -48,6 +48,10 @@ static void *user_handles[NB_USER_HANDLES];
#define SWP_AGG_NOCLIENTCHANGE \
(SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
#define PLACE_MIN 0x0001
#define PLACE_MAX 0x0002
#define PLACE_RECT 0x0004
/***********************************************************************
* alloc_user_handle
*/
...
...
@@ -2484,6 +2488,121 @@ BOOL get_window_placement( HWND hwnd, WINDOWPLACEMENT *placement )
return
TRUE
;
}
/* make sure the specified rect is visible on screen */
static
void
make_rect_onscreen
(
RECT
*
rect
)
{
MONITORINFO
info
;
HMONITOR
monitor
=
monitor_from_rect
(
rect
,
MONITOR_DEFAULTTONEAREST
,
get_thread_dpi
()
);
info
.
cbSize
=
sizeof
(
info
);
if
(
!
monitor
||
!
get_monitor_info
(
monitor
,
&
info
))
return
;
/* FIXME: map coordinates from rcWork to rcMonitor */
if
(
rect
->
right
<=
info
.
rcWork
.
left
)
{
rect
->
right
+=
info
.
rcWork
.
left
-
rect
->
left
;
rect
->
left
=
info
.
rcWork
.
left
;
}
else
if
(
rect
->
left
>=
info
.
rcWork
.
right
)
{
rect
->
left
+=
info
.
rcWork
.
right
-
rect
->
right
;
rect
->
right
=
info
.
rcWork
.
right
;
}
if
(
rect
->
bottom
<=
info
.
rcWork
.
top
)
{
rect
->
bottom
+=
info
.
rcWork
.
top
-
rect
->
top
;
rect
->
top
=
info
.
rcWork
.
top
;
}
else
if
(
rect
->
top
>=
info
.
rcWork
.
bottom
)
{
rect
->
top
+=
info
.
rcWork
.
bottom
-
rect
->
bottom
;
rect
->
bottom
=
info
.
rcWork
.
bottom
;
}
}
/* make sure the specified point is visible on screen */
static
void
make_point_onscreen
(
POINT
*
pt
)
{
RECT
rect
;
SetRect
(
&
rect
,
pt
->
x
,
pt
->
y
,
pt
->
x
+
1
,
pt
->
y
+
1
);
make_rect_onscreen
(
&
rect
);
pt
->
x
=
rect
.
left
;
pt
->
y
=
rect
.
top
;
}
static
BOOL
set_window_placement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wndpl
,
UINT
flags
)
{
RECT
work_rect
=
get_maximized_work_rect
(
hwnd
);
WND
*
win
=
get_win_ptr
(
hwnd
);
WINDOWPLACEMENT
wp
=
*
wndpl
;
DWORD
style
;
if
(
flags
&
PLACE_MIN
)
make_point_onscreen
(
&
wp
.
ptMinPosition
);
if
(
flags
&
PLACE_MAX
)
make_point_onscreen
(
&
wp
.
ptMaxPosition
);
if
(
flags
&
PLACE_RECT
)
make_rect_onscreen
(
&
wp
.
rcNormalPosition
);
TRACE
(
"%p: setting min %d,%d max %d,%d normal %s flags %x adjusted to min %d,%d max %d,%d normal %s
\n
"
,
hwnd
,
wndpl
->
ptMinPosition
.
x
,
wndpl
->
ptMinPosition
.
y
,
wndpl
->
ptMaxPosition
.
x
,
wndpl
->
ptMaxPosition
.
y
,
wine_dbgstr_rect
(
&
wndpl
->
rcNormalPosition
),
flags
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
)
);
if
(
!
win
||
win
==
WND_OTHER_PROCESS
||
win
==
WND_DESKTOP
)
return
FALSE
;
if
(
flags
&
PLACE_MIN
)
win
->
min_pos
=
point_thread_to_win_dpi
(
hwnd
,
wp
.
ptMinPosition
);
if
(
flags
&
PLACE_MAX
)
{
win
->
max_pos
=
point_thread_to_win_dpi
(
hwnd
,
wp
.
ptMaxPosition
);
update_maximized_pos
(
win
,
&
work_rect
);
}
if
(
flags
&
PLACE_RECT
)
win
->
normal_rect
=
rect_thread_to_win_dpi
(
hwnd
,
wp
.
rcNormalPosition
);
style
=
win
->
dwStyle
;
release_win_ptr
(
win
);
if
(
style
&
WS_MINIMIZE
)
{
if
(
flags
&
PLACE_MIN
)
{
NtUserSetWindowPos
(
hwnd
,
0
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
);
}
}
else
if
(
style
&
WS_MAXIMIZE
)
{
if
(
flags
&
PLACE_MAX
)
NtUserSetWindowPos
(
hwnd
,
0
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
);
}
else
if
(
flags
&
PLACE_RECT
)
NtUserSetWindowPos
(
hwnd
,
0
,
wp
.
rcNormalPosition
.
left
,
wp
.
rcNormalPosition
.
top
,
wp
.
rcNormalPosition
.
right
-
wp
.
rcNormalPosition
.
left
,
wp
.
rcNormalPosition
.
bottom
-
wp
.
rcNormalPosition
.
top
,
SWP_NOZORDER
|
SWP_NOACTIVATE
);
NtUserShowWindow
(
hwnd
,
wndpl
->
showCmd
);
if
(
is_iconic
(
hwnd
))
{
if
(
wndpl
->
flags
&
WPF_RESTORETOMAXIMIZED
)
win_set_flags
(
hwnd
,
WIN_RESTORE_MAX
,
0
);
}
return
TRUE
;
}
/***********************************************************************
* NtUserSetWindowPlacement (win32u.@)
*/
BOOL
WINAPI
NtUserSetWindowPlacement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wpl
)
{
UINT
flags
=
PLACE_MAX
|
PLACE_RECT
;
if
(
!
wpl
)
return
FALSE
;
if
(
wpl
->
flags
&
WPF_SETMINPOSITION
)
flags
|=
PLACE_MIN
;
return
set_window_placement
(
hwnd
,
wpl
,
flags
);
}
/*****************************************************************************
* NtUserBuildHwndList (win32u.@)
*/
...
...
dlls/win32u/wrappers.c
View file @
96b2b4c0
...
...
@@ -1227,6 +1227,12 @@ LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval,
return
unix_funcs
->
pNtUserSetWindowLongPtr
(
hwnd
,
offset
,
newval
,
ansi
);
}
BOOL
WINAPI
NtUserSetWindowPlacement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wpl
)
{
if
(
!
unix_funcs
)
return
0
;
return
unix_funcs
->
pNtUserSetWindowPlacement
(
hwnd
,
wpl
);
}
BOOL
WINAPI
NtUserSetWindowPos
(
HWND
hwnd
,
HWND
after
,
INT
x
,
INT
y
,
INT
cx
,
INT
cy
,
UINT
flags
)
{
if
(
!
unix_funcs
)
return
0
;
...
...
include/ntuser.h
View file @
96b2b4c0
...
...
@@ -641,6 +641,7 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle );
UINT_PTR
WINAPI
NtUserSetTimer
(
HWND
hwnd
,
UINT_PTR
id
,
UINT
timeout
,
TIMERPROC
proc
,
ULONG
tolerance
);
LONG
WINAPI
NtUserSetWindowLong
(
HWND
hwnd
,
INT
offset
,
LONG
newval
,
BOOL
ansi
);
LONG_PTR
WINAPI
NtUserSetWindowLongPtr
(
HWND
hwnd
,
INT
offset
,
LONG_PTR
newval
,
BOOL
ansi
);
BOOL
WINAPI
NtUserSetWindowPlacement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wpl
);
BOOL
WINAPI
NtUserSetWindowPos
(
HWND
hwnd
,
HWND
after
,
INT
x
,
INT
y
,
INT
cx
,
INT
cy
,
UINT
flags
);
int
WINAPI
NtUserSetWindowRgn
(
HWND
hwnd
,
HRGN
hrgn
,
BOOL
redraw
);
WORD
WINAPI
NtUserSetWindowWord
(
HWND
hwnd
,
INT
offset
,
WORD
newval
);
...
...
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