user32: Reimplement ArrangeIconicWindows() using minimized metrics.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
23f26266ef
commit
73684e84b6
@ -11386,7 +11386,6 @@ static void test_arrange_iconic_windows(void)
|
|||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ArrangeIconicWindows(parent);
|
ret = ArrangeIconicWindows(parent);
|
||||||
todo_wine
|
|
||||||
ok(!ret, "wrong ret %u\n", ret);
|
ok(!ret, "wrong ret %u\n", ret);
|
||||||
ok(GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError());
|
ok(GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError());
|
||||||
|
|
||||||
@ -11400,7 +11399,6 @@ todo_wine
|
|||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ArrangeIconicWindows(parent);
|
ret = ArrangeIconicWindows(parent);
|
||||||
todo_wine
|
|
||||||
ok(!ret, "wrong ret %u\n", ret);
|
ok(!ret, "wrong ret %u\n", ret);
|
||||||
ok(GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError());
|
ok(GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError());
|
||||||
|
|
||||||
@ -11423,14 +11421,12 @@ todo_wine
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = ArrangeIconicWindows(parent);
|
ret = ArrangeIconicWindows(parent);
|
||||||
todo_wine
|
|
||||||
ok(ret == 1, "wrong ret %u\n", ret);
|
ok(ret == 1, "wrong ret %u\n", ret);
|
||||||
|
|
||||||
GetWindowRect(hwnds[0], &rect);
|
GetWindowRect(hwnds[0], &rect);
|
||||||
SetRect(&expect, 0, 0, GetSystemMetrics(SM_CXMINIMIZED), GetSystemMetrics(SM_CYMINIMIZED));
|
SetRect(&expect, 0, 0, GetSystemMetrics(SM_CXMINIMIZED), GetSystemMetrics(SM_CYMINIMIZED));
|
||||||
OffsetRect(&expect, mm.iHorzGap, mm.iVertGap);
|
OffsetRect(&expect, mm.iHorzGap, mm.iVertGap);
|
||||||
OffsetRect(&expect, pt.x, pt.y);
|
OffsetRect(&expect, pt.x, pt.y);
|
||||||
todo_wine
|
|
||||||
ok(EqualRect(&rect, &expect), "expected rect %s, got %s\n",
|
ok(EqualRect(&rect, &expect), "expected rect %s, got %s\n",
|
||||||
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
||||||
|
|
||||||
@ -11452,7 +11448,6 @@ todo_wine
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = ArrangeIconicWindows(parent);
|
ret = ArrangeIconicWindows(parent);
|
||||||
todo_wine
|
|
||||||
ok(ret == 10, "wrong ret %u\n", ret);
|
ok(ret == 10, "wrong ret %u\n", ret);
|
||||||
|
|
||||||
col = mm.iHorzGap;
|
col = mm.iHorzGap;
|
||||||
@ -11469,7 +11464,6 @@ todo_wine
|
|||||||
SetRect(&expect, col, row, col + GetSystemMetrics(SM_CXMINIMIZED),
|
SetRect(&expect, col, row, col + GetSystemMetrics(SM_CXMINIMIZED),
|
||||||
row + GetSystemMetrics(SM_CYMINIMIZED));
|
row + GetSystemMetrics(SM_CYMINIMIZED));
|
||||||
OffsetRect(&expect, pt.x, pt.y);
|
OffsetRect(&expect, pt.x, pt.y);
|
||||||
todo_wine
|
|
||||||
ok(EqualRect(&rect, &expect), "hwnd %u: expected rect %s, got %s\n", i,
|
ok(EqualRect(&rect, &expect), "hwnd %u: expected rect %s, got %s\n", i,
|
||||||
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
||||||
|
|
||||||
@ -11489,7 +11483,6 @@ todo_wine
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = ArrangeIconicWindows(parent);
|
ret = ArrangeIconicWindows(parent);
|
||||||
todo_wine
|
|
||||||
ok(ret == 10, "wrong ret %u\n", ret);
|
ok(ret == 10, "wrong ret %u\n", ret);
|
||||||
|
|
||||||
col = parent_rect.right - mm.iHorzGap;
|
col = parent_rect.right - mm.iHorzGap;
|
||||||
@ -11506,7 +11499,6 @@ todo_wine
|
|||||||
SetRect(&expect, col - GetSystemMetrics(SM_CXMINIMIZED),
|
SetRect(&expect, col - GetSystemMetrics(SM_CXMINIMIZED),
|
||||||
row - GetSystemMetrics(SM_CYMINIMIZED), col, row);
|
row - GetSystemMetrics(SM_CYMINIMIZED), col, row);
|
||||||
OffsetRect(&expect, pt.x, pt.y);
|
OffsetRect(&expect, pt.x, pt.y);
|
||||||
todo_wine
|
|
||||||
ok(EqualRect(&rect, &expect), "hwnd %u: expected rect %s, got %s\n", i,
|
ok(EqualRect(&rect, &expect), "hwnd %u: expected rect %s, got %s\n", i,
|
||||||
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
wine_dbgstr_rect(&expect), wine_dbgstr_rect(&rect));
|
||||||
|
|
||||||
|
@ -852,6 +852,75 @@ MINMAXINFO WINPOS_GetMinMaxInfo( HWND hwnd )
|
|||||||
return MinMax;
|
return MinMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static POINT get_first_minimized_child_pos( const RECT *parent, const MINIMIZEDMETRICS *mm,
|
||||||
|
int width, int height )
|
||||||
|
{
|
||||||
|
POINT ret;
|
||||||
|
|
||||||
|
if (mm->iArrange & ARW_STARTRIGHT)
|
||||||
|
ret.x = parent->right - mm->iHorzGap - width;
|
||||||
|
else
|
||||||
|
ret.x = parent->left + mm->iHorzGap;
|
||||||
|
if (mm->iArrange & ARW_STARTTOP)
|
||||||
|
ret.y = parent->top + mm->iVertGap;
|
||||||
|
else
|
||||||
|
ret.y = parent->bottom - mm->iVertGap - height;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void get_next_minimized_child_pos( const RECT *parent, const MINIMIZEDMETRICS *mm,
|
||||||
|
int width, int height, POINT *pos )
|
||||||
|
{
|
||||||
|
BOOL next;
|
||||||
|
|
||||||
|
if (mm->iArrange & ARW_UP) /* == ARW_DOWN */
|
||||||
|
{
|
||||||
|
if (mm->iArrange & ARW_STARTTOP)
|
||||||
|
{
|
||||||
|
pos->y += height + mm->iVertGap;
|
||||||
|
if ((next = pos->y + height > parent->bottom))
|
||||||
|
pos->y = parent->top + mm->iVertGap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos->y -= height + mm->iVertGap;
|
||||||
|
if ((next = pos->y < parent->top))
|
||||||
|
pos->y = parent->bottom - mm->iVertGap - height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (next)
|
||||||
|
{
|
||||||
|
if (mm->iArrange & ARW_STARTRIGHT)
|
||||||
|
pos->x -= width + mm->iHorzGap;
|
||||||
|
else
|
||||||
|
pos->x += width + mm->iHorzGap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mm->iArrange & ARW_STARTRIGHT)
|
||||||
|
{
|
||||||
|
pos->x -= width + mm->iHorzGap;
|
||||||
|
if ((next = pos->x < parent->left))
|
||||||
|
pos->x = parent->right - mm->iHorzGap - width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos->x += width + mm->iHorzGap;
|
||||||
|
if ((next = pos->x + width > parent->right))
|
||||||
|
pos->x = parent->left + mm->iHorzGap;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (next)
|
||||||
|
{
|
||||||
|
if (mm->iArrange & ARW_STARTTOP)
|
||||||
|
pos->y += height + mm->iVertGap;
|
||||||
|
else
|
||||||
|
pos->y -= height + mm->iVertGap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WINPOS_FindIconPos
|
* WINPOS_FindIconPos
|
||||||
@ -2567,14 +2636,16 @@ BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
|
|||||||
*/
|
*/
|
||||||
UINT WINAPI ArrangeIconicWindows( HWND parent )
|
UINT WINAPI ArrangeIconicWindows( HWND parent )
|
||||||
{
|
{
|
||||||
|
int width, height, count = 0;
|
||||||
RECT rectParent;
|
RECT rectParent;
|
||||||
HWND hwndChild;
|
HWND hwndChild;
|
||||||
INT x, y, xspacing, yspacing;
|
|
||||||
POINT pt;
|
POINT pt;
|
||||||
MINIMIZEDMETRICS metrics;
|
MINIMIZEDMETRICS metrics;
|
||||||
|
|
||||||
metrics.cbSize = sizeof(metrics);
|
metrics.cbSize = sizeof(metrics);
|
||||||
SystemParametersInfoW( SPI_GETMINIMIZEDMETRICS, sizeof(metrics), &metrics, 0 );
|
SystemParametersInfoW( SPI_GETMINIMIZEDMETRICS, sizeof(metrics), &metrics, 0 );
|
||||||
|
width = GetSystemMetrics( SM_CXMINIMIZED );
|
||||||
|
height = GetSystemMetrics( SM_CYMINIMIZED );
|
||||||
|
|
||||||
if (parent == GetDesktopWindow())
|
if (parent == GetDesktopWindow())
|
||||||
{
|
{
|
||||||
@ -2587,41 +2658,21 @@ UINT WINAPI ArrangeIconicWindows( HWND parent )
|
|||||||
}
|
}
|
||||||
else GetClientRect( parent, &rectParent );
|
else GetClientRect( parent, &rectParent );
|
||||||
|
|
||||||
x = y = 0;
|
pt = get_first_minimized_child_pos( &rectParent, &metrics, width, height );
|
||||||
xspacing = GetSystemMetrics(SM_CXICONSPACING);
|
|
||||||
yspacing = GetSystemMetrics(SM_CYICONSPACING);
|
|
||||||
|
|
||||||
hwndChild = GetWindow( parent, GW_CHILD );
|
hwndChild = GetWindow( parent, GW_CHILD );
|
||||||
while (hwndChild)
|
while (hwndChild)
|
||||||
{
|
{
|
||||||
if( IsIconic( hwndChild ) )
|
if( IsIconic( hwndChild ) )
|
||||||
{
|
{
|
||||||
WINPOS_ShowIconTitle( hwndChild, FALSE );
|
SetWindowPos( hwndChild, 0, pt.x, pt.y, 0, 0,
|
||||||
|
|
||||||
if (metrics.iArrange & ARW_STARTRIGHT)
|
|
||||||
pt.x = rectParent.right - (x + 1) * xspacing;
|
|
||||||
else
|
|
||||||
pt.x = rectParent.left + x * xspacing;
|
|
||||||
if (metrics.iArrange & ARW_STARTTOP)
|
|
||||||
pt.y = rectParent.top + y * yspacing;
|
|
||||||
else
|
|
||||||
pt.y = rectParent.bottom - (y + 1) * yspacing;
|
|
||||||
|
|
||||||
SetWindowPos( hwndChild, 0, pt.x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
|
|
||||||
pt.y + (yspacing - GetSystemMetrics(SM_CYICON)) / 2, 0, 0,
|
|
||||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||||
if( IsWindow(hwndChild) )
|
get_next_minimized_child_pos( &rectParent, &metrics, width, height, &pt );
|
||||||
WINPOS_ShowIconTitle(hwndChild , TRUE );
|
count++;
|
||||||
|
|
||||||
if (++x >= (rectParent.right - rectParent.left) / xspacing)
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
|
hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
|
||||||
}
|
}
|
||||||
return yspacing;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user