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
04707a34
Commit
04707a34
authored
Feb 19, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Correctly place minimized windows.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
73684e84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
55 deletions
+19
-55
win.c
dlls/user32/tests/win.c
+0
-6
winpos.c
dlls/user32/winpos.c
+19
-49
No files found.
dlls/user32/tests/win.c
View file @
04707a34
...
...
@@ -6915,14 +6915,12 @@ static void test_ShowWindow_child(HWND hwndMain)
SetRect
(
&
expect
,
0
,
expect
.
bottom
-
GetSystemMetrics
(
SM_CYMINIMIZED
),
GetSystemMetrics
(
SM_CXMINIMIZED
),
expect
.
bottom
);
OffsetRect
(
&
expect
,
pt
.
x
,
pt
.
y
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
/* shouldn't be able to resize minimized windows */
ret
=
SetWindowPos
(
hwnd
,
0
,
0
,
0
,
200
,
200
,
SWP_NOMOVE
|
SWP_NOACTIVATE
|
SWP_NOZORDER
);
ok
(
ret
,
"wrong ret %d
\n
"
,
ret
);
GetWindowRect
(
hwnd
,
&
rect
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
/* test NC area */
...
...
@@ -6943,7 +6941,6 @@ static void test_ShowWindow_child(HWND hwndMain)
ok
(
style
&
WS_MINIMIZE
,
"window should be minimized
\n
"
);
ok
(
!
(
style
&
WS_MAXIMIZE
),
"window should not be maximized
\n
"
);
GetWindowRect
(
hwnd2
,
&
rect
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
...
...
@@ -7046,14 +7043,12 @@ static void test_ShowWindow_mdichild(HWND hwndMain)
SetRect
(
&
expect
,
0
,
expect
.
bottom
-
GetSystemMetrics
(
SM_CYMINIMIZED
),
GetSystemMetrics
(
SM_CXMINIMIZED
),
expect
.
bottom
);
OffsetRect
(
&
expect
,
pt
.
x
,
pt
.
y
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
/* shouldn't be able to resize minimized windows */
ret
=
SetWindowPos
(
hwnd
,
0
,
0
,
0
,
200
,
200
,
SWP_NOMOVE
|
SWP_NOACTIVATE
|
SWP_NOZORDER
);
ok
(
ret
,
"wrong ret %d
\n
"
,
ret
);
GetWindowRect
(
hwnd
,
&
rect
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
/* test NC area */
...
...
@@ -7074,7 +7069,6 @@ static void test_ShowWindow_mdichild(HWND hwndMain)
ok
(
style
&
WS_MINIMIZE
,
"window should be minimized
\n
"
);
ok
(
!
(
style
&
WS_MAXIMIZE
),
"window should not be maximized
\n
"
);
GetWindowRect
(
hwnd2
,
&
rect
);
todo_wine
ok
(
EqualRect
(
&
expect
,
&
rect
),
"expected %s, got %s
\n
"
,
wine_dbgstr_rect
(
&
expect
),
wine_dbgstr_rect
(
&
rect
));
...
...
dlls/user32/winpos.c
View file @
04707a34
...
...
@@ -922,21 +922,13 @@ static void get_next_minimized_child_pos( const RECT *parent, const MINIMIZEDMET
}
}
/***********************************************************************
* WINPOS_FindIconPos
*
* Find a suitable place for an iconic window.
*/
static
POINT
WINPOS_FindIconPos
(
HWND
hwnd
,
POINT
pt
)
static
POINT
get_minimized_pos
(
HWND
hwnd
,
POINT
pt
)
{
RECT
rect
,
rectParent
;
HWND
parent
,
child
;
HRGN
hrgn
,
tmp
;
int
x
,
y
,
xspacing
,
yspacing
;
MINIMIZEDMETRICS
metrics
;
metrics
.
cbSize
=
sizeof
(
metrics
);
SystemParametersInfoW
(
SPI_GETMINIMIZEDMETRICS
,
sizeof
(
metrics
),
&
metrics
,
0
);
int
width
,
height
;
parent
=
GetAncestor
(
hwnd
,
GA_PARENT
);
if
(
parent
==
GetDesktopWindow
())
...
...
@@ -950,12 +942,15 @@ static POINT WINPOS_FindIconPos( HWND hwnd, POINT pt )
}
else
GetClientRect
(
parent
,
&
rectParent
);
if
((
pt
.
x
>=
rectParent
.
left
)
&&
(
pt
.
x
+
GetSystemMetrics
(
SM_CXICON
)
<
rectParent
.
right
)
&&
(
pt
.
y
>=
rectParent
.
top
)
&&
(
pt
.
y
+
GetSystemMetrics
(
SM_CYICON
)
<
rectParent
.
bottom
))
if
((
pt
.
x
>=
rectParent
.
left
)
&&
(
pt
.
x
+
GetSystemMetrics
(
SM_CXMINIMIZED
)
<
rectParent
.
right
)
&&
(
pt
.
y
>=
rectParent
.
top
)
&&
(
pt
.
y
+
GetSystemMetrics
(
SM_CYMINIMIZED
)
<
rectParent
.
bottom
))
return
pt
;
/* The icon already has a suitable position */
xspacing
=
GetSystemMetrics
(
SM_CXICONSPACING
);
yspacing
=
GetSystemMetrics
(
SM_CYICONSPACING
);
width
=
GetSystemMetrics
(
SM_CXMINIMIZED
);
height
=
GetSystemMetrics
(
SM_CYMINIMIZED
);
metrics
.
cbSize
=
sizeof
(
metrics
);
SystemParametersInfoW
(
SPI_GETMINIMIZEDMETRICS
,
sizeof
(
metrics
),
&
metrics
,
0
);
/* Check if another icon already occupies this spot */
/* FIXME: this is completely inefficient */
...
...
@@ -975,42 +970,17 @@ static POINT WINPOS_FindIconPos( HWND hwnd, POINT pt )
}
DeleteObject
(
tmp
);
for
(
y
=
0
;
y
<
(
rectParent
.
bottom
-
rectParent
.
top
)
/
yspacing
;
y
++
)
pt
=
get_first_minimized_child_pos
(
&
rectParent
,
&
metrics
,
width
,
height
);
for
(;;)
{
if
(
metrics
.
iArrange
&
ARW_STARTTOP
)
{
rect
.
top
=
rectParent
.
top
+
y
*
yspacing
;
rect
.
bottom
=
rect
.
top
+
yspacing
;
}
else
{
rect
.
bottom
=
rectParent
.
bottom
-
y
*
yspacing
;
rect
.
top
=
rect
.
bottom
-
yspacing
;
}
for
(
x
=
0
;
x
<
(
rectParent
.
right
-
rectParent
.
left
)
/
xspacing
;
x
++
)
{
if
(
metrics
.
iArrange
&
ARW_STARTRIGHT
)
{
rect
.
right
=
rectParent
.
right
-
x
*
xspacing
;
rect
.
left
=
rect
.
right
-
xspacing
;
}
else
{
rect
.
left
=
rectParent
.
left
+
x
*
xspacing
;
rect
.
right
=
rect
.
left
+
xspacing
;
}
if
(
!
RectInRegion
(
hrgn
,
&
rect
))
{
/* No window was found, so it's OK for us */
pt
.
x
=
rect
.
left
+
(
xspacing
-
GetSystemMetrics
(
SM_CXICON
))
/
2
;
pt
.
y
=
rect
.
top
+
(
yspacing
-
GetSystemMetrics
(
SM_CYICON
))
/
2
;
DeleteObject
(
hrgn
);
return
pt
;
}
}
SetRect
(
&
rect
,
pt
.
x
,
pt
.
y
,
pt
.
x
+
width
,
pt
.
y
+
height
);
if
(
!
RectInRegion
(
hrgn
,
&
rect
))
break
;
get_next_minimized_child_pos
(
&
rectParent
,
&
metrics
,
width
,
height
,
&
pt
);
}
DeleteObject
(
hrgn
);
pt
.
x
=
pt
.
y
=
0
;
return
pt
;
}
...
...
@@ -1041,7 +1011,7 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
case
SW_SHOWMINIMIZED
:
case
SW_FORCEMINIMIZE
:
case
SW_MINIMIZE
:
wpl
.
ptMinPosition
=
WINPOS_FindIconP
os
(
hwnd
,
wpl
.
ptMinPosition
);
wpl
.
ptMinPosition
=
get_minimized_p
os
(
hwnd
,
wpl
.
ptMinPosition
);
SetRect
(
rect
,
wpl
.
ptMinPosition
.
x
,
wpl
.
ptMinPosition
.
y
,
wpl
.
ptMinPosition
.
x
+
GetSystemMetrics
(
SM_CXMINIMIZED
),
...
...
@@ -1071,7 +1041,7 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
old_style
=
WIN_SetStyle
(
hwnd
,
WS_MINIMIZE
,
WS_MAXIMIZE
);
wpl
.
ptMinPosition
=
WINPOS_FindIconP
os
(
hwnd
,
wpl
.
ptMinPosition
);
wpl
.
ptMinPosition
=
get_minimized_p
os
(
hwnd
,
wpl
.
ptMinPosition
);
if
(
!
(
old_style
&
WS_MINIMIZE
))
swpFlags
|=
SWP_STATECHANGED
;
SetRect
(
rect
,
wpl
.
ptMinPosition
.
x
,
wpl
.
ptMinPosition
.
y
,
...
...
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