Module: wine Branch: master Commit: 9fc4e5f7407b4241233a6962c025e4b6e2889037 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9fc4e5f7407b4241233a6962c0...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jan 23 12:28:32 2008 +0100
winex11: Add a mapped flag to the window data instead of relying on WS_VISIBLE.
---
dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/winpos.c | 54 +++++++++++++++------------------------------ dlls/winex11.drv/x11drv.h | 3 +- 3 files changed, 21 insertions(+), 38 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index dfaf6b9..015a57b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -882,7 +882,7 @@ void X11DRV_set_iconic_state( HWND hwnd ) XSetWMHints( display, data->whole_window, data->wm_hints ); }
- if (style & WS_VISIBLE) + if (data->mapped) { if (iconic) XIconifyWindow( display, data->whole_window, DefaultScreen(display) ); diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index ecd3104..36cab19 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -144,19 +144,21 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
if (changed & WS_VISIBLE) { - if (data->whole_window && X11DRV_is_window_rect_mapped( &data->window_rect )) + if (data->whole_window && (new_style & WS_VISIBLE) && + X11DRV_is_window_rect_mapped( &data->window_rect )) { - if (new_style & WS_VISIBLE) + X11DRV_set_wm_hints( display, data ); + if (!data->mapped) { TRACE( "mapping win %p\n", hwnd ); X11DRV_sync_window_style( display, data ); - X11DRV_set_wm_hints( display, data ); wine_tsx11_lock(); XMapWindow( display, data->whole_window ); wine_tsx11_unlock(); + data->mapped = TRUE; } - /* we don't unmap windows, that causes trouble with the window manager */ } + /* we don't unmap windows, that causes trouble with the window manager */ invalidate_dce( hwnd, &data->window_rect ); }
@@ -190,6 +192,7 @@ static void update_wm_states( Display *display, struct x11drv_win_data *data, BO XEvent xev;
if (!data->managed) return; + if (!data->mapped) return;
if (data->whole_rect.left <= 0 && data->whole_rect.right >= screen_width && data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height) @@ -351,12 +354,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, Display *display = thread_display(); struct x11drv_win_data *data; RECT old_window_rect, old_whole_rect, old_client_rect, visible_rect; - DWORD old_style, new_style; + DWORD new_style;
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
- old_style = GetWindowLongW( hwnd, GWL_STYLE ); - if (!set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags, valid_rects, &visible_rect )) return FALSE; @@ -375,12 +376,12 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, TRACE( "making win %p/%lx managed\n", hwnd, data->whole_window ); data->managed = TRUE; SetPropA( hwnd, managed_prop, (HANDLE)1 ); - if (old_style & WS_VISIBLE) + if (data->mapped) { wine_tsx11_lock(); XUnmapWindow( display, data->whole_window ); wine_tsx11_unlock(); - old_style &= ~WS_VISIBLE; /* force it to be mapped again below */ + data->mapped = FALSE; } }
@@ -451,21 +452,13 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
if (!data->whole_window || data->lock_changes) return TRUE; /* nothing more to do */
- if ((old_style & WS_VISIBLE) && !(new_style & WS_VISIBLE)) + if (data->mapped && (!(new_style & WS_VISIBLE) || !X11DRV_is_window_rect_mapped( rectWindow ))) { - /* window got hidden, unmap it */ TRACE( "unmapping win %p\n", hwnd ); wine_tsx11_lock(); XUnmapWindow( display, data->whole_window ); wine_tsx11_unlock(); - } - else if ((new_style & WS_VISIBLE) && !X11DRV_is_window_rect_mapped( rectWindow )) - { - /* resizing to zero size or off screen -> unmap */ - TRACE( "unmapping zero size or off-screen win %p\n", hwnd ); - wine_tsx11_lock(); - XUnmapWindow( display, data->whole_window ); - wine_tsx11_unlock(); + data->mapped = FALSE; }
X11DRV_sync_window_position( display, data, swp_flags, &old_client_rect, &old_whole_rect ); @@ -473,33 +466,22 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) && X11DRV_is_window_rect_mapped( rectWindow )) { - BOOL mapped = FALSE; + BOOL was_mapped = data->mapped;
- if (!(old_style & WS_VISIBLE)) - { - /* window got shown, map it */ - TRACE( "mapping win %p\n", hwnd ); - mapped = TRUE; - } - else if ((swp_flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE)) - { - /* resizing from zero size to non-zero -> map */ - TRACE( "mapping non zero size or off-screen win %p\n", hwnd ); - mapped = TRUE; - } - - if (mapped || (swp_flags & SWP_FRAMECHANGED)) + if (!data->mapped || (swp_flags & SWP_FRAMECHANGED)) X11DRV_set_wm_hints( display, data );
- if (mapped) + if (!data->mapped) { + TRACE( "mapping win %p\n", hwnd ); X11DRV_sync_window_style( display, data ); wine_tsx11_lock(); XMapWindow( display, data->whole_window ); XFlush( display ); wine_tsx11_unlock(); + data->mapped = TRUE; } - update_wm_states( display, data, mapped ); + update_wm_states( display, data, !was_mapped ); }
return TRUE; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8738d3f..5bcd76a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -672,7 +672,8 @@ struct x11drv_win_data RECT client_rect; /* client area relative to parent */ XIC xic; /* X input context */ XWMHints *wm_hints; /* window manager hints */ - BOOL managed; /* is window managed? */ + BOOL managed : 1; /* is window managed? */ + BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */ DWORD wm_state; /* bit mask of active x11drv_wm_state values */ struct dce *dce; /* DCE for CS_OWNDC or CS_CLASSDC windows */ unsigned int lock_changes; /* lock count for X11 change requests */