diff --git a/lib/betawidget/clipboard.h b/lib/betawidget/clipboard.h index c02742ef0..64df76847 100644 --- a/lib/betawidget/clipboard.h +++ b/lib/betawidget/clipboard.h @@ -25,7 +25,8 @@ /** * Returns a copy of the text in the systems clipboard. Should the clipboard be - * empty, or populated with non-textual data NULL is returned. + * empty, or populated with non-textual data NULL is returned. The character set + * of the returned is guaranteed to be UTF-8. * * It remains the responsibility of the caller to free() the string when finished * with it. @@ -35,8 +36,10 @@ char *widgetGetClipboardText(void); /** - * Attempts to set the contents of the systems clipboard to text. + * Attempts to set the contents of the systems clipboard to text. The character + * set of text must be UTF-8. * + * @param text The UTF-8 text to set the clipboard to. * @return True if the contents were successfully set, false otherwise. */ bool widgetSetClipboardText(const char *text); diff --git a/lib/betawidget/platform/sdl/clipboardOSX.m b/lib/betawidget/platform/sdl/clipboardOSX.m index 3d65d7ac1..c371a5cea 100644 --- a/lib/betawidget/platform/sdl/clipboardOSX.m +++ b/lib/betawidget/platform/sdl/clipboardOSX.m @@ -54,7 +54,7 @@ char *widgetGetClipboardText() } bool widgetSetClipboardText(const char *text) -{ +{ NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; // We are willing to provide an NSString representation only @@ -63,16 +63,19 @@ bool widgetSetClipboardText(const char *text) // Convert text to an NSString instance NSString *copyText = [[NSString alloc] initWithUTF8String:text]; + // Return status + bool ret; + // Register the data types we are willing to provide [pasteboard declareTypes:types owner:nil]; // Set the pasteboard text - [pasteboard setString:copyText forType:NSStringPboardType]; + ret = [pasteboard setString:copyText forType:NSStringPboardType]; // Clean-up [copyText release]; [pasteboard release]; [types release]; - return true; + return ret; }