From ab3f5904490bd6625be79a3f1a4682c4f2731f05 Mon Sep 17 00:00:00 2001 From: Marcian Lytwyn Date: Thu, 3 Jan 2013 21:55:12 +0000 Subject: [PATCH] Fix copy/cut/paste problems git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@35931 72102866-910b-0410-8b05-ffd578937521 --- Tools/win32pbs.m | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Tools/win32pbs.m b/Tools/win32pbs.m index 7c693ab..964b6d1 100755 --- a/Tools/win32pbs.m +++ b/Tools/win32pbs.m @@ -77,7 +77,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, + (id) ownerByOsPb: (NSString*)p { - if ([p isEqual: [NSPasteboard generalPasteboard]]) + if ([p isEqual: [[NSPasteboard generalPasteboard] name]]) { return wpb; } @@ -397,12 +397,27 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, [wpb setClipboardData]; break; - case WM_RENDERALLFORMATS: - [wpb setClipboardData]; + case WM_RENDERALLFORMATS: + if (!OpenClipboard(hwnd)) + { + NSWarnMLog(@"Failed to get the Win32 clipboard. %d", GetLastError()); + } + else if (GetClipboardOwner() == hwnd) + { + if (!EmptyClipboard()) + { + NSWarnMLog(@"Failed to get the Win32 clipboard. %d", GetLastError()); + } + else + { + SendMessage(hwnd, WM_RENDERFORMAT, CF_UNICODETEXT, 0); + CloseClipboard(); + } + } break; - default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); + default: + return DefWindowProc(hwnd, uMsg, wParam, lParam); } return (LRESULT) NULL;