mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
win32u: Move desktop resize on WM_DISPLAYCHANGE out of the drivers.
This commit is contained in:
parent
0a2ae3c41d
commit
b89c9c60d5
9 changed files with 29 additions and 76 deletions
|
@ -2979,7 +2979,32 @@ LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|||
case WM_NCCALCSIZE:
|
||||
return 0;
|
||||
case WM_DISPLAYCHANGE:
|
||||
return user_driver->pDesktopWindowProc( hwnd, msg, wparam, lparam );
|
||||
{
|
||||
static RECT virtual_rect;
|
||||
|
||||
RECT new_rect = NtUserGetVirtualScreenRect(), old_rect = virtual_rect;
|
||||
UINT context, flags = 0;
|
||||
|
||||
if (EqualRect( &new_rect, &old_rect )) return TRUE;
|
||||
virtual_rect = new_rect;
|
||||
|
||||
TRACE( "desktop %p change from %s to %s\n", hwnd, wine_dbgstr_rect( &old_rect ), wine_dbgstr_rect( &new_rect ) );
|
||||
|
||||
if (new_rect.right - new_rect.left == old_rect.right - old_rect.left &&
|
||||
new_rect.bottom - new_rect.top == old_rect.bottom - old_rect.top)
|
||||
flags |= SWP_NOSIZE;
|
||||
if (new_rect.left == old_rect.left && new_rect.top == old_rect.top)
|
||||
flags |= SWP_NOMOVE;
|
||||
|
||||
context = NtUserSetThreadDpiAwarenessContext( NTUSER_DPI_PER_MONITOR_AWARE );
|
||||
NtUserSetWindowPos( hwnd, 0, new_rect.left, new_rect.top,
|
||||
new_rect.right - new_rect.left, new_rect.bottom - new_rect.top,
|
||||
flags | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
|
||||
NtUserSetThreadDpiAwarenessContext( context );
|
||||
|
||||
return send_message_timeout( HWND_BROADCAST, WM_WINE_DESKTOP_RESIZED, old_rect.left,
|
||||
old_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE );
|
||||
}
|
||||
default:
|
||||
if (msg >= WM_USER && hwnd == get_desktop_window())
|
||||
return user_driver->pDesktopWindowProc( hwnd, msg, wparam, lparam );
|
||||
|
|
|
@ -416,7 +416,6 @@ static void pull_events(void)
|
|||
*/
|
||||
static int process_events( DWORD mask )
|
||||
{
|
||||
UINT context;
|
||||
struct java_event *event, *next, *previous;
|
||||
unsigned int count = 0;
|
||||
|
||||
|
@ -457,13 +456,9 @@ static int process_events( DWORD mask )
|
|||
{
|
||||
case DESKTOP_CHANGED:
|
||||
TRACE( "DESKTOP_CHANGED %ux%u\n", event->data.desktop.width, event->data.desktop.height );
|
||||
context = NtUserSetThreadDpiAwarenessContext( NTUSER_DPI_PER_MONITOR_AWARE );
|
||||
screen_width = event->data.desktop.width;
|
||||
screen_height = event->data.desktop.height;
|
||||
init_monitors( screen_width, screen_height );
|
||||
NtUserSetWindowPos( NtUserGetDesktopWindow(), 0, 0, 0, screen_width, screen_height,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW );
|
||||
NtUserSetThreadDpiAwarenessContext( context );
|
||||
break;
|
||||
|
||||
case CONFIG_CHANGED:
|
||||
|
|
|
@ -95,7 +95,6 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
|
|||
enum macdrv_window_messages
|
||||
{
|
||||
WM_MACDRV_SET_WIN_REGION = WM_WINE_FIRST_DRIVER_MSG,
|
||||
WM_MACDRV_DISPLAYCHANGE,
|
||||
WM_MACDRV_ACTIVATE_ON_FOLLOWING_FOCUS,
|
||||
};
|
||||
|
||||
|
@ -268,7 +267,6 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP
|
|||
extern void macdrv_status_item_mouse_move(const macdrv_event *event);
|
||||
|
||||
extern void check_retina_status(void);
|
||||
extern void macdrv_resize_desktop(void);
|
||||
extern void init_user_driver(void);
|
||||
|
||||
/* unixlib interface */
|
||||
|
|
|
@ -1575,25 +1575,6 @@ void macdrv_SetDesktopWindow(HWND hwnd)
|
|||
set_app_icon();
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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
|
||||
|
||||
LRESULT macdrv_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
|
@ -1614,9 +1595,6 @@ 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);
|
||||
}
|
||||
|
@ -2018,7 +1996,7 @@ LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||
release_win_data(data);
|
||||
}
|
||||
return 0;
|
||||
case WM_MACDRV_DISPLAYCHANGE:
|
||||
case WM_WINE_DESKTOP_RESIZED:
|
||||
macdrv_reset_device_metrics();
|
||||
macdrv_reassert_window_position(hwnd);
|
||||
return 0;
|
||||
|
|
|
@ -502,16 +502,6 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
|
|||
wayland_win_data_release(data);
|
||||
}
|
||||
|
||||
static void wayland_resize_desktop(void)
|
||||
{
|
||||
RECT virtual_rect = NtUserGetVirtualScreenRect();
|
||||
NtUserSetWindowPos(NtUserGetDesktopWindow(), 0,
|
||||
virtual_rect.left, virtual_rect.top,
|
||||
virtual_rect.right - virtual_rect.left,
|
||||
virtual_rect.bottom - virtual_rect.top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE);
|
||||
}
|
||||
|
||||
static void wayland_configure_window(HWND hwnd)
|
||||
{
|
||||
struct wayland_surface *surface;
|
||||
|
@ -652,13 +642,6 @@ LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||
*/
|
||||
LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_DISPLAYCHANGE:
|
||||
wayland_resize_desktop();
|
||||
break;
|
||||
}
|
||||
|
||||
return NtUserMessageCall(hwnd, msg, wp, lp, 0, NtUserDefWindowProc, FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,25 +100,3 @@ BOOL is_desktop_fullscreen(void)
|
|||
return (primary_rect.right - primary_rect.left == host_primary_rect.right - host_primary_rect.left &&
|
||||
primary_rect.bottom - primary_rect.top == host_primary_rect.bottom - host_primary_rect.top);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_resize_desktop
|
||||
*/
|
||||
void X11DRV_resize_desktop(void)
|
||||
{
|
||||
static RECT old_virtual_rect;
|
||||
|
||||
RECT virtual_rect = NtUserGetVirtualScreenRect();
|
||||
HWND hwnd = NtUserGetDesktopWindow();
|
||||
INT width = virtual_rect.right - virtual_rect.left, height = virtual_rect.bottom - virtual_rect.top;
|
||||
|
||||
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
|
||||
NtUserSetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top, width, height,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
|
||||
|
||||
if (old_virtual_rect.left != virtual_rect.left || old_virtual_rect.top != virtual_rect.top)
|
||||
send_message_timeout( HWND_BROADCAST, WM_X11DRV_DESKTOP_RESIZED, old_virtual_rect.left,
|
||||
old_virtual_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE );
|
||||
|
||||
old_virtual_rect = virtual_rect;
|
||||
}
|
||||
|
|
|
@ -2063,9 +2063,6 @@ LRESULT X11DRV_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
|
|||
case WM_WINE_ADD_TAB:
|
||||
send_notify_message( (HWND)wp, WM_X11DRV_ADD_TAB, 0, 0 );
|
||||
break;
|
||||
case WM_DISPLAYCHANGE:
|
||||
X11DRV_resize_desktop();
|
||||
break;
|
||||
}
|
||||
return NtUserMessageCall( hwnd, msg, wp, lp, 0, NtUserDefWindowProc, FALSE );
|
||||
}
|
||||
|
@ -3111,7 +3108,7 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
|
|||
release_win_data( data );
|
||||
}
|
||||
return 0;
|
||||
case WM_X11DRV_DESKTOP_RESIZED:
|
||||
case WM_WINE_DESKTOP_RESIZED:
|
||||
if ((data = get_win_data( hwnd )))
|
||||
{
|
||||
/* update the full screen state */
|
||||
|
|
|
@ -580,7 +580,6 @@ enum x11drv_window_messages
|
|||
{
|
||||
WM_X11DRV_UPDATE_CLIPBOARD = WM_WINE_FIRST_DRIVER_MSG,
|
||||
WM_X11DRV_SET_WIN_REGION,
|
||||
WM_X11DRV_DESKTOP_RESIZED,
|
||||
WM_X11DRV_DELETE_TAB,
|
||||
WM_X11DRV_ADD_TAB
|
||||
};
|
||||
|
@ -751,7 +750,6 @@ struct x11drv_settings_handler
|
|||
extern void X11DRV_Settings_SetHandler(const struct x11drv_settings_handler *handler);
|
||||
|
||||
extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height );
|
||||
extern void X11DRV_resize_desktop(void);
|
||||
extern BOOL is_virtual_desktop(void);
|
||||
extern BOOL is_desktop_fullscreen(void);
|
||||
extern BOOL is_detached_mode(const DEVMODEW *);
|
||||
|
|
|
@ -504,6 +504,7 @@ enum wine_internal_message
|
|||
WM_WINE_KEYBOARD_LL_HOOK,
|
||||
WM_WINE_MOUSE_LL_HOOK,
|
||||
WM_WINE_UPDATEWINDOWSTATE,
|
||||
WM_WINE_DESKTOP_RESIZED,
|
||||
WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
|
||||
WM_WINE_CLIPCURSOR = 0x80001ff0, /* internal driver notification messages */
|
||||
WM_WINE_SETCURSOR,
|
||||
|
|
Loading…
Reference in a new issue