diff --git a/ChangeLog b/ChangeLog index 31b6780..14b1a66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-01-05 00:54-EST Gregory John Casamento + Merging changes made by Marcian Lytwyn + + * Tools/win32pbs.m: (+ownerByOsPb:) compare against name + instead of pasteboard object to prevent condition where + paste works only once as observed on Windows. + (MainWindowProc) Add code to handle WM_RENDERALLFORMATS as documented + on MSDN here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms649029(v=vs.85).aspx + 2012-12-31 Fred Kiefer * Source/cairo/CairoFntInfo.m (-drawGlyphs:..., -setupAttributes): diff --git a/Tools/win32pbs.m b/Tools/win32pbs.m index 7c693ab..740dc7c 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;