winex11: Add window data structure locking to the ConfigureNotify event handler.

This commit is contained in:
Alexandre Julliard 2012-09-19 13:13:23 +02:00
parent 6a4490d8ab
commit 24c0abfd40
1 changed files with 14 additions and 5 deletions

View File

@ -993,17 +993,17 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
int cx, cy, x = event->x, y = event->y; int cx, cy, x = event->x, y = event->y;
if (!hwnd) return; if (!hwnd) return;
if (!(data = X11DRV_get_win_data( hwnd ))) return; if (!(data = get_win_data( hwnd ))) return;
if (!data->mapped || data->iconic) return; if (!data->mapped || data->iconic) goto done;
if (data->whole_window && !data->managed) return; if (data->whole_window && !data->managed) goto done;
/* ignore synthetic events on foreign windows */ /* ignore synthetic events on foreign windows */
if (event->send_event && !data->whole_window) return; if (event->send_event && !data->whole_window) goto done;
if (data->configure_serial && (long)(data->configure_serial - event->serial) > 0) if (data->configure_serial && (long)(data->configure_serial - event->serial) > 0)
{ {
TRACE( "win %p/%lx event %d,%d,%dx%d ignoring old serial %lu/%lu\n", TRACE( "win %p/%lx event %d,%d,%dx%d ignoring old serial %lu/%lu\n",
hwnd, data->whole_window, event->x, event->y, event->width, event->height, hwnd, data->whole_window, event->x, event->y, event->width, event->height,
event->serial, data->configure_serial ); event->serial, data->configure_serial );
return; goto done;
} }
/* Get geometry */ /* Get geometry */
@ -1059,6 +1059,7 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
if (!IsZoomed( data->hwnd )) if (!IsZoomed( data->hwnd ))
{ {
TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window ); TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 ); SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
return; return;
} }
@ -1068,13 +1069,21 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
if (IsZoomed( data->hwnd )) if (IsZoomed( data->hwnd ))
{ {
TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window ); TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
return; return;
} }
} }
if ((flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE)) if ((flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE))
{
release_win_data( data );
SetWindowPos( hwnd, 0, x, y, cx, cy, flags ); SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
return;
}
done:
release_win_data( data );
} }