Alexandre Julliard : user32: Remove some unnecessary clipboard helper functions.

Alexandre Julliard julliard at wine.codeweavers.com
Wed May 27 09:30:58 CDT 2015


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 27 17:42:59 2015 +0900

user32: Remove some unnecessary clipboard helper functions.

---

 dlls/user32/clipboard.c | 84 ++++++++++++++-----------------------------------
 1 file changed, 24 insertions(+), 60 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index eb9f559..de1ec60 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -61,8 +61,6 @@ typedef struct
 {
     HWND hWndOpen;
     HWND hWndOwner;
-    HWND hWndViewer;
-    UINT seqno;
     UINT flags;
 } CLIPBOARDINFO, *LPCLIPBOARDINFO;
 
@@ -111,8 +109,6 @@ static BOOL CLIPBOARD_GetClipboardInfo(LPCLIPBOARDINFO cbInfo)
         {
             cbInfo->hWndOpen = wine_server_ptr_handle( reply->old_clipboard );
             cbInfo->hWndOwner = wine_server_ptr_handle( reply->old_owner );
-            cbInfo->hWndViewer = wine_server_ptr_handle( reply->old_viewer );
-            cbInfo->seqno = reply->seqno;
             cbInfo->flags = reply->flags;
         }
     }
@@ -149,45 +145,6 @@ BOOL CLIPBOARD_ReleaseOwner(void)
 
 
 /**************************************************************************
- *		CLIPBOARD_OpenClipboard
- */
-static BOOL CLIPBOARD_OpenClipboard(HWND hWnd)
-{
-    BOOL bRet;
-
-    SERVER_START_REQ( set_clipboard_info )
-    {
-        req->flags = SET_CB_OPEN;
-        req->clipboard = wine_server_user_handle( hWnd );
-        bRet = !wine_server_call( req );
-    }
-    SERVER_END_REQ;
-
-    return bRet;
-}
-
-
-/**************************************************************************
- *		CLIPBOARD_CloseClipboard
- */
-static BOOL CLIPBOARD_CloseClipboard(void)
-{
-    BOOL bRet;
-
-    TRACE(" Changed=%d\n", bCBHasChanged);
-
-    SERVER_START_REQ( set_clipboard_info )
-    {
-        req->flags = SET_CB_CLOSE;
-        if (bCBHasChanged) req->flags |= SET_CB_SEQNO;
-        bRet = !wine_server_call_err( req );
-    }
-    SERVER_END_REQ;
-
-    return bRet;
-}
-
-/**************************************************************************
  *		CLIPBOARD_SetClipboardViewer
  */
 static HWND CLIPBOARD_SetClipboardViewer( HWND hWnd )
@@ -259,7 +216,13 @@ BOOL WINAPI OpenClipboard( HWND hWnd )
 
     TRACE("(%p)...\n", hWnd);
 
-    bRet = CLIPBOARD_OpenClipboard(hWnd);
+    SERVER_START_REQ( set_clipboard_info )
+    {
+        req->flags = SET_CB_OPEN;
+        req->clipboard = wine_server_user_handle( hWnd );
+        bRet = !wine_server_call( req );
+    }
+    SERVER_END_REQ;
 
     TRACE(" returning %i\n", bRet);
 
@@ -272,28 +235,29 @@ BOOL WINAPI OpenClipboard( HWND hWnd )
  */
 BOOL WINAPI CloseClipboard(void)
 {
-    BOOL bRet = FALSE;
+    HWND viewer = 0;
+    BOOL ret;
 
     TRACE("() Changed=%d\n", bCBHasChanged);
 
-    if (CLIPBOARD_CloseClipboard())
+    SERVER_START_REQ( set_clipboard_info )
     {
-        if (bCBHasChanged)
-        {
-            HWND hWndViewer = GetClipboardViewer();
-
-            USER_Driver->pEndClipboardUpdate();
-
-            bCBHasChanged = FALSE;
+        req->flags = SET_CB_CLOSE;
+        if (bCBHasChanged) req->flags |= SET_CB_SEQNO;
+        if ((ret = !wine_server_call_err( req )))
+            viewer = wine_server_ptr_handle( reply->old_viewer );
+    }
+    SERVER_END_REQ;
 
-            if (hWndViewer)
-                SendNotifyMessageW(hWndViewer, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
-        }
+    if (!ret) return FALSE;
 
-        bRet = TRUE;
+    if (bCBHasChanged)
+    {
+        USER_Driver->pEndClipboardUpdate();
+        bCBHasChanged = FALSE;
+        if (viewer) SendNotifyMessageW(viewer, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
     }
-
-    return bRet;
+    return TRUE;
 }
 
 
@@ -326,7 +290,7 @@ BOOL WINAPI EmptyClipboard(void)
      * this before acquiring the selection so that when we do acquire the
      * selection and the selection loser gets notified, it can check if
      * it has lost the Wine clipboard ownership. If it did then it knows
-     * that a WM_DESTORYCLIPBOARD has already been sent. Otherwise it
+     * that a WM_DESTROYCLIPBOARD has already been sent. Otherwise it
      * lost the selection to a X app and it should send the
      * WM_DESTROYCLIPBOARD itself. */
     CLIPBOARD_SetClipboardOwner(cbinfo.hWndOpen);




More information about the wine-cvs mailing list