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
9abd2ae8
Commit
9abd2ae8
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 NtUserSetInternalWindowPos implementation from user32.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
96b2b4c0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
232 deletions
+37
-232
sysparams.c
dlls/user32/sysparams.c
+0
-20
user32.spec
dlls/user32/user32.spec
+1
-1
win.h
dlls/user32/win.h
+0
-2
winpos.c
dlls/user32/winpos.c
+0
-208
gdiobj.c
dlls/win32u/gdiobj.c
+1
-0
win32u.spec
dlls/win32u/win32u.spec
+1
-1
win32u_private.h
dlls/win32u/win32u_private.h
+1
-0
window.c
dlls/win32u/window.c
+26
-0
wrappers.c
dlls/win32u/wrappers.c
+6
-0
ntuser.h
include/ntuser.h
+1
-0
No files found.
dlls/user32/sysparams.c
View file @
9abd2ae8
...
...
@@ -740,16 +740,6 @@ POINT point_win_to_thread_dpi( HWND hwnd, POINT pt )
}
/**********************************************************************
* 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
,
GetDpiForWindow
(
hwnd
));
}
/**********************************************************************
* map_dpi_rect
*/
RECT
map_dpi_rect
(
RECT
rect
,
UINT
dpi_from
,
UINT
dpi_to
)
...
...
@@ -775,16 +765,6 @@ RECT rect_win_to_thread_dpi( HWND hwnd, RECT rect )
}
/**********************************************************************
* 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
,
GetDpiForWindow
(
hwnd
)
);
}
/**********************************************************************
* SetProcessDpiAwarenessContext (USER32.@)
*/
BOOL
WINAPI
SetProcessDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT
context
)
...
...
dlls/user32/user32.spec
View file @
9abd2ae8
...
...
@@ -673,7 +673,7 @@
@ stdcall SetFocus(long) NtUserSetFocus
@ stdcall SetForegroundWindow(long)
@ stdcall SetGestureConfig(ptr long long ptr long)
@ stdcall SetInternalWindowPos(long long ptr ptr)
@ stdcall SetInternalWindowPos(long long ptr ptr)
NtUserSetInternalWindowPos
@ stdcall SetKeyboardState(ptr) NtUserSetKeyboardState
@ stdcall SetLastErrorEx(long long)
@ stdcall SetLayeredWindowAttributes(ptr long long long) NtUserSetLayeredWindowAttributes
...
...
dlls/user32/win.h
View file @
9abd2ae8
...
...
@@ -70,10 +70,8 @@ extern POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDD
extern
POINT
point_win_to_phys_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_phys_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_win_to_thread_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_thread_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
RECT
map_dpi_rect
(
RECT
rect
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
RECT
rect_win_to_thread_dpi
(
HWND
hwnd
,
RECT
rect
)
DECLSPEC_HIDDEN
;
extern
RECT
rect_thread_to_win_dpi
(
HWND
hwnd
,
RECT
rect
)
DECLSPEC_HIDDEN
;
static
inline
void
mirror_rect
(
const
RECT
*
window_rect
,
RECT
*
rect
)
{
...
...
dlls/user32/winpos.c
View file @
9abd2ae8
...
...
@@ -44,10 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
#define ON_BOTTOM_BORDER(hit) \
(((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
#define PLACE_MIN 0x0001
#define PLACE_MAX 0x0002
#define PLACE_RECT 0x0004
/***********************************************************************
* SwitchToThisWindow (USER32.@)
...
...
@@ -220,33 +216,6 @@ BOOL WINAPI BringWindowToTop( HWND hwnd )
}
/*******************************************************************
* get_work_rect
*
* Get the work area that a maximized window can cover, depending on style.
*/
static
BOOL
get_work_rect
(
HWND
hwnd
,
RECT
*
rect
)
{
HMONITOR
monitor
=
MonitorFromWindow
(
hwnd
,
MONITOR_DEFAULTTOPRIMARY
);
MONITORINFO
mon_info
;
DWORD
style
;
if
(
!
monitor
)
return
FALSE
;
mon_info
.
cbSize
=
sizeof
(
mon_info
);
GetMonitorInfoW
(
monitor
,
&
mon_info
);
*
rect
=
mon_info
.
rcMonitor
;
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
if
(
style
&
WS_MAXIMIZEBOX
)
{
if
((
style
&
WS_CAPTION
)
==
WS_CAPTION
||
!
(
style
&
(
WS_CHILD
|
WS_POPUP
)))
*
rect
=
mon_info
.
rcWork
;
}
return
TRUE
;
}
/***********************************************************************
* GetInternalWindowPos (USER32.@)
*/
...
...
@@ -266,47 +235,6 @@ UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
}
static
RECT
get_maximized_work_rect
(
HWND
hwnd
)
{
RECT
work_rect
=
{
0
};
if
((
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
(
WS_MINIMIZE
|
WS_MAXIMIZE
))
==
WS_MAXIMIZE
)
{
if
(
!
get_work_rect
(
hwnd
,
&
work_rect
))
work_rect
=
get_primary_monitor_rect
();
}
return
work_rect
;
}
/*******************************************************************
* update_maximized_pos
*
* For top level windows covering the work area, we might have to
* "forget" the maximized position. Windows presumably does this
* to avoid situations where the border style changes, which would
* lead the window to be outside the screen, or the window gets
* reloaded on a different screen, and the "saved" position no
* longer applies to it (despite being maximized).
*
* Some applications (e.g. Imperiums: Greek Wars) depend on this.
*/
static
void
update_maximized_pos
(
WND
*
wnd
,
RECT
*
work_rect
)
{
if
(
wnd
->
parent
&&
wnd
->
parent
!=
GetDesktopWindow
())
return
;
if
(
wnd
->
dwStyle
&
WS_MAXIMIZE
)
{
if
(
wnd
->
window_rect
.
left
<=
work_rect
->
left
&&
wnd
->
window_rect
.
top
<=
work_rect
->
top
&&
wnd
->
window_rect
.
right
>=
work_rect
->
right
&&
wnd
->
window_rect
.
bottom
>=
work_rect
->
bottom
)
wnd
->
max_pos
.
x
=
wnd
->
max_pos
.
y
=
-
1
;
}
else
wnd
->
max_pos
.
x
=
wnd
->
max_pos
.
y
=
-
1
;
}
/***********************************************************************
* GetWindowPlacement (USER32.@)
*
...
...
@@ -318,115 +246,6 @@ BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
return
NtUserGetWindowPlacement
(
hwnd
,
wndpl
);
}
/* make sure the specified rect is visible on screen */
static
void
make_rect_onscreen
(
RECT
*
rect
)
{
MONITORINFO
info
;
HMONITOR
monitor
=
MonitorFromRect
(
rect
,
MONITOR_DEFAULTTONEAREST
);
info
.
cbSize
=
sizeof
(
info
);
if
(
!
monitor
||
!
GetMonitorInfoW
(
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
;
}
/***********************************************************************
* WINPOS_SetPlacement
*/
static
BOOL
WINPOS_SetPlacement
(
HWND
hwnd
,
const
WINDOWPLACEMENT
*
wndpl
,
UINT
flags
)
{
DWORD
style
;
RECT
work_rect
=
get_maximized_work_rect
(
hwnd
);
WND
*
pWnd
=
WIN_GetPtr
(
hwnd
);
WINDOWPLACEMENT
wp
=
*
wndpl
;
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
(
!
pWnd
||
pWnd
==
WND_OTHER_PROCESS
||
pWnd
==
WND_DESKTOP
)
return
FALSE
;
if
(
flags
&
PLACE_MIN
)
pWnd
->
min_pos
=
point_thread_to_win_dpi
(
hwnd
,
wp
.
ptMinPosition
);
if
(
flags
&
PLACE_MAX
)
{
pWnd
->
max_pos
=
point_thread_to_win_dpi
(
hwnd
,
wp
.
ptMaxPosition
);
update_maximized_pos
(
pWnd
,
&
work_rect
);
}
if
(
flags
&
PLACE_RECT
)
pWnd
->
normal_rect
=
rect_thread_to_win_dpi
(
hwnd
,
wp
.
rcNormalPosition
);
style
=
pWnd
->
dwStyle
;
WIN_ReleasePtr
(
pWnd
);
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
(
IsIconic
(
hwnd
))
{
/* SDK: ...valid only the next time... */
if
(
wndpl
->
flags
&
WPF_RESTORETOMAXIMIZED
)
win_set_flags
(
hwnd
,
WIN_RESTORE_MAX
,
0
);
}
return
TRUE
;
}
/***********************************************************************
* AnimateWindow (USER32.@)
...
...
@@ -453,33 +272,6 @@ BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
return
TRUE
;
}
/***********************************************************************
* SetInternalWindowPos (USER32.@)
*/
void
WINAPI
SetInternalWindowPos
(
HWND
hwnd
,
UINT
showCmd
,
LPRECT
rect
,
LPPOINT
pt
)
{
WINDOWPLACEMENT
wndpl
;
UINT
flags
;
wndpl
.
length
=
sizeof
(
wndpl
);
wndpl
.
showCmd
=
showCmd
;
wndpl
.
flags
=
flags
=
0
;
if
(
pt
)
{
flags
|=
PLACE_MIN
;
wndpl
.
flags
|=
WPF_SETMINPOSITION
;
wndpl
.
ptMinPosition
=
*
pt
;
}
if
(
rect
)
{
flags
|=
PLACE_RECT
;
wndpl
.
rcNormalPosition
=
*
rect
;
}
WINPOS_SetPlacement
(
hwnd
,
&
wndpl
,
flags
);
}
/*******************************************************************
* can_activate_window
...
...
dlls/win32u/gdiobj.c
View file @
9abd2ae8
...
...
@@ -1212,6 +1212,7 @@ static struct unix_funcs unix_funcs =
NtUserSetCursorIconData
,
NtUserSetCursorPos
,
NtUserSetFocus
,
NtUserSetInternalWindowPos
,
NtUserSetLayeredWindowAttributes
,
NtUserSetMenu
,
NtUserSetParent
,
...
...
dlls/win32u/win32u.spec
View file @
9abd2ae8
...
...
@@ -1201,7 +1201,7 @@
@ stub NtUserSetInputServiceState
@ stub NtUserSetInteractiveControlFocus
@ stub NtUserSetInteractiveCtrlRotationAngle
@ st
ub NtUserSetInternalWindowPos
@ st
dcall NtUserSetInternalWindowPos(long long ptr ptr)
@ stdcall -syscall NtUserSetKeyboardState(ptr)
@ stdcall NtUserSetLayeredWindowAttributes(ptr long long long)
@ stub NtUserSetMagnificationDesktopMagnifierOffsetsDWMUpdated
...
...
dlls/win32u/win32u_private.h
View file @
9abd2ae8
...
...
@@ -282,6 +282,7 @@ struct unix_funcs
UNICODE_STRING
*
res_name
,
struct
cursoricon_desc
*
desc
);
BOOL
(
WINAPI
*
pNtUserSetCursorPos
)(
INT
x
,
INT
y
);
HWND
(
WINAPI
*
pNtUserSetFocus
)(
HWND
hwnd
);
void
(
WINAPI
*
pNtUserSetInternalWindowPos
)(
HWND
hwnd
,
UINT
cmd
,
RECT
*
rect
,
POINT
*
pt
);
BOOL
(
WINAPI
*
pNtUserSetLayeredWindowAttributes
)(
HWND
hwnd
,
COLORREF
key
,
BYTE
alpha
,
DWORD
flags
);
BOOL
(
WINAPI
*
pNtUserSetMenu
)(
HWND
hwnd
,
HMENU
menu
);
HWND
(
WINAPI
*
pNtUserSetParent
)(
HWND
hwnd
,
HWND
parent
);
...
...
dlls/win32u/window.c
View file @
9abd2ae8
...
...
@@ -3679,6 +3679,32 @@ BOOL WINAPI NtUserEndDeferWindowPosEx( HDWP hdwp, BOOL async )
}
/***********************************************************************
* NtUserSetInternalWindowPos (win32u.@)
*/
void
WINAPI
NtUserSetInternalWindowPos
(
HWND
hwnd
,
UINT
cmd
,
RECT
*
rect
,
POINT
*
pt
)
{
WINDOWPLACEMENT
wndpl
;
UINT
flags
;
wndpl
.
length
=
sizeof
(
wndpl
);
wndpl
.
showCmd
=
cmd
;
wndpl
.
flags
=
flags
=
0
;
if
(
pt
)
{
flags
|=
PLACE_MIN
;
wndpl
.
flags
|=
WPF_SETMINPOSITION
;
wndpl
.
ptMinPosition
=
*
pt
;
}
if
(
rect
)
{
flags
|=
PLACE_RECT
;
wndpl
.
rcNormalPosition
=
*
rect
;
}
set_window_placement
(
hwnd
,
&
wndpl
,
flags
);
}
/***********************************************************************
* win_set_flags
*
* Set the flags of a window and return the previous value.
...
...
dlls/win32u/wrappers.c
View file @
9abd2ae8
...
...
@@ -1185,6 +1185,12 @@ HWND WINAPI NtUserSetFocus( HWND hwnd )
return
unix_funcs
->
pNtUserSetFocus
(
hwnd
);
}
void
WINAPI
NtUserSetInternalWindowPos
(
HWND
hwnd
,
UINT
cmd
,
RECT
*
rect
,
POINT
*
pt
)
{
if
(
!
unix_funcs
)
return
;
return
unix_funcs
->
pNtUserSetInternalWindowPos
(
hwnd
,
cmd
,
rect
,
pt
);
}
BOOL
WINAPI
NtUserSetLayeredWindowAttributes
(
HWND
hwnd
,
COLORREF
key
,
BYTE
alpha
,
DWORD
flags
)
{
if
(
!
unix_funcs
)
return
FALSE
;
...
...
include/ntuser.h
View file @
9abd2ae8
...
...
@@ -625,6 +625,7 @@ BOOL WINAPI NtUserSetCursorIconData( HCURSOR cursor, UNICODE_STRING *module,
struct
cursoricon_desc
*
desc
);
BOOL
WINAPI
NtUserSetCursorPos
(
INT
x
,
INT
y
);
HWND
WINAPI
NtUserSetFocus
(
HWND
hwnd
);
void
WINAPI
NtUserSetInternalWindowPos
(
HWND
hwnd
,
UINT
cmd
,
RECT
*
rect
,
POINT
*
pt
);
BOOL
WINAPI
NtUserSetKeyboardState
(
BYTE
*
state
);
BOOL
WINAPI
NtUserSetLayeredWindowAttributes
(
HWND
hwnd
,
COLORREF
key
,
BYTE
alpha
,
DWORD
flags
);
BOOL
WINAPI
NtUserSetMenu
(
HWND
hwnd
,
HMENU
menu
);
...
...
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