mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:39:34 +00:00
winemac.drv: Resize desktop window on WM_DISPLAYCHANGE message.
This commit is contained in:
parent
63eeb236ed
commit
67d3735594
|
@ -831,10 +831,7 @@ LONG macdrv_ChangeDisplaySettings(LPDEVMODEW displays, HWND hwnd, DWORD flags, L
|
|||
ret = DISP_CHANGE_BADMODE;
|
||||
}
|
||||
else if (macdrv_set_display_mode(&macdrv_displays[0], best_display_mode))
|
||||
{
|
||||
macdrv_init_display_devices(TRUE);
|
||||
send_message(NtUserGetDesktopWindow(), WM_MACDRV_UPDATE_DESKTOP_RECT, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("Failed to set display mode\n");
|
||||
|
@ -1172,7 +1169,7 @@ void macdrv_displays_changed(const macdrv_event *event)
|
|||
{
|
||||
macdrv_init_display_devices(TRUE);
|
||||
init_registry_display_settings();
|
||||
send_message(hwnd, WM_MACDRV_UPDATE_DESKTOP_RECT, 0, 0);
|
||||
macdrv_resize_desktop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
|
|||
enum macdrv_window_messages
|
||||
{
|
||||
WM_MACDRV_SET_WIN_REGION = 0x80001000,
|
||||
WM_MACDRV_UPDATE_DESKTOP_RECT,
|
||||
WM_MACDRV_RESET_DEVICE_METRICS,
|
||||
WM_MACDRV_DISPLAYCHANGE,
|
||||
WM_MACDRV_ACTIVATE_ON_FOLLOWING_FOCUS,
|
||||
|
@ -268,6 +267,7 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP
|
|||
|
||||
extern void check_retina_status(void) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_init_display_devices(BOOL force) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_resize_desktop(void) DECLSPEC_HIDDEN;
|
||||
extern void init_user_driver(void) DECLSPEC_HIDDEN;
|
||||
|
||||
/* unixlib interface */
|
||||
|
|
|
@ -1570,6 +1570,26 @@ BOOL macdrv_CreateDesktopWindow(HWND hwnd)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void macdrv_resize_desktop(void)
|
||||
{
|
||||
HWND hwnd = NtUserGetDesktopWindow();
|
||||
CGRect new_desktop_rect;
|
||||
RECT current_desktop_rect;
|
||||
|
||||
macdrv_reset_device_metrics();
|
||||
new_desktop_rect = macdrv_get_desktop_rect();
|
||||
if (!NtUserGetWindowRect(hwnd, ¤t_desktop_rect) ||
|
||||
!CGRectEqualToRect(cgrect_from_rect(current_desktop_rect), new_desktop_rect))
|
||||
{
|
||||
send_message_timeout(HWND_BROADCAST, WM_MACDRV_RESET_DEVICE_METRICS, 0, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL);
|
||||
NtUserSetWindowPos(hwnd, 0, CGRectGetMinX(new_desktop_rect), CGRectGetMinY(new_desktop_rect),
|
||||
CGRectGetWidth(new_desktop_rect), CGRectGetHeight(new_desktop_rect),
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE);
|
||||
send_message_timeout(HWND_BROADCAST, WM_MACDRV_DISPLAYCHANGE, 0, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#define WM_WINE_NOTIFY_ACTIVITY WM_USER
|
||||
|
||||
|
@ -1591,6 +1611,9 @@ LRESULT macdrv_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||
#pragma clang diagnostic pop
|
||||
break;
|
||||
}
|
||||
case WM_DISPLAYCHANGE:
|
||||
macdrv_resize_desktop();
|
||||
break;
|
||||
}
|
||||
return NtUserMessageCall(hwnd, msg, wp, lp, 0, NtUserDefWindowProc, FALSE);
|
||||
}
|
||||
|
@ -1987,27 +2010,6 @@ LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||
release_win_data(data);
|
||||
}
|
||||
return 0;
|
||||
case WM_MACDRV_UPDATE_DESKTOP_RECT:
|
||||
if (hwnd == NtUserGetDesktopWindow())
|
||||
{
|
||||
CGRect new_desktop_rect;
|
||||
RECT current_desktop_rect;
|
||||
|
||||
macdrv_reset_device_metrics();
|
||||
new_desktop_rect = macdrv_get_desktop_rect();
|
||||
if (!NtUserGetWindowRect(hwnd, ¤t_desktop_rect) ||
|
||||
!CGRectEqualToRect(cgrect_from_rect(current_desktop_rect), new_desktop_rect))
|
||||
{
|
||||
send_message_timeout(HWND_BROADCAST, WM_MACDRV_RESET_DEVICE_METRICS, 0, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL);
|
||||
NtUserSetWindowPos(hwnd, 0, CGRectGetMinX(new_desktop_rect), CGRectGetMinY(new_desktop_rect),
|
||||
CGRectGetWidth(new_desktop_rect), CGRectGetHeight(new_desktop_rect),
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE);
|
||||
send_message_timeout(HWND_BROADCAST, WM_MACDRV_DISPLAYCHANGE, 0, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
case WM_MACDRV_RESET_DEVICE_METRICS:
|
||||
macdrv_reset_device_metrics();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue