Mercurial > emacs
comparison src/xselect.c @ 20710:3ca65e83c8a1
(selection_data_to_lisp_data): Adjusted for the change
of decode_coding.
(lisp_data_to_selection_data): Adjusted for the change of
encode_coding.
(syms_of_xselect): Initialize clipboard-coding-system to
compound-text.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 22 Jan 1998 01:26:45 +0000 |
parents | ed9ed828415e |
children | 50929073a0ba |
comparison
equal
deleted
inserted
replaced
20709:780929dca508 | 20710:3ca65e83c8a1 |
---|---|
1491 } | 1491 } |
1492 } | 1492 } |
1493 } | 1493 } |
1494 } | 1494 } |
1495 if (!require_encoding) | 1495 if (!require_encoding) |
1496 str = make_string ((char *) data, size); | 1496 str = make_unibyte_string ((char *) data, size); |
1497 else | 1497 else |
1498 { | 1498 { |
1499 int bufsize, dummy; | 1499 int bufsize; |
1500 unsigned char *buf; | 1500 unsigned char *buf; |
1501 struct coding_system coding; | 1501 struct coding_system coding; |
1502 | 1502 |
1503 setup_coding_system | 1503 setup_coding_system |
1504 (Fcheck_coding_system(Vclipboard_coding_system), &coding); | 1504 (Fcheck_coding_system(Vclipboard_coding_system), &coding); |
1505 coding.last_block = 1; | 1505 coding.mode |= CODING_MODE_LAST_BLOCK; |
1506 bufsize = decoding_buffer_size (&coding, size); | 1506 bufsize = decoding_buffer_size (&coding, size); |
1507 buf = (unsigned char *) xmalloc (bufsize); | 1507 buf = (unsigned char *) xmalloc (bufsize); |
1508 size = decode_coding (&coding, data, buf, size, bufsize, &dummy); | 1508 decode_coding (&coding, data, buf, size, bufsize); |
1509 str = make_string ((char *) buf, size); | 1509 str = make_multibyte_string ((char *) buf, |
1510 coding.produced_char, coding.produced); | |
1510 xfree (buf); | 1511 xfree (buf); |
1511 } | 1512 } |
1512 return str; | 1513 return str; |
1513 } | 1514 } |
1514 /* Convert a single atom to a Lisp_Symbol. Convert a set of atoms to | 1515 /* Convert a single atom to a Lisp_Symbol. Convert a set of atoms to |
1628 { | 1629 { |
1629 /* We must encode contents of OBJ to compound text format. | 1630 /* We must encode contents of OBJ to compound text format. |
1630 The format is compatible with what the target `STRING' | 1631 The format is compatible with what the target `STRING' |
1631 expects if OBJ contains only ASCII and Latin-1 | 1632 expects if OBJ contains only ASCII and Latin-1 |
1632 characters. */ | 1633 characters. */ |
1633 int bufsize, dummy; | 1634 int bufsize; |
1634 unsigned char *buf; | 1635 unsigned char *buf; |
1635 struct coding_system coding; | 1636 struct coding_system coding; |
1636 | 1637 |
1637 setup_coding_system | 1638 setup_coding_system |
1638 (Fcheck_coding_system (Vclipboard_coding_system), &coding); | 1639 (Fcheck_coding_system (Vclipboard_coding_system), &coding); |
1639 coding.last_block = 1; | 1640 coding.mode |= CODING_MODE_LAST_BLOCK; |
1640 bufsize = encoding_buffer_size (&coding, *size_ret); | 1641 bufsize = encoding_buffer_size (&coding, *size_ret); |
1641 buf = (unsigned char *) xmalloc (bufsize); | 1642 buf = (unsigned char *) xmalloc (bufsize); |
1642 *size_ret = encode_coding (&coding, *data_ret, buf, | 1643 encode_coding (&coding, *data_ret, buf, *size_ret, bufsize); |
1643 *size_ret, bufsize, &dummy); | 1644 *size_ret = coding.produced; |
1644 *data_ret = buf; | 1645 *data_ret = buf; |
1645 if (charsets[charset_latin_iso8859_1] | 1646 if (charsets[charset_latin_iso8859_1] |
1646 && (num == 1 || (num == 2 && charsets[CHARSET_ASCII]))) | 1647 && (num == 1 || (num == 2 && charsets[CHARSET_ASCII]))) |
1647 { | 1648 { |
1648 /* Ok, we can return it as `STRING'. */ | 1649 /* Ok, we can return it as `STRING'. */ |
2272 | 2273 |
2273 DEFVAR_LISP ("clipboard-coding-system", &Vclipboard_coding_system, | 2274 DEFVAR_LISP ("clipboard-coding-system", &Vclipboard_coding_system, |
2274 "Coding system for communicating with other X clients.\n\ | 2275 "Coding system for communicating with other X clients.\n\ |
2275 When sending or receiving text via cut_buffer, selection, and clipboard,\n\ | 2276 When sending or receiving text via cut_buffer, selection, and clipboard,\n\ |
2276 the text is encoded or decoded by this coding system.\n\ | 2277 the text is encoded or decoded by this coding system.\n\ |
2277 A default value is `iso-latin-1'"); | 2278 A default value is `compound-text'"); |
2278 Vclipboard_coding_system=intern ("iso-latin-1"); | 2279 Vclipboard_coding_system=intern ("compound-text"); |
2279 staticpro(&Vclipboard_coding_system); | 2280 staticpro(&Vclipboard_coding_system); |
2280 | 2281 |
2281 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout, | 2282 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout, |
2282 "Number of milliseconds to wait for a selection reply.\n\ | 2283 "Number of milliseconds to wait for a selection reply.\n\ |
2283 If the selection owner doesn't reply in this time, we give up.\n\ | 2284 If the selection owner doesn't reply in this time, we give up.\n\ |