Alexandre Julliard : winex11: Map zero-size windows and set an empty window region for them.

Alexandre Julliard julliard at winehq.org
Fri May 28 09:43:12 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May 28 12:14:43 2010 +0200

winex11: Map zero-size windows and set an empty window region for them.

---

 dlls/winex11.drv/window.c |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index b85aff0..8734315 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -220,9 +220,6 @@ static BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rec
  */
 static BOOL is_window_rect_mapped( const RECT *rect )
 {
-    /* don't map if rect is empty */
-    if (IsRectEmpty( rect )) return FALSE;
-
     /* don't map if rect is off-screen */
     if (rect->left >= virtual_screen_rect.right ||
         rect->top >= virtual_screen_rect.bottom ||
@@ -249,19 +246,6 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
 
 
 /***********************************************************************
- *              get_window_owner
- */
-static HWND get_window_owner( HWND hwnd )
-{
-    RECT rect;
-    HWND owner = GetWindow( hwnd, GW_OWNER );
-    /* ignore the zero-size owners used by Delphi apps */
-    if (owner && GetWindowRect( owner, &rect ) && IsRectEmpty( &rect )) owner = 0;
-    return owner;
-}
-
-
-/***********************************************************************
  *              get_mwm_decorations
  */
 static unsigned long get_mwm_decorations( struct x11drv_win_data *data,
@@ -456,6 +440,16 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
     if (!data->whole_window) return;
     data->shaped = FALSE;
 
+    if (IsRectEmpty( &data->window_rect ))  /* set an empty shape */
+    {
+        static XRectangle empty_rect;
+        wine_tsx11_lock();
+        XShapeCombineRectangles( display, data->whole_window, ShapeBounding, 0, 0,
+                                 &empty_rect, 1, ShapeSet, YXBanded );
+        wine_tsx11_unlock();
+        return;
+    }
+
     if (hrgn == (HRGN)1)  /* hack: win_region == 1 means retrieve region from server */
     {
         if (!(hrgn = CreateRectRgn( 0, 0, 0, 0 ))) return;
@@ -1169,7 +1163,7 @@ static void set_wm_hints( Display *display, struct x11drv_win_data *data )
     {
         style = GetWindowLongW( data->hwnd, GWL_STYLE );
         ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
-        owner = get_window_owner( data->hwnd );
+        owner = GetWindow( data->hwnd, GW_OWNER );
         if ((owner_win = get_owner_whole_window( owner, data->managed ))) group_leader = owner_win;
     }
 
@@ -1260,7 +1254,7 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
         new_state |= (1 << NET_WM_STATE_ABOVE);
     if (ex_style & WS_EX_TOOLWINDOW)
         new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR) | (1 << NET_WM_STATE_SKIP_PAGER);
-    if (!(ex_style & WS_EX_APPWINDOW) && get_window_owner( data->hwnd ))
+    if (!(ex_style & WS_EX_APPWINDOW) && GetWindow( data->hwnd, GW_OWNER ))
         new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR);
 
     if (!data->mapped)  /* set the _NET_WM_STATE atom directly */
@@ -1503,6 +1497,8 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data
     XReconfigureWMWindow( display, data->whole_window,
                           DefaultScreen(display), mask, &changes );
 #ifdef HAVE_LIBXSHAPE
+    if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect ))
+        sync_window_region( display, data, (HRGN)1 );
     if (data->shaped)
     {
         int old_x_offset = old_window_rect->left - old_whole_rect->left;
@@ -1690,7 +1686,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
     sync_window_text( display, data->whole_window, text );
 
     /* set the window region */
-    if (win_rgn) sync_window_region( display, data, win_rgn );
+    if (win_rgn || IsRectEmpty( &data->window_rect )) sync_window_region( display, data, win_rgn );
 
     /* set the window opacity */
     if (!GetLayeredWindowAttributes( data->hwnd, &key, &alpha, &layered_flags )) layered_flags = 0;




More information about the wine-cvs mailing list