winex11: Only update the virtual screen rect once in xinerama_init to minimize race conditions.

This commit is contained in:
Alexandre Julliard 2008-02-06 20:38:20 +01:00
parent e14261dbb7
commit e00840cf57
1 changed files with 8 additions and 6 deletions

View File

@ -138,14 +138,15 @@ void xinerama_init( unsigned int width, unsigned int height )
{ {
MONITORINFOEXW *primary; MONITORINFOEXW *primary;
int i; int i;
RECT rect;
wine_tsx11_lock(); wine_tsx11_lock();
SetRect( &virtual_screen_rect, 0, 0, width, height ); SetRect( &rect, 0, 0, width, height );
if (root_window != DefaultRootWindow( gdi_display ) || !query_screens()) if (root_window != DefaultRootWindow( gdi_display ) || !query_screens())
{ {
default_monitor.rcWork = default_monitor.rcMonitor = virtual_screen_rect; default_monitor.rcWork = default_monitor.rcMonitor = rect;
nb_monitors = 1; nb_monitors = 1;
monitors = &default_monitor; monitors = &default_monitor;
} }
@ -153,20 +154,21 @@ void xinerama_init( unsigned int width, unsigned int height )
primary = get_primary(); primary = get_primary();
/* coordinates (0,0) have to point to the primary monitor origin */ /* coordinates (0,0) have to point to the primary monitor origin */
OffsetRect( &virtual_screen_rect, -primary->rcMonitor.left, -primary->rcMonitor.top ); OffsetRect( &rect, -primary->rcMonitor.left, -primary->rcMonitor.top );
for (i = 0; i < nb_monitors; i++) for (i = 0; i < nb_monitors; i++)
{ {
OffsetRect( &monitors[i].rcMonitor, virtual_screen_rect.left, virtual_screen_rect.top ); OffsetRect( &monitors[i].rcMonitor, rect.left, rect.top );
OffsetRect( &monitors[i].rcWork, virtual_screen_rect.left, virtual_screen_rect.top ); OffsetRect( &monitors[i].rcWork, rect.left, rect.top );
TRACE( "monitor %p: %s%s\n", TRACE( "monitor %p: %s%s\n",
index_to_monitor(i), wine_dbgstr_rect(&monitors[i].rcMonitor), index_to_monitor(i), wine_dbgstr_rect(&monitors[i].rcMonitor),
(monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? " (primary)" : "" ); (monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? " (primary)" : "" );
} }
virtual_screen_rect = rect;
screen_width = primary->rcMonitor.right - primary->rcMonitor.left; screen_width = primary->rcMonitor.right - primary->rcMonitor.left;
screen_height = primary->rcMonitor.bottom - primary->rcMonitor.top; screen_height = primary->rcMonitor.bottom - primary->rcMonitor.top;
TRACE( "virtual size: %s primary size: %dx%d\n", TRACE( "virtual size: %s primary size: %dx%d\n",
wine_dbgstr_rect(&virtual_screen_rect), screen_width, screen_height ); wine_dbgstr_rect(&rect), screen_width, screen_height );
wine_tsx11_unlock(); wine_tsx11_unlock();
ClipCursor( NULL ); /* reset the cursor clip rectangle */ ClipCursor( NULL ); /* reset the cursor clip rectangle */