File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,17 @@ bool Cocoa_SetClipboardData(SDL_VideoDevice *_this)
158
158
@autoreleasepool {
159
159
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal ;
160
160
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard ];
161
+
162
+ // SetClipboardText specialization so text is available after the app quits
163
+ if (_this->clipboard_callback && _this->num_clipboard_mime_types == 1 ) {
164
+ if (SDL_strncmp (_this->clipboard_mime_types [0 ], " text/plain;charset=utf-8" , 24 ) == 0 ) {
165
+ [pasteboard declareTypes: @[ NSPasteboardTypeString ] owner: nil ];
166
+ [pasteboard setString: @((char *)_this->clipboard_userdata) forType: NSPasteboardTypeString ];
167
+ data.clipboard_count = [pasteboard changeCount ];
168
+ return true ;
169
+ }
170
+ }
171
+
161
172
NSPasteboardItem *newItem = [NSPasteboardItem new ];
162
173
NSMutableArray *utiTypes = [NSMutableArray new ];
163
174
Cocoa_PasteboardDataProvider *provider = [[Cocoa_PasteboardDataProvider alloc ] initWith: _this->clipboard_callback userData: _this->clipboard_userdata];
You can’t perform that action at this time.
0 commit comments