forked from enlightenment/efl
ecore_cocoa_cnp: clear the clipboard only if writable
This commit is contained in:
parent
9901d392ea
commit
97252e582d
|
@ -15,16 +15,12 @@ ecore_cocoa_selection_clipboard_set(const void *data,
|
|||
Ecore_Cocoa_Cnp_Type type)
|
||||
{
|
||||
static NSMutableArray *objects = nil;
|
||||
NSPasteboard *pb;
|
||||
NSString *str = nil;
|
||||
BOOL ok = YES;
|
||||
|
||||
if (!objects)
|
||||
objects = [[NSMutableArray alloc] init];
|
||||
|
||||
pb = [NSPasteboard generalPasteboard];
|
||||
[pb clearContents];
|
||||
|
||||
if (type & ECORE_COCOA_CNP_TYPE_STRING)
|
||||
{
|
||||
str = [[NSString alloc] initWithBytes: data
|
||||
|
@ -56,6 +52,10 @@ ecore_cocoa_selection_clipboard_set(const void *data,
|
|||
/* Write to pasteboard */
|
||||
if ([objects count] > 0)
|
||||
{
|
||||
NSPasteboard *pb;
|
||||
|
||||
pb = [NSPasteboard generalPasteboard];
|
||||
[pb clearContents];
|
||||
ok = [pb writeObjects: objects];
|
||||
[objects removeAllObjects];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue