Alexandre Julliard : winex11: Delay mapping a layered window until its attributes are set.

Alexandre Julliard julliard at winehq.org
Mon Oct 29 13:52:52 CDT 2012


Module: wine
Branch: master
Commit: 3ad40bf64732cbef4ba199a45eefa12f4b491419
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3ad40bf64732cbef4ba199a45eefa12f4b491419

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct 29 14:37:56 2012 +0100

winex11: Delay mapping a layered window until its attributes are set.

---

 dlls/winex11.drv/window.c |   21 ++++++++++++++++++++-
 dlls/winex11.drv/x11drv.h |    1 +
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 7819a54..1a9b27c 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1500,6 +1500,7 @@ void CDECL X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
 
     if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) /* changing WS_EX_LAYERED resets attributes */
     {
+        data->layered = FALSE;
         set_window_visual( data, &default_visual );
         sync_window_opacity( data->display, data->whole_window, 0, 0, 0 );
         if (data->surface) set_surface_color_key( data->surface, CLR_INVALID );
@@ -2187,10 +2188,13 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
         if (!data->mapped)
         {
             BOOL needs_icon = !data->icon_pixmap;
+            BOOL needs_map = TRUE;
 
+            /* layered windows are mapped only once their attributes are set */
+            if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) needs_map = data->layered;
             release_win_data( data );
             if (needs_icon) fetch_icon_data( hwnd, 0, 0 );
-            map_window( hwnd, new_style );
+            if (needs_map) map_window( hwnd, new_style );
             return;
         }
         else if ((swp_flags & SWP_STATECHANGED) && (!data->iconic != !(new_style & WS_MINIMIZE)))
@@ -2336,6 +2340,20 @@ void CDECL X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alph
             sync_window_opacity( data->display, data->whole_window, key, alpha, flags );
         if (data->surface)
             set_surface_color_key( data->surface, (flags & LWA_COLORKEY) ? key : CLR_INVALID );
+
+        data->layered = TRUE;
+        if (!data->mapped)  /* mapping is delayed until attributes are set */
+        {
+            DWORD style = GetWindowLongW( data->hwnd, GWL_STYLE );
+
+            if ((style & WS_VISIBLE) &&
+                ((style & WS_MINIMIZE) || is_window_rect_mapped( &data->window_rect )))
+            {
+                release_win_data( data );
+                map_window( hwnd, style );
+                return;
+            }
+        }
         release_win_data( data );
     }
     else
@@ -2371,6 +2389,7 @@ BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO
 
     if (!(data = get_win_data( hwnd ))) return FALSE;
 
+    data->layered = TRUE;
     if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual );
 
     rect = *window_rect;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 99f045f..5a34e75 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -558,6 +558,7 @@ struct x11drv_win_data
     BOOL        iconic : 1;     /* is window in iconic state? */
     BOOL        embedded : 1;   /* is window an XEMBED client? */
     BOOL        shaped : 1;     /* is window using a custom region shape? */
+    BOOL        layered : 1;    /* is window layered and with valid attributes? */
     int         wm_state;       /* current value of the WM_STATE property */
     DWORD       net_wm_state;   /* bit mask of active x11drv_net_wm_state values */
     Window      embedder;       /* window id of embedder */




More information about the wine-cvs mailing list