Alexander Scott-Johns : user32: Send a WM_DRAWCLIPBOARD message to the new viewer when SetClipboardViewer is called .

Alexandre Julliard julliard at winehq.org
Wed Sep 23 11:03:34 CDT 2009


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

Author: Alexander Scott-Johns <alexander.scott.johns at googlemail.com>
Date:   Wed Sep 23 01:35:57 2009 +0100

user32: Send a WM_DRAWCLIPBOARD message to the new viewer when SetClipboardViewer is called.

---

 dlls/user32/clipboard.c |   30 +++++++++++++++++++-----------
 dlls/user32/tests/msg.c |    4 ++--
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index ec991b8..c69d0c3 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -188,6 +188,21 @@ static BOOL CLIPBOARD_CloseClipboard(void)
     return bRet;
 }
 
+static HWND CLIPBOARD_SetClipboardViewer( HWND hWnd )
+{
+    HWND hwndPrev = 0;
+
+    SERVER_START_REQ( set_clipboard_info )
+    {
+        req->flags = SET_CB_VIEWER;
+        req->viewer = wine_server_user_handle( hWnd );
+        if (!wine_server_call_err( req ))
+            hwndPrev = wine_server_ptr_handle( reply->old_viewer );
+    }
+    SERVER_END_REQ;
+
+    return hwndPrev;
+}
 
 /**************************************************************************
  *                WIN32 Clipboard implementation
@@ -390,17 +405,10 @@ HWND WINAPI GetOpenClipboardWindow(void)
  */
 HWND WINAPI SetClipboardViewer( HWND hWnd )
 {
-    HWND hwndPrev = 0;
-
-    SERVER_START_REQ( set_clipboard_info )
-    {
-        req->flags = SET_CB_VIEWER;
-        req->viewer = wine_server_user_handle( hWnd );
-        if (!wine_server_call_err( req ))
-            hwndPrev = wine_server_ptr_handle( reply->old_viewer );
-    }
-    SERVER_END_REQ;
+    HWND hwndPrev = CLIPBOARD_SetClipboardViewer(hWnd);
 
+    if (hWnd)
+        SendMessageW(hWnd, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
     TRACE("(%p): returning %p\n", hWnd, hwndPrev);
 
     return hwndPrev;
@@ -438,7 +446,7 @@ BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
     if (hWndViewer)
     {
         if (WIN_GetFullHandle(hWnd) == hWndViewer)
-            SetClipboardViewer(WIN_GetFullHandle(hWndNext));
+            CLIPBOARD_SetClipboardViewer(WIN_GetFullHandle(hWndNext));
         else
             bRet = !SendMessageW(hWndViewer, WM_CHANGECBCHAIN, (WPARAM)hWnd, (LPARAM)hWndNext);
     }
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 517e029..9208c9d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -11813,7 +11813,7 @@ static void test_clipboard_viewers(void)
     /* Test registering hWnd1 as a viewer. */
     hRet = SetClipboardViewer(hWnd1);
     wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner();
-    ok_sequence(wm_clipboard_changed, "set viewer NULL->1", TRUE);
+    ok_sequence(wm_clipboard_changed, "set viewer NULL->1", FALSE);
     expect_HWND(NULL, hRet);
     expect_HWND(hWnd1, GetClipboardViewer());
 
@@ -11830,7 +11830,7 @@ static void test_clipboard_viewers(void)
     /* Test re-registering same window. */
     hRet = SetClipboardViewer(hWnd1);
     wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner();
-    ok_sequence(wm_clipboard_changed, "set viewer 1->1", TRUE);
+    ok_sequence(wm_clipboard_changed, "set viewer 1->1", FALSE);
     expect_HWND(hWnd1, hRet);
     expect_HWND(hWnd1, GetClipboardViewer());
 




More information about the wine-cvs mailing list