Merge branch 'master' into jgrpp
# Conflicts: # src/console.cpp # src/os/os2/os2.cpp # src/os/unix/font_unix.cpp # src/strgen/strgen.h # src/strgen/strgen_base.cpp # src/table/settings/gui_settings.ini
This commit is contained in:
@@ -189,25 +189,21 @@ const char *GetCurrentLocale(const char *)
|
||||
/**
|
||||
* Return the contents of the clipboard (COCOA).
|
||||
*
|
||||
* @param buffer Clipboard content.
|
||||
* @param last The pointer to the last element of the destination buffer
|
||||
* @return Whether clipboard is empty or not.
|
||||
* @return The (optional) clipboard contents.
|
||||
*/
|
||||
bool GetClipboardContents(char *buffer, const char *last)
|
||||
std::optional<std::string> GetClipboardContents()
|
||||
{
|
||||
NSPasteboard *pb = [ NSPasteboard generalPasteboard ];
|
||||
NSArray *types = [ NSArray arrayWithObject:NSPasteboardTypeString ];
|
||||
NSString *bestType = [ pb availableTypeFromArray:types ];
|
||||
|
||||
/* Clipboard has no text data available. */
|
||||
if (bestType == nil) return false;
|
||||
if (bestType == nil) return std::nullopt;
|
||||
|
||||
NSString *string = [ pb stringForType:NSPasteboardTypeString ];
|
||||
if (string == nil || [ string length ] == 0) return false;
|
||||
if (string == nil || [ string length ] == 0) return std::nullopt;
|
||||
|
||||
strecpy(buffer, [ string UTF8String ], last);
|
||||
|
||||
return true;
|
||||
return [ string UTF8String ];
|
||||
}
|
||||
|
||||
/** Set the application's bundle directory.
|
||||
|
Reference in New Issue
Block a user