winex11: Wait for a window to move out of withdrawn state before withdrawing it again.
This commit is contained in:
parent
3b6f95c663
commit
d0e14bf709
|
@ -654,35 +654,40 @@ static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
|
||||||
/* event filter to wait for a WM_STATE change notification on a window */
|
/* event filter to wait for a WM_STATE change notification on a window */
|
||||||
static Bool is_wm_state_notify( Display *display, XEvent *event, XPointer arg )
|
static Bool is_wm_state_notify( Display *display, XEvent *event, XPointer arg )
|
||||||
{
|
{
|
||||||
return (event->type == PropertyNotify &&
|
if (event->xany.window != (Window)arg) return 0;
|
||||||
event->xproperty.window == (Window)arg &&
|
return (event->type == DestroyNotify ||
|
||||||
event->xproperty.atom == x11drv_atom(WM_STATE));
|
(event->type == PropertyNotify && event->xproperty.atom == x11drv_atom(WM_STATE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* wait_for_withdrawn_state
|
* wait_for_withdrawn_state
|
||||||
*/
|
*/
|
||||||
void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data )
|
void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set )
|
||||||
{
|
{
|
||||||
DWORD end = GetTickCount() + 2000;
|
DWORD end = GetTickCount() + 2000;
|
||||||
|
|
||||||
if (!data->whole_window || !data->managed) return;
|
if (!data->managed) return;
|
||||||
|
|
||||||
while (data->wm_state != WithdrawnState &&
|
TRACE( "waiting for window %p/%lx to become %swithdrawn\n",
|
||||||
!process_events( display, is_wm_state_notify, data->whole_window ))
|
data->hwnd, data->whole_window, set ? "" : "not " );
|
||||||
|
|
||||||
|
while (data->whole_window && ((data->wm_state == WithdrawnState) == !set))
|
||||||
{
|
{
|
||||||
struct pollfd pfd;
|
if (!process_events( display, is_wm_state_notify, data->whole_window ))
|
||||||
int timeout = end - GetTickCount();
|
|
||||||
|
|
||||||
TRACE( "waiting for window %p/%lx to become withdrawn\n", data->hwnd, data->whole_window );
|
|
||||||
pfd.fd = ConnectionNumber(display);
|
|
||||||
pfd.events = POLLIN;
|
|
||||||
if (timeout <= 0 || poll( &pfd, 1, timeout ) != 1)
|
|
||||||
{
|
{
|
||||||
FIXME( "window %p/%lx wait timed out\n", data->hwnd, data->whole_window );
|
struct pollfd pfd;
|
||||||
return;
|
int timeout = end - GetTickCount();
|
||||||
|
|
||||||
|
pfd.fd = ConnectionNumber(display);
|
||||||
|
pfd.events = POLLIN;
|
||||||
|
if (timeout <= 0 || poll( &pfd, 1, timeout ) != 1)
|
||||||
|
{
|
||||||
|
FIXME( "window %p/%lx wait timed out\n", data->hwnd, data->whole_window );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TRACE( "window %p/%lx state now %d\n", data->hwnd, data->whole_window, data->wm_state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,8 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
|
||||||
X11DRV_set_wm_hints( display, data );
|
X11DRV_set_wm_hints( display, data );
|
||||||
if (!data->mapped)
|
if (!data->mapped)
|
||||||
{
|
{
|
||||||
TRACE( "mapping win %p\n", hwnd );
|
TRACE( "mapping win %p/%lx\n", hwnd, data->whole_window );
|
||||||
wait_for_withdrawn_state( display, data );
|
wait_for_withdrawn_state( display, data, TRUE );
|
||||||
X11DRV_sync_window_style( display, data );
|
X11DRV_sync_window_style( display, data );
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XMapWindow( display, data->whole_window );
|
XMapWindow( display, data->whole_window );
|
||||||
|
@ -392,6 +392,7 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
|
||||||
if (data->mapped && (!(new_style & WS_VISIBLE) || !X11DRV_is_window_rect_mapped( rectWindow )))
|
if (data->mapped && (!(new_style & WS_VISIBLE) || !X11DRV_is_window_rect_mapped( rectWindow )))
|
||||||
{
|
{
|
||||||
TRACE( "unmapping win %p/%lx\n", hwnd, data->whole_window );
|
TRACE( "unmapping win %p/%lx\n", hwnd, data->whole_window );
|
||||||
|
wait_for_withdrawn_state( display, data, FALSE );
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) );
|
if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) );
|
||||||
else XUnmapWindow( display, data->whole_window );
|
else XUnmapWindow( display, data->whole_window );
|
||||||
|
@ -413,7 +414,7 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
|
||||||
if (!data->mapped)
|
if (!data->mapped)
|
||||||
{
|
{
|
||||||
TRACE( "mapping win %p/%lx\n", hwnd, data->whole_window );
|
TRACE( "mapping win %p/%lx\n", hwnd, data->whole_window );
|
||||||
wait_for_withdrawn_state( display, data );
|
wait_for_withdrawn_state( display, data, TRUE );
|
||||||
X11DRV_sync_window_style( display, data );
|
X11DRV_sync_window_style( display, data );
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XMapWindow( display, data->whole_window );
|
XMapWindow( display, data->whole_window );
|
||||||
|
|
|
@ -697,7 +697,7 @@ extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap par
|
||||||
extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
|
extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
|
||||||
|
|
||||||
extern int get_window_wm_state( Display *display, struct x11drv_win_data *data );
|
extern int get_window_wm_state( Display *display, struct x11drv_win_data *data );
|
||||||
extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data );
|
extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set );
|
||||||
|
|
||||||
/* X context to associate a hwnd to an X window */
|
/* X context to associate a hwnd to an X window */
|
||||||
extern XContext winContext;
|
extern XContext winContext;
|
||||||
|
|
Loading…
Reference in New Issue