clipboard: fix clear() on macos
							parent
							
								
									7c2c187743
								
							
						
					
					
						commit
						412e2a43e9
					
				|  | @ -31,7 +31,7 @@ fn (cb &Clipboard) check_availability() bool { | ||||||
| fn (mut cb Clipboard) clear() { | fn (mut cb Clipboard) clear() { | ||||||
| 	cb.foo = 0 | 	cb.foo = 0 | ||||||
| 	cb.set_text('') | 	cb.set_text('') | ||||||
| 	#[cb->pb clearContents]; | 	//#[cb->pb clearContents];
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn (mut cb Clipboard) free() { | fn (mut cb Clipboard) free() { | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ bool darwin_set_pasteboard_text(void* _pb, string text) { | ||||||
| 	NSString *ns_clip = [[ NSString alloc ] initWithBytesNoCopy:text.str length:text.len encoding:NSUTF8StringEncoding freeWhenDone: false]; | 	NSString *ns_clip = [[ NSString alloc ] initWithBytesNoCopy:text.str length:text.len encoding:NSUTF8StringEncoding freeWhenDone: false]; | ||||||
| 	[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; | 	[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; | ||||||
| 	bool ret = [pb setString:ns_clip forType:NSStringPboardType]; | 	bool ret = [pb setString:ns_clip forType:NSStringPboardType]; | ||||||
| 	[ns_clip release]; | 	//[ns_clip release]; | ||||||
| 	int serial = [pb changeCount]; | 	int serial = [pb changeCount]; | ||||||
| 	//OSAtomicCompareAndSwapLong(cb.last_cb_serial, serial, &cb.last_cb_serial); | 	//OSAtomicCompareAndSwapLong(cb.last_cb_serial, serial, &cb.last_cb_serial); | ||||||
| 	return ret; | 	return ret; | ||||||
|  |  | ||||||
|  | @ -5,9 +5,9 @@ fn run_test(is_primary bool) { | ||||||
| 	if !cb.is_available() { | 	if !cb.is_available() { | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	//assert cb.check_ownership() == false
 | 	assert cb.check_ownership() == false | ||||||
| 	assert cb.copy('I am a good boy!') == true | 	assert cb.copy('I am a good boy!') == true | ||||||
| 	//assert cb.check_ownership() == true
 | 	// assert cb.check_ownership() == true TODO
 | ||||||
| 	assert cb.paste() == 'I am a good boy!' | 	assert cb.paste() == 'I am a good boy!' | ||||||
| 	cb.clear_all() | 	cb.clear_all() | ||||||
| 	assert cb.paste().len <= 0 | 	assert cb.paste().len <= 0 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue