comparison src/w16select.c @ 21707:7b76832ac019

(Fwin16_set_clipboard_data): Call UNBLOCK_INPUT before calling sit_for. (Fwin16_get_clipboard_data, Fwin16_set_clipboard_data): Balance the calls to BLOCK_INPUT and UNBLOCK_INPUT.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 22 Apr 1998 10:26:10 +0000
parents 7a310ef91b2d
children 64adf1f4d54d
comparison
equal deleted inserted replaced
21706:a0c3ee34362d 21707:7b76832ac019
417 417
418 ok = empty_clipboard () && (ok1 = set_clipboard_data (CF_TEXT, src, nbytes)); 418 ok = empty_clipboard () && (ok1 = set_clipboard_data (CF_TEXT, src, nbytes));
419 419
420 close_clipboard (); 420 close_clipboard ();
421 421
422 if (ok) goto done; 422 if (ok) goto unblock;
423 423
424 error: 424 error:
425 425
426 ok = 0; 426 ok = 0;
427
428 unblock:
429 UNBLOCK_INPUT;
427 430
428 /* Notify user if the text is too large to fit into DOS memory. 431 /* Notify user if the text is too large to fit into DOS memory.
429 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), 432 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x),
430 depending on user system configuration.) If we just silently 433 depending on user system configuration.) If we just silently
431 fail the function, people might wonder why their text sometimes 434 fail the function, people might wonder why their text sometimes
435 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); 438 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0);
436 sit_for (2, 0, 0, 1, 1); 439 sit_for (2, 0, 0, 1, 1);
437 } 440 }
438 441
439 done: 442 done:
440 UNBLOCK_INPUT;
441 443
442 return (ok ? string : Qnil); 444 return (ok ? string : Qnil);
443 } 445 }
444 446
445 DEFUN ("win16-get-clipboard-data", Fwin16_get_clipboard_data, Swin16_get_clipboard_data, 0, 1, 0, 447 DEFUN ("win16-get-clipboard-data", Fwin16_get_clipboard_data, Swin16_get_clipboard_data, 0, 1, 0,
462 goto done; 464 goto done;
463 465
464 BLOCK_INPUT; 466 BLOCK_INPUT;
465 467
466 if (!open_clipboard ()) 468 if (!open_clipboard ())
467 goto done; 469 goto unblock;
468 470
469 if ((data_size = get_clipboard_data_size (CF_TEXT)) == 0 || 471 if ((data_size = get_clipboard_data_size (CF_TEXT)) == 0 ||
470 (htext = (unsigned char *)xmalloc (data_size)) == 0) 472 (htext = (unsigned char *)xmalloc (data_size)) == 0)
471 goto closeclip; 473 goto closeclip;
472 474
479 ret = make_string (htext, truelen); 481 ret = make_string (htext, truelen);
480 xfree (htext); 482 xfree (htext);
481 483
482 closeclip: 484 closeclip:
483 close_clipboard (); 485 close_clipboard ();
486
487 unblock:
488 UNBLOCK_INPUT;
484 489
485 done: 490 done:
486 UNBLOCK_INPUT;
487 491
488 return (ret); 492 return (ret);
489 } 493 }
490 494
491 /* Support checking for a clipboard selection. */ 495 /* Support checking for a clipboard selection. */