diff options
| author | Eli Zaretskii | 2002-02-22 14:09:07 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2002-02-22 14:09:07 +0000 |
| commit | 3276b4fe6e4f69b9e5008b955191e1c8d345787e (patch) | |
| tree | 73929e1c366449e4d210e802d1395cf5135f76ba /src | |
| parent | 9eb532888cda113d32b5323e68cd6f464c28fa37 (diff) | |
| download | emacs-3276b4fe6e4f69b9e5008b955191e1c8d345787e.tar.gz emacs-3276b4fe6e4f69b9e5008b955191e1c8d345787e.zip | |
(Fw16_set_clipboard_data): Run pre-write-conversion
on the string before encoding it.
(Fw16_get_clipboard_data): Run post-read-conversion on the string
after decoding it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/w16select.c | 61 |
2 files changed, 39 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 579370e65cd..8ba27b3625f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2002-02-22 Eli Zaretskii <eliz@is.elta.co.il> | 1 | 2002-02-22 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 2 | ||
| 3 | * w16select.c (Fw16_set_clipboard_data): Run pre-write-conversion | ||
| 4 | on the string before encoding it. | ||
| 5 | (Fw16_get_clipboard_data): Run post-read-conversion on the string | ||
| 6 | after decoding it. | ||
| 7 | |||
| 8 | 2002-02-22 Eli Zaretskii <eliz@is.elta.co.il> | ||
| 9 | |||
| 3 | Support for ICCCM Extended Segments in X selections: | 10 | Support for ICCCM Extended Segments in X selections: |
| 4 | 11 | ||
| 5 | * xselect.c <Qcompound_text_no_extensions>: New variable. | 12 | * xselect.c <Qcompound_text_no_extensions>: New variable. |
diff --git a/src/w16select.c b/src/w16select.c index 582c5019e6f..4f8a8951567 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -492,14 +492,14 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 492 | int no_crlf_conversion; | 492 | int no_crlf_conversion; |
| 493 | 493 | ||
| 494 | CHECK_STRING (string); | 494 | CHECK_STRING (string); |
| 495 | 495 | ||
| 496 | if (NILP (frame)) | 496 | if (NILP (frame)) |
| 497 | frame = Fselected_frame (); | 497 | frame = Fselected_frame (); |
| 498 | 498 | ||
| 499 | CHECK_LIVE_FRAME (frame); | 499 | CHECK_LIVE_FRAME (frame); |
| 500 | if ( !FRAME_MSDOS_P (XFRAME (frame))) | 500 | if ( !FRAME_MSDOS_P (XFRAME (frame))) |
| 501 | goto done; | 501 | goto done; |
| 502 | 502 | ||
| 503 | BLOCK_INPUT; | 503 | BLOCK_INPUT; |
| 504 | 504 | ||
| 505 | nbytes = STRING_BYTES (XSTRING (string)); | 505 | nbytes = STRING_BYTES (XSTRING (string)); |
| @@ -528,6 +528,13 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 528 | Vnext_selection_coding_system = Vselection_coding_system; | 528 | Vnext_selection_coding_system = Vselection_coding_system; |
| 529 | setup_coding_system | 529 | setup_coding_system |
| 530 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 530 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 531 | if (SYMBOLP (coding.pre_write_conversion) | ||
| 532 | && !NILP (Ffboundp (coding.pre_write_conversion))) | ||
| 533 | { | ||
| 534 | string = run_pre_post_conversion_on_str (string, &coding, 1); | ||
| 535 | src = XSTRING (string)->data; | ||
| 536 | nbytes = STRING_BYTES (XSTRING (string)); | ||
| 537 | } | ||
| 531 | coding.src_multibyte = 1; | 538 | coding.src_multibyte = 1; |
| 532 | coding.dst_multibyte = 0; | 539 | coding.dst_multibyte = 0; |
| 533 | Vnext_selection_coding_system = Qnil; | 540 | Vnext_selection_coding_system = Qnil; |
| @@ -543,7 +550,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 543 | 550 | ||
| 544 | if (!open_clipboard ()) | 551 | if (!open_clipboard ()) |
| 545 | goto error; | 552 | goto error; |
| 546 | 553 | ||
| 547 | ok = empty_clipboard () | 554 | ok = empty_clipboard () |
| 548 | && ((put_status | 555 | && ((put_status |
| 549 | = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) | 556 | = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) |
| @@ -552,11 +559,11 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 552 | if (!no_crlf_conversion) | 559 | if (!no_crlf_conversion) |
| 553 | Vlast_coding_system_used = Qraw_text; | 560 | Vlast_coding_system_used = Qraw_text; |
| 554 | close_clipboard (); | 561 | close_clipboard (); |
| 555 | 562 | ||
| 556 | if (ok) goto unblock; | 563 | if (ok) goto unblock; |
| 557 | 564 | ||
| 558 | error: | 565 | error: |
| 559 | 566 | ||
| 560 | ok = 0; | 567 | ok = 0; |
| 561 | 568 | ||
| 562 | unblock: | 569 | unblock: |
| @@ -585,7 +592,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 585 | } | 592 | } |
| 586 | sit_for (2, 0, 0, 1, 1); | 593 | sit_for (2, 0, 0, 1, 1); |
| 587 | } | 594 | } |
| 588 | 595 | ||
| 589 | done: | 596 | done: |
| 590 | 597 | ||
| 591 | return (ok && put_status == 0 ? string : Qnil); | 598 | return (ok && put_status == 0 ? string : Qnil); |
| @@ -608,9 +615,9 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 608 | CHECK_LIVE_FRAME (frame); | 615 | CHECK_LIVE_FRAME (frame); |
| 609 | if ( !FRAME_MSDOS_P (XFRAME (frame))) | 616 | if ( !FRAME_MSDOS_P (XFRAME (frame))) |
| 610 | goto done; | 617 | goto done; |
| 611 | 618 | ||
| 612 | BLOCK_INPUT; | 619 | BLOCK_INPUT; |
| 613 | 620 | ||
| 614 | if (!open_clipboard ()) | 621 | if (!open_clipboard ()) |
| 615 | goto unblock; | 622 | goto unblock; |
| 616 | 623 | ||
| @@ -625,27 +632,20 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 625 | goto closeclip; | 632 | goto closeclip; |
| 626 | 633 | ||
| 627 | /* Do we need to decode it? */ | 634 | /* Do we need to decode it? */ |
| 628 | if ( | 635 | { |
| 629 | #if 1 | 636 | /* If the clipboard data contains any 8-bit Latin-1 code, we |
| 630 | 1 | 637 | need to decode it. */ |
| 631 | #else | 638 | int i; |
| 632 | ! NILP (buffer_defaults.enable_multibyte_characters) | 639 | |
| 633 | #endif | 640 | for (i = 0; i < truelen; i++) |
| 634 | ) | 641 | { |
| 635 | { | 642 | if (htext[i] >= 0x80) |
| 636 | /* If the clipboard data contains any 8-bit Latin-1 code, we | 643 | { |
| 637 | need to decode it. */ | 644 | require_encoding = 1; |
| 638 | int i; | 645 | break; |
| 639 | 646 | } | |
| 640 | for (i = 0; i < truelen; i++) | 647 | } |
| 641 | { | 648 | } |
| 642 | if (htext[i] >= 0x80) | ||
| 643 | { | ||
| 644 | require_encoding = 1; | ||
| 645 | break; | ||
| 646 | } | ||
| 647 | } | ||
| 648 | } | ||
| 649 | if (require_encoding) | 649 | if (require_encoding) |
| 650 | { | 650 | { |
| 651 | int bufsize; | 651 | int bufsize; |
| @@ -667,6 +667,9 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 667 | ret = make_string_from_bytes ((char *) buf, | 667 | ret = make_string_from_bytes ((char *) buf, |
| 668 | coding.produced_char, coding.produced); | 668 | coding.produced_char, coding.produced); |
| 669 | xfree (buf); | 669 | xfree (buf); |
| 670 | if (SYMBOLP (coding.post_read_conversion) | ||
| 671 | && !NILP (Ffboundp (coding.post_read_conversion))) | ||
| 672 | ret = run_pre_post_conversion_on_str (ret, coding, 0); | ||
| 670 | Vlast_coding_system_used = coding.symbol; | 673 | Vlast_coding_system_used = coding.symbol; |
| 671 | } | 674 | } |
| 672 | else | 675 | else |