Ken Thomases : winemac: Convert the QUERY_RESIZE_END query to an event, WINDOW_RESIZE_ENDED.

Alexandre Julliard julliard at winehq.org
Fri Nov 1 15:17:06 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu Oct 31 19:16:42 2013 -0500

winemac: Convert the QUERY_RESIZE_END query to an event, WINDOW_RESIZE_ENDED.

Queries can be run out of order because the main thread is waiting on the
response.  The main thread didn't really need a response from QUERY_RESIZE_END.
It was only a query for symmetry with QUERY_RESIZE_START.

---

 dlls/winemac.drv/cocoa_window.m |    9 +++------
 dlls/winemac.drv/event.c        |    9 +++++----
 dlls/winemac.drv/macdrv.h       |    2 +-
 dlls/winemac.drv/macdrv_cocoa.h |    2 +-
 dlls/winemac.drv/window.c       |   25 ++++++++++++-------------
 5 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 51bcaea..dbac40a 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -1639,12 +1639,9 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
 
     - (void) windowDidEndLiveResize:(NSNotification *)notification
     {
-        macdrv_query* query = macdrv_create_query();
-        query->type = QUERY_RESIZE_END;
-        query->window = (macdrv_window)[self retain];
-
-        [self.queue query:query timeout:0.3];
-        macdrv_release_query(query);
+        macdrv_event* event = macdrv_create_event(WINDOW_RESIZE_ENDED, self);
+        [queue postEvent:event];
+        macdrv_release_event(event);
 
         self.liveResizeDisplayTimer = nil;
     }
diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c
index 5803ac7..77df582 100644
--- a/dlls/winemac.drv/event.c
+++ b/dlls/winemac.drv/event.c
@@ -55,6 +55,7 @@ static const char *dbgstr_event(int type)
         "WINDOW_GOT_FOCUS",
         "WINDOW_LOST_FOCUS",
         "WINDOW_MINIMIZE_REQUESTED",
+        "WINDOW_RESIZE_ENDED",
     };
 
     if (0 <= type && type < NUM_EVENT_TYPES) return event_names[type];
@@ -114,6 +115,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
         event_mask |= event_mask_for_type(RELEASE_CAPTURE);
         event_mask |= event_mask_for_type(WINDOW_BROUGHT_FORWARD);
         event_mask |= event_mask_for_type(WINDOW_MINIMIZE_REQUESTED);
+        event_mask |= event_mask_for_type(WINDOW_RESIZE_ENDED);
     }
 
     return event_mask;
@@ -152,10 +154,6 @@ static void macdrv_query_event(HWND hwnd, const macdrv_event *event)
             TRACE("QUERY_PASTEBOARD_DATA\n");
             success = query_pasteboard_data(hwnd, query->pasteboard_data.type);
             break;
-        case QUERY_RESIZE_END:
-            TRACE("QUERY_RESIZE_END\n");
-            success = query_resize_end(hwnd);
-            break;
         case QUERY_RESIZE_START:
             TRACE("QUERY_RESIZE_START\n");
             success = query_resize_start(hwnd);
@@ -257,6 +255,9 @@ void macdrv_handle_event(const macdrv_event *event)
     case WINDOW_MINIMIZE_REQUESTED:
         macdrv_window_minimize_requested(hwnd);
         break;
+    case WINDOW_RESIZE_ENDED:
+        macdrv_window_resize_ended(hwnd);
+        break;
     default:
         TRACE("    ignoring\n");
         break;
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 362d5ea..d49a3c0 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -165,7 +165,7 @@ extern void macdrv_app_quit_requested(const macdrv_event *event) DECLSPEC_HIDDEN
 extern void macdrv_window_minimize_requested(HWND hwnd) DECLSPEC_HIDDEN;
 extern void macdrv_window_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
 extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN;
-extern BOOL query_resize_end(HWND hwnd) DECLSPEC_HIDDEN;
+extern void macdrv_window_resize_ended(HWND hwnd) DECLSPEC_HIDDEN;
 extern BOOL query_resize_start(HWND hwnd) DECLSPEC_HIDDEN;
 extern BOOL query_min_max_info(HWND hwnd) DECLSPEC_HIDDEN;
 
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 7bc021c..e0c4f29 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -194,6 +194,7 @@ enum {
     WINDOW_GOT_FOCUS,
     WINDOW_LOST_FOCUS,
     WINDOW_MINIMIZE_REQUESTED,
+    WINDOW_RESIZE_ENDED,
     NUM_EVENT_TYPES
 };
 
@@ -290,7 +291,6 @@ enum {
     QUERY_DRAG_OPERATION,
     QUERY_IME_CHAR_RECT,
     QUERY_PASTEBOARD_DATA,
-    QUERY_RESIZE_END,
     QUERY_RESIZE_START,
     QUERY_MIN_MAX_INFO,
     NUM_QUERY_TYPES
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index 75fd523..feb4166 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -1898,6 +1898,18 @@ void macdrv_window_brought_forward(HWND hwnd)
 }
 
 
+/***********************************************************************
+ *              macdrv_window_resize_ended
+ *
+ * Handler for WINDOW_RESIZE_ENDED events.
+ */
+void macdrv_window_resize_ended(HWND hwnd)
+{
+    TRACE("hwnd %p\n", hwnd);
+    SendMessageW(hwnd, WM_EXITSIZEMOVE, 0, 0);
+}
+
+
 struct quit_info {
     HWND               *wins;
     UINT                capacity;
@@ -2082,19 +2094,6 @@ BOOL query_resize_start(HWND hwnd)
 
 
 /***********************************************************************
- *              query_resize_end
- *
- * Handler for QUERY_RESIZE_END query.
- */
-BOOL query_resize_end(HWND hwnd)
-{
-    TRACE("hwnd %p\n", hwnd);
-    SendMessageW(hwnd, WM_EXITSIZEMOVE, 0, 0);
-    return TRUE;
-}
-
-
-/***********************************************************************
  *              query_min_max_info
  *
  * Handler for QUERY_MIN_MAX_INFO query.




More information about the wine-cvs mailing list