winex11.drv: Force the fullscreen state update once the window is mapped

Dmitry Timoshkov dmitry at codeweavers.com
Sat Jan 6 04:45:20 CST 2007


Hello,

this patch fixes the problem reported by Vitaliy Margolen with ACDSee
image viewer. The problem is that we don't update fullscreen window state
in the case when the window already has fullscreen size, but was invisible
or offscreen and just got mapped. We need to force updating of its fullscreen
state in that case.

Changelog:
    winex11.drv: Force the fullscreen state update once the window is mapped.

---
 dlls/winex11.drv/winpos.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index ab2080b..c1eaede 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -187,7 +187,8 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
  * This only works for mapped windows.
  */
 static void update_fullscreen_state( Display *display, struct x11drv_win_data *data,
-                                     const RECT *old_client_rect, const RECT *old_screen_rect )
+                                     const RECT *old_client_rect, const RECT *old_screen_rect,
+                                     BOOL force_update_fs_state )
 {
     XEvent xev;
     BOOL old_fs_state = FALSE, new_fs_state = FALSE;
@@ -200,7 +201,14 @@ static void update_fullscreen_state( Display *display, struct x11drv_win_data *d
         data->client_rect.top <= 0 && data->client_rect.bottom >= screen_height)
         new_fs_state = TRUE;
 
-    if (new_fs_state == old_fs_state) return;
+#if 0 /* useful to debug fullscreen state problems */
+    TRACE("old rect %s, new rect %s, old screen %s, new screen (0,0-%d,%d)\n",
+           wine_dbgstr_rect(old_client_rect), wine_dbgstr_rect(&data->client_rect),
+           wine_dbgstr_rect(old_screen_rect), screen_width, screen_height);
+    TRACE("old fs state %d\n, new fs state = %d\n", old_fs_state, new_fs_state);
+#endif
+    if (new_fs_state == old_fs_state && !force_update_fs_state)
+        return;
 
     TRACE("setting fullscreen state for hwnd %p to %s\n", data->hwnd, new_fs_state ? "true" : "false");
 
@@ -352,6 +360,8 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
 
         if (data->whole_window && !data->lock_changes)
         {
+            BOOL force_update_fs_state = FALSE;
+
             if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) &&
                 X11DRV_is_window_rect_mapped( rectWindow ))
             {
@@ -364,6 +374,7 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
                     wine_tsx11_lock();
                     XMapWindow( display, data->whole_window );
                     wine_tsx11_unlock();
+                    force_update_fs_state = TRUE;
                 }
                 else if ((swp_flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE))
                 {
@@ -372,9 +383,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
                     wine_tsx11_lock();
                     XMapWindow( display, data->whole_window );
                     wine_tsx11_unlock();
+                    force_update_fs_state = TRUE;
                 }
                 SetRect( &old_screen_rect, 0, 0, screen_width, screen_height );
-                update_fullscreen_state( display, data, &old_client_rect, &old_screen_rect );
+                update_fullscreen_state( display, data, &old_client_rect, &old_screen_rect, force_update_fs_state );
             }
         }
     }
@@ -800,7 +812,7 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
     if (!(data = X11DRV_get_win_data( hwnd ))) return TRUE;
 
     if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)
-        update_fullscreen_state( display, data, &data->client_rect, &resize_data->old_screen_rect );
+        update_fullscreen_state( display, data, &data->client_rect, &resize_data->old_screen_rect, FALSE );
 
     if (resize_data->old_virtual_rect.left != virtual_screen_rect.left) mask |= CWX;
     if (resize_data->old_virtual_rect.top != virtual_screen_rect.top) mask |= CWY;
-- 
1.4.4.2






More information about the wine-patches mailing list