From: Zhiyi Zhang zzhang@codeweavers.com
Fix Imperiums: Greek Wars (1183470) not covering the entire screen in fullscreen mode. --- dlls/user32/tests/win.c | 1 - dlls/win32u/window.c | 26 +++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 7e6bf809564..a748920ea14 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12868,7 +12868,6 @@ static void test_window_placement(void) ok(wp.showCmd == SW_SHOWMAXIMIZED, "got show cmd %u\n", wp.showCmd); ok(wp.ptMinPosition.x == -1 && wp.ptMinPosition.y == -1, "got minimized pos (%ld,%ld)\n", wp.ptMinPosition.x, wp.ptMinPosition.y); - todo_wine ok(wp.ptMaxPosition.x == -1 && wp.ptMaxPosition.y == -1, "got maximized pos (%ld,%ld)\n", wp.ptMaxPosition.x, wp.ptMaxPosition.y); ok(EqualRect(&wp.rcNormalPosition, &orig), "got normal pos %s\n", diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 374b55e0011..77e452d8329 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2695,18 +2695,6 @@ static BOOL get_work_rect( HWND hwnd, RECT *rect ) return TRUE; }
-static RECT get_maximized_work_rect( HWND hwnd ) -{ - RECT work_rect = { 0 }; - - if ((get_window_long( hwnd, GWL_STYLE ) & (WS_MINIMIZE | WS_MAXIMIZE)) == WS_MAXIMIZE) - { - if (!get_work_rect( hwnd, &work_rect )) - work_rect = get_primary_monitor_rect( get_thread_dpi() ); - } - return work_rect; -} - /******************************************************************* * update_maximized_pos * @@ -2719,13 +2707,19 @@ static RECT get_maximized_work_rect( HWND hwnd ) * * Some applications (e.g. Imperiums: Greek Wars) depend on this. */ -static void update_maximized_pos( WND *wnd, RECT *work_rect ) +static void update_maximized_pos( WND *wnd ) { + MONITORINFO mon_info; + RECT *work_rect; + if (wnd->parent && wnd->parent != get_desktop_window()) return;
if (wnd->dwStyle & WS_MAXIMIZE) { + mon_info = monitor_info_from_window( wnd->obj.handle, MONITOR_DEFAULTTOPRIMARY ); + work_rect = &mon_info.rcWork; + if (wnd->rects.window.left <= work_rect->left && wnd->rects.window.top <= work_rect->top && wnd->rects.window.right >= work_rect->right && wnd->rects.window.bottom >= work_rect->bottom) wnd->max_pos.x = wnd->max_pos.y = -1; @@ -2744,7 +2738,6 @@ static BOOL empty_point( POINT pt ) */ BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ) { - RECT work_rect = get_maximized_work_rect( hwnd ); WND *win = get_win_ptr( hwnd ); UINT win_dpi;
@@ -2803,7 +2796,7 @@ BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ) { win->normal_rect = win->rects.window; } - update_maximized_pos( win, &work_rect ); + update_maximized_pos( win );
placement->length = sizeof(*placement); if (win->dwStyle & WS_MINIMIZE) @@ -2884,7 +2877,6 @@ static void make_point_onscreen( POINT *pt )
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; @@ -2907,7 +2899,7 @@ static BOOL set_window_placement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT if (flags & PLACE_MAX) { win->max_pos = point_thread_to_win_dpi( hwnd, wp.ptMaxPosition ); - update_maximized_pos( win, &work_rect ); + update_maximized_pos( win ); } if (flags & PLACE_RECT) win->normal_rect = rect_thread_to_win_dpi( hwnd, wp.rcNormalPosition );