Commit bc09f081 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11.drv: Sync window positions in a WM_X11DRV_DESKTOP_RESIZED message.

After desktop is resized, instead of doing it only for the current process windows.
parent 89bb66af
......@@ -456,6 +456,8 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
*/
void X11DRV_resize_desktop(void)
{
static RECT old_virtual_rect;
RECT primary_rect, virtual_rect;
HWND hwnd = NtUserGetDesktopWindow();
INT width, height;
......@@ -468,14 +470,17 @@ void X11DRV_resize_desktop(void)
if (NtUserGetWindowThread( hwnd, NULL ) != GetCurrentThreadId())
{
send_message( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, 0 );
return;
}
else
{
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
update_desktop_fullscreen( width, height );
NtUserSetWindowPos( hwnd, 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 );
ungrab_clipping_window();
}
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
update_desktop_fullscreen( width, height );
NtUserSetWindowPos( hwnd, 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 );
ungrab_clipping_window();
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;
}
......@@ -560,47 +560,13 @@ void X11DRV_DisplayDevices_RegisterEventHandlers(void)
void X11DRV_DisplayDevices_Update(void)
{
RECT old_virtual_rect, new_virtual_rect;
DWORD tid, pid;
HWND foreground;
UINT mask = 0, i;
HWND *list;
old_virtual_rect = NtUserGetVirtualScreenRect();
X11DRV_DisplayDevices_Init(TRUE);
new_virtual_rect = NtUserGetVirtualScreenRect();
/* Calculate XReconfigureWMWindow() mask */
if (old_virtual_rect.left != new_virtual_rect.left)
mask |= CWX;
if (old_virtual_rect.top != new_virtual_rect.top)
mask |= CWY;
X11DRV_resize_desktop();
list = build_hwnd_list();
for (i = 0; list && list[i] != HWND_BOTTOM; i++)
{
struct x11drv_win_data *data;
if (!(data = get_win_data( list[i] ))) continue;
/* update the full screen state */
update_net_wm_states(data);
if (mask && data->whole_window)
{
POINT pos = virtual_screen_to_root(data->whole_rect.left, data->whole_rect.top);
XWindowChanges changes;
changes.x = pos.x;
changes.y = pos.y;
XReconfigureWMWindow(data->display, data->whole_window, data->vis.screen, mask, &changes);
}
release_win_data(data);
}
free( list );
/* forward clip_fullscreen_window request to the foreground window */
if ((foreground = NtUserGetForegroundWindow()) &&
(tid = NtUserGetWindowThread( foreground, &pid )) && pid == GetCurrentProcessId())
......
......@@ -2996,6 +2996,29 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
case WM_X11DRV_RESIZE_DESKTOP:
X11DRV_resize_desktop();
return 0;
case WM_X11DRV_DESKTOP_RESIZED:
if ((data = get_win_data( hwnd )))
{
/* update the full screen state */
update_net_wm_states( data );
if (data->whole_window)
{
/* sync window position with the new virtual screen rect */
POINT old_pos = {.x = data->whole_rect.left - wp, .y = data->whole_rect.top - lp};
POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top );
XWindowChanges changes = {.x = pos.x, .y = pos.y};
UINT mask = 0;
if (old_pos.x != pos.x) mask |= CWX;
if (old_pos.y != pos.y) mask |= CWY;
if (mask) XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes );
}
release_win_data( data );
}
return 0;
case WM_X11DRV_SET_CURSOR:
{
Window win = 0;
......
......@@ -573,6 +573,7 @@ enum x11drv_window_messages
WM_X11DRV_UPDATE_CLIPBOARD = 0x80001000,
WM_X11DRV_SET_WIN_REGION,
WM_X11DRV_RESIZE_DESKTOP,
WM_X11DRV_DESKTOP_RESIZED,
WM_X11DRV_SET_CURSOR,
WM_X11DRV_CLIP_CURSOR_NOTIFY,
WM_X11DRV_CLIP_CURSOR_REQUEST,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment