summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-15 10:38:53 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-10 08:32:49 +0100
commitc17971bc807929a6cafea752d7483c97a3dd4619 (patch)
tree4320445a30f2038a07243010eb5b437f2c663c63
parent243bd5116f0e1ca414a69fc46d5c23a38e9417a0 (diff)
ecore_cocoa_cnp: clear the clipboard only if writable
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_cnp.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_cnp.m b/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
index 38da1e00cb..600c4c1a49 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
@@ -15,16 +15,12 @@ ecore_cocoa_selection_clipboard_set(const void *data,
15 Ecore_Cocoa_Cnp_Type type) 15 Ecore_Cocoa_Cnp_Type type)
16{ 16{
17 static NSMutableArray *objects = nil; 17 static NSMutableArray *objects = nil;
18 NSPasteboard *pb;
19 NSString *str = nil; 18 NSString *str = nil;
20 BOOL ok = YES; 19 BOOL ok = YES;
21 20
22 if (!objects) 21 if (!objects)
23 objects = [[NSMutableArray alloc] init]; 22 objects = [[NSMutableArray alloc] init];
24 23
25 pb = [NSPasteboard generalPasteboard];
26 [pb clearContents];
27
28 if (type & ECORE_COCOA_CNP_TYPE_STRING) 24 if (type & ECORE_COCOA_CNP_TYPE_STRING)
29 { 25 {
30 str = [[NSString alloc] initWithBytes: data 26 str = [[NSString alloc] initWithBytes: data
@@ -56,6 +52,10 @@ ecore_cocoa_selection_clipboard_set(const void *data,
56 /* Write to pasteboard */ 52 /* Write to pasteboard */
57 if ([objects count] > 0) 53 if ([objects count] > 0)
58 { 54 {
55 NSPasteboard *pb;
56
57 pb = [NSPasteboard generalPasteboard];
58 [pb clearContents];
59 ok = [pb writeObjects: objects]; 59 ok = [pb writeObjects: objects];
60 [objects removeAllObjects]; 60 [objects removeAllObjects];
61 } 61 }