@@ -378,42 +378,45 @@ win32_read_clipboard_contents(Thread_Context *tctx, Arena *arena){
378
378
379
379
String_Const_u8 result = {};
380
380
381
+ #if 0
381
382
b32 has_text = false;
382
383
b32 has_unicode = IsClipboardFormatAvailable(CF_UNICODETEXT);
383
384
if (!has_unicode){
384
385
has_text = IsClipboardFormatAvailable(CF_TEXT);
385
386
}
386
387
b32 can_read = has_unicode || has_text;
388
+ #endif
387
389
388
- if (can_read ){
389
- if ( OpenClipboard (win32vars. window_handle )){
390
- if (has_unicode ){
391
- HANDLE clip_data = GetClipboardData (CF_UNICODETEXT);
392
- if (clip_data != 0 ){
393
- u16 *clip_16_ptr = (u16 *)GlobalLock (clip_data);
394
- if (clip_16_ptr != 0 ){
395
- String_Const_u16 clip_16 = SCu16 (clip_16_ptr);
396
- result = string_u8_from_string_u16 (arena, clip_16, StringFill_NullTerminate). string ;
397
- }
390
+ if (OpenClipboard (win32vars. window_handle ) ){
391
+ b32 got_result = false ;
392
+ if (!got_result ){
393
+ HANDLE clip_data = GetClipboardData (CF_UNICODETEXT);
394
+ if (clip_data != 0 ){
395
+ u16 *clip_16_ptr = (u16 *)GlobalLock (clip_data);
396
+ if (clip_16_ptr != 0 ){
397
+ String_Const_u16 clip_16 = SCu16 (clip_16_ptr);
398
+ got_result = true ;
399
+ result = string_u8_from_string_u16 (arena, clip_16, StringFill_NullTerminate). string ;
398
400
}
399
401
GlobalUnlock (clip_data);
400
402
}
401
- else {
402
- HANDLE clip_data = GetClipboardData (CF_TEXT);
403
- if (clip_data != 0 ){
404
- char *clip_ascii_ptr = (char *)GlobalLock (clip_data);
405
- if (clip_ascii_ptr != 0 ){
406
- String_Const_char clip_ascii = SCchar (clip_ascii_ptr);
407
- result = string_u8_from_string_char (arena, clip_ascii, StringFill_NullTerminate).string ;
408
- }
403
+ }
404
+ if (!got_result){
405
+ HANDLE clip_data = GetClipboardData (CF_TEXT);
406
+ if (clip_data != 0 ){
407
+ char *clip_ascii_ptr = (char *)GlobalLock (clip_data);
408
+ if (clip_ascii_ptr != 0 ){
409
+ String_Const_char clip_ascii = SCchar (clip_ascii_ptr);
410
+ got_result = true ;
411
+ result = string_u8_from_string_char (arena, clip_ascii, StringFill_NullTerminate).string ;
409
412
}
410
413
GlobalUnlock (clip_data);
411
414
}
412
-
413
- CloseClipboard ();
414
415
}
416
+ CloseClipboard ();
415
417
}
416
418
419
+
417
420
return (result);
418
421
}
419
422
0 commit comments