Ken Thomases : winemac: Sync the frame of the Cocoa view for a window' s client area while handling a frame-changed event.

Alexandre Julliard julliard at winehq.org
Mon Apr 24 16:11:24 CDT 2017


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Apr 24 13:07:07 2017 -0500

winemac: Sync the frame of the Cocoa view for a window's client area while handling a frame-changed event.

Fixes a problem where the client area view would not be resized as the user
resizes the Cocoa window.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/window.c | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index 878b4dc..72dc938 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -1053,6 +1053,21 @@ RGNDATA *get_region_data(HRGN hrgn, HDC hdc_lptodp)
 
 
 /***********************************************************************
+ *              sync_client_view_position
+ */
+static void sync_client_view_position(struct macdrv_win_data *data)
+{
+    if (data->cocoa_view != data->client_cocoa_view)
+    {
+        RECT rect = data->client_rect;
+        OffsetRect(&rect, -data->whole_rect.left, -data->whole_rect.top);
+        macdrv_set_view_frame(data->client_cocoa_view, cgrect_from_rect(rect));
+        TRACE("win %p/%p client %s\n", data->hwnd, data->client_cocoa_view, wine_dbgstr_rect(&rect));
+    }
+}
+
+
+/***********************************************************************
  *              sync_window_position
  *
  * Synchronize the Mac window position with the Windows one
@@ -1098,13 +1113,7 @@ static void sync_window_position(struct macdrv_win_data *data, UINT swp_flags, c
             macdrv_set_view_frame(data->cocoa_view, frame);
     }
 
-    if (data->cocoa_view != data->client_cocoa_view)
-    {
-        RECT rect = data->client_rect;
-        OffsetRect(&rect, -data->whole_rect.left, -data->whole_rect.top);
-        macdrv_set_view_frame(data->client_cocoa_view, cgrect_from_rect(rect));
-        TRACE("win %p/%p client %s\n", data->hwnd, data->client_cocoa_view, wine_dbgstr_rect(&rect));
-    }
+    sync_client_view_position(data);
 
     if (old_window_rect && old_whole_rect &&
         (IsRectEmpty(old_window_rect) != IsRectEmpty(&data->window_rect) ||
@@ -2097,10 +2106,15 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
     }
 
     /* check if we are currently processing an event relevant to this window */
-    if (!thread_data || !thread_data->current_event ||
-        !data->cocoa_window || thread_data->current_event->window != data->cocoa_window ||
-        (thread_data->current_event->type != WINDOW_FRAME_CHANGED &&
-         thread_data->current_event->type != WINDOW_DID_UNMINIMIZE))
+    if (thread_data && thread_data->current_event &&
+        data->cocoa_window && thread_data->current_event->window == data->cocoa_window &&
+        (thread_data->current_event->type == WINDOW_FRAME_CHANGED ||
+         thread_data->current_event->type == WINDOW_DID_UNMINIMIZE))
+    {
+        if (thread_data->current_event->type == WINDOW_FRAME_CHANGED)
+            sync_client_view_position(data);
+    }
+    else
     {
         sync_window_position(data, swp_flags, &old_window_rect, &old_whole_rect);
         if (data->cocoa_window)




More information about the wine-cvs mailing list