Mercurial > hg > xemacs-beta
comparison src/select-x.c @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 3ecd8885ac67 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
137 if (EQ (sym, QCUT_BUFFER7)) return XA_CUT_BUFFER7; | 137 if (EQ (sym, QCUT_BUFFER7)) return XA_CUT_BUFFER7; |
138 #endif /* CUT_BUFFER_SUPPORT */ | 138 #endif /* CUT_BUFFER_SUPPORT */ |
139 | 139 |
140 { | 140 { |
141 CONST char *nameext; | 141 CONST char *nameext; |
142 GET_C_STRING_CTEXT_DATA_ALLOCA (Fsymbol_name (sym), nameext); | 142 TO_EXTERNAL_FORMAT (LISP_STRING, Fsymbol_name (sym), |
143 C_STRING_ALLOCA, nameext, | |
144 Qctext); | |
143 return XInternAtom (display, nameext, only_if_exists ? True : False); | 145 return XInternAtom (display, nameext, only_if_exists ? True : False); |
144 } | 146 } |
145 } | 147 } |
146 | 148 |
147 | 149 |
181 if (atom == XA_CUT_BUFFER6) return QCUT_BUFFER6; | 183 if (atom == XA_CUT_BUFFER6) return QCUT_BUFFER6; |
182 if (atom == XA_CUT_BUFFER7) return QCUT_BUFFER7; | 184 if (atom == XA_CUT_BUFFER7) return QCUT_BUFFER7; |
183 #endif | 185 #endif |
184 | 186 |
185 { | 187 { |
186 Lisp_Object newsym; | 188 char *intstr; |
187 CONST Bufbyte *intstr; | |
188 char *str = XGetAtomName (display, atom); | 189 char *str = XGetAtomName (display, atom); |
189 | 190 |
190 if (! str) return Qnil; | 191 if (! str) return Qnil; |
191 | 192 |
192 GET_C_CHARPTR_INT_CTEXT_DATA_ALLOCA (str, intstr); | 193 TO_INTERNAL_FORMAT (C_STRING, str, |
193 newsym = intern ((char *) intstr); | 194 C_STRING_ALLOCA, intstr, |
195 Qctext); | |
194 XFree (str); | 196 XFree (str); |
195 return newsym; | 197 return intern (intstr); |
196 } | 198 } |
197 } | 199 } |
198 | 200 |
199 | 201 |
200 /* Do protocol to assert ourself as a selection owner. | 202 /* Do protocol to assert ourself as a selection owner. |
228 necessarily the case (e.g. under OSF on the Alphas, where | 230 necessarily the case (e.g. under OSF on the Alphas, where |
229 Time is a 64-bit quantity and time_t is a 32-bit quantity). | 231 Time is a 64-bit quantity and time_t is a 32-bit quantity). |
230 | 232 |
231 Opaque pointers are the clean way to go here. | 233 Opaque pointers are the clean way to go here. |
232 */ | 234 */ |
233 selection_time = make_opaque (sizeof (thyme), (void *) &thyme); | 235 selection_time = make_opaque (&thyme, sizeof (thyme)); |
234 | 236 |
235 #ifdef MOTIF_CLIPBOARDS | 237 #ifdef MOTIF_CLIPBOARDS |
236 hack_motif_clipboard_selection (selection_atom, selection_value, | 238 hack_motif_clipboard_selection (selection_atom, selection_value, |
237 thyme, display, selecting_window); | 239 thyme, display, selecting_window); |
238 #endif | 240 #endif |
312 chartypes = WORLD; | 314 chartypes = WORLD; |
313 break; | 315 break; |
314 } | 316 } |
315 | 317 |
316 if (chartypes == LATIN_1) | 318 if (chartypes == LATIN_1) |
317 GET_STRING_BINARY_DATA_ALLOCA (selection_value, data, bytes); | 319 TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, |
320 ALLOCA, (data, bytes), | |
321 Qbinary); | |
318 else if (chartypes == WORLD) | 322 else if (chartypes == WORLD) |
319 { | 323 { |
320 GET_STRING_CTEXT_DATA_ALLOCA (selection_value, data, bytes); | 324 TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, |
325 ALLOCA, (data, bytes), | |
326 Qctext); | |
321 encoding = "COMPOUND_TEXT"; | 327 encoding = "COMPOUND_TEXT"; |
322 } | 328 } |
323 } | 329 } |
324 #endif /* MULE */ | 330 #endif /* MULE */ |
325 | 331 |
1162 /* Convert any 8-bit data to a string, for compactness. */ | 1168 /* Convert any 8-bit data to a string, for compactness. */ |
1163 else if (format == 8) | 1169 else if (format == 8) |
1164 return make_ext_string (data, size, | 1170 return make_ext_string (data, size, |
1165 type == DEVICE_XATOM_TEXT (d) || | 1171 type == DEVICE_XATOM_TEXT (d) || |
1166 type == DEVICE_XATOM_COMPOUND_TEXT (d) | 1172 type == DEVICE_XATOM_COMPOUND_TEXT (d) |
1167 ? FORMAT_CTEXT : FORMAT_BINARY); | 1173 ? Qctext : Qbinary); |
1168 | 1174 |
1169 /* Convert a single atom to a Lisp Symbol. | 1175 /* Convert a single atom to a Lisp Symbol. |
1170 Convert a set of atoms to a vector of symbols. */ | 1176 Convert a set of atoms to a vector of symbols. */ |
1171 else if (type == XA_ATOM) | 1177 else if (type == XA_ATOM) |
1172 { | 1178 { |
1261 else if (STRINGP (obj)) | 1267 else if (STRINGP (obj)) |
1262 { | 1268 { |
1263 CONST Extbyte *extval; | 1269 CONST Extbyte *extval; |
1264 Extcount extvallen; | 1270 Extcount extvallen; |
1265 | 1271 |
1266 if (NILP (type)) | 1272 TO_EXTERNAL_FORMAT (LISP_STRING, obj, |
1267 GET_STRING_CTEXT_DATA_ALLOCA (obj, extval, extvallen); | 1273 ALLOCA, (extval, extvallen), |
1268 else | 1274 (NILP (type) ? Qctext : Qbinary)); |
1269 GET_STRING_BINARY_DATA_ALLOCA (obj, extval, extvallen); | |
1270 *format_ret = 8; | 1275 *format_ret = 8; |
1271 *size_ret = extvallen; | 1276 *size_ret = extvallen; |
1272 *data_ret = (unsigned char *) xmalloc (*size_ret); | 1277 *data_ret = (unsigned char *) xmalloc (*size_ret); |
1273 memcpy (*data_ret, extval, *size_ret); | 1278 memcpy (*data_ret, extval, *size_ret); |
1274 #ifdef MULE | 1279 #ifdef MULE |
1284 CONST Extbyte *extval; | 1289 CONST Extbyte *extval; |
1285 Extcount extvallen; | 1290 Extcount extvallen; |
1286 | 1291 |
1287 *format_ret = 8; | 1292 *format_ret = 8; |
1288 len = set_charptr_emchar (buf, XCHAR (obj)); | 1293 len = set_charptr_emchar (buf, XCHAR (obj)); |
1289 GET_CHARPTR_EXT_CTEXT_DATA_ALLOCA (buf, len, extval, extvallen); | 1294 TO_EXTERNAL_FORMAT (DATA, (buf, len), |
1295 ALLOCA, (extval, extvallen), | |
1296 Qctext); | |
1290 *size_ret = extvallen; | 1297 *size_ret = extvallen; |
1291 *data_ret = (unsigned char *) xmalloc (*size_ret); | 1298 *data_ret = (unsigned char *) xmalloc (*size_ret); |
1292 memcpy (*data_ret, extval, *size_ret); | 1299 memcpy (*data_ret, extval, *size_ret); |
1293 #ifdef MULE | 1300 #ifdef MULE |
1294 if (NILP (type)) type = QCOMPOUND_TEXT; | 1301 if (NILP (type)) type = QCOMPOUND_TEXT; |
1538 COMPOUND_TEXT that we stored there ourselves earlier, | 1545 COMPOUND_TEXT that we stored there ourselves earlier, |
1539 in x-store-cutbuffer-internal */ | 1546 in x-store-cutbuffer-internal */ |
1540 ret = (bytes ? | 1547 ret = (bytes ? |
1541 make_ext_string (data, bytes, | 1548 make_ext_string (data, bytes, |
1542 memchr (data, 0x1b, bytes) ? | 1549 memchr (data, 0x1b, bytes) ? |
1543 FORMAT_CTEXT : FORMAT_BINARY) | 1550 Qctext : Qbinary) |
1544 : Qnil); | 1551 : Qnil); |
1545 xfree (data); | 1552 xfree (data); |
1546 return ret; | 1553 return ret; |
1547 } | 1554 } |
1548 | 1555 |
1601 chartypes = WORLD; | 1608 chartypes = WORLD; |
1602 break; | 1609 break; |
1603 } | 1610 } |
1604 | 1611 |
1605 if (chartypes == LATIN_1) | 1612 if (chartypes == LATIN_1) |
1606 GET_STRING_BINARY_DATA_ALLOCA (string, data, bytes); | 1613 TO_EXTERNAL_FORMAT (LISP_STRING, string, |
1614 ALLOCA, (data, bytes), | |
1615 Qbinary); | |
1607 else if (chartypes == WORLD) | 1616 else if (chartypes == WORLD) |
1608 GET_STRING_CTEXT_DATA_ALLOCA (string, data, bytes); | 1617 TO_EXTERNAL_FORMAT (LISP_STRING, string, |
1618 ALLOCA, (data, bytes), | |
1619 Qctext); | |
1609 #endif /* MULE */ | 1620 #endif /* MULE */ |
1610 | 1621 |
1611 bytes_remaining = bytes; | 1622 bytes_remaining = bytes; |
1612 | 1623 |
1613 while (bytes_remaining) | 1624 while (bytes_remaining) |
1659 /************************************************************************/ | 1670 /************************************************************************/ |
1660 /* initialization */ | 1671 /* initialization */ |
1661 /************************************************************************/ | 1672 /************************************************************************/ |
1662 | 1673 |
1663 void | 1674 void |
1664 syms_of_xselect (void) | 1675 syms_of_select_x (void) |
1665 { | 1676 { |
1666 | 1677 |
1667 #ifdef CUT_BUFFER_SUPPORT | 1678 #ifdef CUT_BUFFER_SUPPORT |
1668 DEFSUBR (Fx_get_cutbuffer_internal); | 1679 DEFSUBR (Fx_get_cutbuffer_internal); |
1669 DEFSUBR (Fx_store_cutbuffer_internal); | 1680 DEFSUBR (Fx_store_cutbuffer_internal); |
1695 CONSOLE_HAS_METHOD (x, get_foreign_selection); | 1706 CONSOLE_HAS_METHOD (x, get_foreign_selection); |
1696 CONSOLE_HAS_METHOD (x, selection_exists_p); | 1707 CONSOLE_HAS_METHOD (x, selection_exists_p); |
1697 } | 1708 } |
1698 | 1709 |
1699 void | 1710 void |
1700 reinit_vars_of_xselect (void) | 1711 reinit_vars_of_select_x (void) |
1701 { | 1712 { |
1702 reading_selection_reply = 0; | 1713 reading_selection_reply = 0; |
1703 reading_which_selection = 0; | 1714 reading_which_selection = 0; |
1704 selection_reply_timed_out = 0; | 1715 selection_reply_timed_out = 0; |
1705 for_whom_the_bell_tolls = 0; | 1716 for_whom_the_bell_tolls = 0; |
1706 prop_location_tick = 0; | 1717 prop_location_tick = 0; |
1707 } | 1718 } |
1708 | 1719 |
1709 void | 1720 void |
1710 vars_of_xselect (void) | 1721 vars_of_select_x (void) |
1711 { | 1722 { |
1712 reinit_vars_of_xselect (); | 1723 reinit_vars_of_select_x (); |
1713 | 1724 |
1714 #ifdef CUT_BUFFER_SUPPORT | 1725 #ifdef CUT_BUFFER_SUPPORT |
1715 cut_buffers_initialized = 0; | 1726 cut_buffers_initialized = 0; |
1716 Fprovide (intern ("cut-buffer")); | 1727 Fprovide (intern ("cut-buffer")); |
1717 #endif | 1728 #endif |
1739 */ ); | 1750 */ ); |
1740 x_selection_timeout = 0; | 1751 x_selection_timeout = 0; |
1741 } | 1752 } |
1742 | 1753 |
1743 void | 1754 void |
1744 Xatoms_of_xselect (struct device *d) | 1755 Xatoms_of_select_x (struct device *d) |
1745 { | 1756 { |
1746 Display *D = DEVICE_X_DISPLAY (d); | 1757 Display *D = DEVICE_X_DISPLAY (d); |
1747 | 1758 |
1748 /* Non-predefined atoms that we might end up using a lot */ | 1759 /* Non-predefined atoms that we might end up using a lot */ |
1749 DEVICE_XATOM_CLIPBOARD (d) = XInternAtom (D, "CLIPBOARD", False); | 1760 DEVICE_XATOM_CLIPBOARD (d) = XInternAtom (D, "CLIPBOARD", False); |