Mercurial > emacs
comparison src/xselect.c @ 45672:1f957476e757
(lisp_data_to_selection_data): Fix last change:
*data_ret is not a Lisp string, while unibyte_string is.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Fri, 07 Jun 2002 22:05:07 +0000 |
parents | 07c921daa0f8 |
children | 5be0ff42cd30 |
comparison
equal
deleted
inserted
replaced
45671:a2a919ea2b23 | 45672:1f957476e757 |
---|---|
114 static Lisp_Object Vnext_selection_coding_system; | 114 static Lisp_Object Vnext_selection_coding_system; |
115 | 115 |
116 /* If this is a smaller number than the max-request-size of the display, | 116 /* If this is a smaller number than the max-request-size of the display, |
117 emacs will use INCR selection transfer when the selection is larger | 117 emacs will use INCR selection transfer when the selection is larger |
118 than this. The max-request-size is usually around 64k, so if you want | 118 than this. The max-request-size is usually around 64k, so if you want |
119 emacs to use incremental selection transfers when the selection is | 119 emacs to use incremental selection transfers when the selection is |
120 smaller than that, set this. I added this mostly for debugging the | 120 smaller than that, set this. I added this mostly for debugging the |
121 incremental transfer stuff, but it might improve server performance. */ | 121 incremental transfer stuff, but it might improve server performance. */ |
122 #define MAX_SELECTION_QUANTUM 0xFFFFFF | 122 #define MAX_SELECTION_QUANTUM 0xFFFFFF |
123 | 123 |
124 #ifdef HAVE_X11R4 | 124 #ifdef HAVE_X11R4 |
145 selection-values. */ | 145 selection-values. */ |
146 static Lisp_Object Vselection_alist; | 146 static Lisp_Object Vselection_alist; |
147 | 147 |
148 /* This is an alist whose CARs are selection-types (whose names are the same | 148 /* This is an alist whose CARs are selection-types (whose names are the same |
149 as the names of X Atoms) and whose CDRs are the names of Lisp functions to | 149 as the names of X Atoms) and whose CDRs are the names of Lisp functions to |
150 call to convert the given Emacs selection value to a string representing | 150 call to convert the given Emacs selection value to a string representing |
151 the given selection type. This is for Lisp-level extension of the emacs | 151 the given selection type. This is for Lisp-level extension of the emacs |
152 selection handling. */ | 152 selection handling. */ |
153 static Lisp_Object Vselection_converter_alist; | 153 static Lisp_Object Vselection_converter_alist; |
154 | 154 |
155 /* If the selection owner takes too long to reply to a selection request, | 155 /* If the selection owner takes too long to reply to a selection request, |
160 | 160 |
161 static void lisp_data_to_selection_data (); | 161 static void lisp_data_to_selection_data (); |
162 static Lisp_Object selection_data_to_lisp_data (); | 162 static Lisp_Object selection_data_to_lisp_data (); |
163 static Lisp_Object x_get_window_property_as_lisp_data (); | 163 static Lisp_Object x_get_window_property_as_lisp_data (); |
164 | 164 |
165 /* This converts a Lisp symbol to a server Atom, avoiding a server | 165 /* This converts a Lisp symbol to a server Atom, avoiding a server |
166 roundtrip whenever possible. */ | 166 roundtrip whenever possible. */ |
167 | 167 |
168 static Atom | 168 static Atom |
169 symbol_to_x_atom (dpyinfo, display, sym) | 169 symbol_to_x_atom (dpyinfo, display, sym) |
170 struct x_display_info *dpyinfo; | 170 struct x_display_info *dpyinfo; |
217 Atom atom; | 217 Atom atom; |
218 { | 218 { |
219 struct x_display_info *dpyinfo; | 219 struct x_display_info *dpyinfo; |
220 char *str; | 220 char *str; |
221 Lisp_Object val; | 221 Lisp_Object val; |
222 | 222 |
223 if (! atom) | 223 if (! atom) |
224 return Qnil; | 224 return Qnil; |
225 | 225 |
226 switch (atom) | 226 switch (atom) |
227 { | 227 { |
228 case XA_PRIMARY: | 228 case XA_PRIMARY: |
229 return QPRIMARY; | 229 return QPRIMARY; |
230 case XA_SECONDARY: | 230 case XA_SECONDARY: |
289 UNBLOCK_INPUT; | 289 UNBLOCK_INPUT; |
290 return val; | 290 return val; |
291 } | 291 } |
292 | 292 |
293 /* Do protocol to assert ourself as a selection owner. | 293 /* Do protocol to assert ourself as a selection owner. |
294 Update the Vselection_alist so that we can reply to later requests for | 294 Update the Vselection_alist so that we can reply to later requests for |
295 our selection. */ | 295 our selection. */ |
296 | 296 |
297 static void | 297 static void |
298 x_own_selection (selection_name, selection_value) | 298 x_own_selection (selection_name, selection_value) |
299 Lisp_Object selection_name, selection_value; | 299 Lisp_Object selection_name, selection_value; |
434 check = value; | 434 check = value; |
435 if (CONSP (value) | 435 if (CONSP (value) |
436 && SYMBOLP (XCAR (value))) | 436 && SYMBOLP (XCAR (value))) |
437 type = XCAR (value), | 437 type = XCAR (value), |
438 check = XCDR (value); | 438 check = XCDR (value); |
439 | 439 |
440 if (STRINGP (check) | 440 if (STRINGP (check) |
441 || VECTORP (check) | 441 || VECTORP (check) |
442 || SYMBOLP (check) | 442 || SYMBOLP (check) |
443 || INTEGERP (check) | 443 || INTEGERP (check) |
444 || NILP (value)) | 444 || NILP (value)) |
468 x_decline_selection_request (event) | 468 x_decline_selection_request (event) |
469 struct input_event *event; | 469 struct input_event *event; |
470 { | 470 { |
471 XSelectionEvent reply; | 471 XSelectionEvent reply; |
472 int count; | 472 int count; |
473 | 473 |
474 reply.type = SelectionNotify; | 474 reply.type = SelectionNotify; |
475 reply.display = SELECTION_EVENT_DISPLAY (event); | 475 reply.display = SELECTION_EVENT_DISPLAY (event); |
476 reply.requestor = SELECTION_EVENT_REQUESTOR (event); | 476 reply.requestor = SELECTION_EVENT_REQUESTOR (event); |
477 reply.selection = SELECTION_EVENT_SELECTION (event); | 477 reply.selection = SELECTION_EVENT_SELECTION (event); |
478 reply.time = SELECTION_EVENT_TIME (event); | 478 reply.time = SELECTION_EVENT_TIME (event); |
642 frame); | 642 frame); |
643 } | 643 } |
644 | 644 |
645 if (x_window_to_frame (dpyinfo, window)) /* #### debug */ | 645 if (x_window_to_frame (dpyinfo, window)) /* #### debug */ |
646 error ("Attempt to transfer an INCR to ourself!"); | 646 error ("Attempt to transfer an INCR to ourself!"); |
647 | 647 |
648 TRACE2 ("Start sending %d bytes incrementally (%s)", | 648 TRACE2 ("Start sending %d bytes incrementally (%s)", |
649 bytes_remaining, XGetAtomName (display, reply.property)); | 649 bytes_remaining, XGetAtomName (display, reply.property)); |
650 wait_object = expect_property_change (display, window, reply.property, | 650 wait_object = expect_property_change (display, window, reply.property, |
651 PropertyDelete); | 651 PropertyDelete); |
652 | 652 |
654 XGetAtomName (display, reply.property)); | 654 XGetAtomName (display, reply.property)); |
655 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR, | 655 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR, |
656 32, PropModeReplace, | 656 32, PropModeReplace, |
657 (unsigned char *) &bytes_remaining, 1); | 657 (unsigned char *) &bytes_remaining, 1); |
658 XSelectInput (display, window, PropertyChangeMask); | 658 XSelectInput (display, window, PropertyChangeMask); |
659 | 659 |
660 /* Tell 'em the INCR data is there... */ | 660 /* Tell 'em the INCR data is there... */ |
661 TRACE0 ("Send SelectionNotify event"); | 661 TRACE0 ("Send SelectionNotify event"); |
662 XSendEvent (display, window, False, 0L, (XEvent *) &reply); | 662 XSendEvent (display, window, False, 0L, (XEvent *) &reply); |
663 XFlush (display); | 663 XFlush (display); |
664 | 664 |
688 PropertyDelete); | 688 PropertyDelete); |
689 | 689 |
690 TRACE1 ("Sending increment of %d bytes", i); | 690 TRACE1 ("Sending increment of %d bytes", i); |
691 TRACE1 ("Set %s to increment data", | 691 TRACE1 ("Set %s to increment data", |
692 XGetAtomName (display, reply.property)); | 692 XGetAtomName (display, reply.property)); |
693 | 693 |
694 /* Append the next chunk of data to the property. */ | 694 /* Append the next chunk of data to the property. */ |
695 XChangeProperty (display, window, reply.property, type, format, | 695 XChangeProperty (display, window, reply.property, type, format, |
696 PropModeAppend, data, i / format_bytes); | 696 PropModeAppend, data, i / format_bytes); |
697 bytes_remaining -= i; | 697 bytes_remaining -= i; |
698 data += i; | 698 data += i; |
707 property. This can run random lisp code or signal. */ | 707 property. This can run random lisp code or signal. */ |
708 TRACE1 ("Waiting for increment ACK (deletion of %s)", | 708 TRACE1 ("Waiting for increment ACK (deletion of %s)", |
709 XGetAtomName (display, reply.property)); | 709 XGetAtomName (display, reply.property)); |
710 wait_for_property_change (wait_object); | 710 wait_for_property_change (wait_object); |
711 } | 711 } |
712 | 712 |
713 /* Now write a zero-length chunk to the property to tell the | 713 /* Now write a zero-length chunk to the property to tell the |
714 requester that we're done. */ | 714 requester that we're done. */ |
715 BLOCK_INPUT; | 715 BLOCK_INPUT; |
716 if (! waiting_for_other_props_on_window (display, window)) | 716 if (! waiting_for_other_props_on_window (display, window)) |
717 XSelectInput (display, window, 0L); | 717 XSelectInput (display, window, 0L); |
795 | 795 |
796 #if 0 /* #### MULTIPLE doesn't work yet */ | 796 #if 0 /* #### MULTIPLE doesn't work yet */ |
797 if (EQ (target_symbol, QMULTIPLE)) | 797 if (EQ (target_symbol, QMULTIPLE)) |
798 target_symbol = fetch_multiple_target (event); | 798 target_symbol = fetch_multiple_target (event); |
799 #endif | 799 #endif |
800 | 800 |
801 /* Convert lisp objects back into binary data */ | 801 /* Convert lisp objects back into binary data */ |
802 | 802 |
803 converted_selection | 803 converted_selection |
804 = x_get_local_selection (selection_symbol, target_symbol); | 804 = x_get_local_selection (selection_symbol, target_symbol); |
805 | 805 |
806 if (! NILP (converted_selection)) | 806 if (! NILP (converted_selection)) |
807 { | 807 { |
808 unsigned char *data; | 808 unsigned char *data; |
809 unsigned int size; | 809 unsigned int size; |
810 int format; | 810 int format; |
812 int nofree; | 812 int nofree; |
813 | 813 |
814 lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event), | 814 lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event), |
815 converted_selection, | 815 converted_selection, |
816 &data, &type, &size, &format, &nofree); | 816 &data, &type, &size, &format, &nofree); |
817 | 817 |
818 x_reply_selection_request (event, format, data, size, type); | 818 x_reply_selection_request (event, format, data, size, type); |
819 successful_p = Qt; | 819 successful_p = Qt; |
820 | 820 |
821 /* Indicate we have successfully processed this event. */ | 821 /* Indicate we have successfully processed this event. */ |
822 x_selection_current_request = 0; | 822 x_selection_current_request = 0; |
851 struct input_event *event; | 851 struct input_event *event; |
852 { | 852 { |
853 Display *display = SELECTION_EVENT_DISPLAY (event); | 853 Display *display = SELECTION_EVENT_DISPLAY (event); |
854 Atom selection = SELECTION_EVENT_SELECTION (event); | 854 Atom selection = SELECTION_EVENT_SELECTION (event); |
855 Time changed_owner_time = SELECTION_EVENT_TIME (event); | 855 Time changed_owner_time = SELECTION_EVENT_TIME (event); |
856 | 856 |
857 Lisp_Object selection_symbol, local_selection_data; | 857 Lisp_Object selection_symbol, local_selection_data; |
858 Time local_selection_time; | 858 Time local_selection_time; |
859 struct x_display_info *dpyinfo = x_display_info_for_display (display); | 859 struct x_display_info *dpyinfo = x_display_info_for_display (display); |
860 struct x_display_info *t_dpyinfo; | 860 struct x_display_info *t_dpyinfo; |
861 | 861 |
1137 else | 1137 else |
1138 property_change_wait_list = rest->next; | 1138 property_change_wait_list = rest->next; |
1139 xfree (rest); | 1139 xfree (rest); |
1140 return; | 1140 return; |
1141 } | 1141 } |
1142 | 1142 |
1143 prev = rest; | 1143 prev = rest; |
1144 rest = rest->next; | 1144 rest = rest->next; |
1145 } | 1145 } |
1146 } | 1146 } |
1147 | 1147 |
1172 Lisp_Object vec; | 1172 Lisp_Object vec; |
1173 int i; | 1173 int i; |
1174 int size; | 1174 int size; |
1175 if (CONSP (obj)) | 1175 if (CONSP (obj)) |
1176 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj))); | 1176 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj))); |
1177 | 1177 |
1178 CHECK_VECTOR (obj); | 1178 CHECK_VECTOR (obj); |
1179 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); | 1179 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); |
1180 for (i = 0; i < size; i++) | 1180 for (i = 0; i < size; i++) |
1181 { | 1181 { |
1182 Lisp_Object vec2 = XVECTOR (obj)->contents [i]; | 1182 Lisp_Object vec2 = XVECTOR (obj)->contents [i]; |
1225 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); | 1225 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); |
1226 else | 1226 else |
1227 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); | 1227 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); |
1228 | 1228 |
1229 BLOCK_INPUT; | 1229 BLOCK_INPUT; |
1230 | 1230 |
1231 count = x_catch_errors (display); | 1231 count = x_catch_errors (display); |
1232 | 1232 |
1233 TRACE2 ("Get selection %s, type %s", | 1233 TRACE2 ("Get selection %s, type %s", |
1234 XGetAtomName (display, type_atom), | 1234 XGetAtomName (display, type_atom), |
1235 XGetAtomName (display, target_property)); | 1235 XGetAtomName (display, target_property)); |
1236 | 1236 |
1237 XConvertSelection (display, selection_atom, type_atom, target_property, | 1237 XConvertSelection (display, selection_atom, type_atom, target_property, |
1303 unsigned long bytes_remaining; | 1303 unsigned long bytes_remaining; |
1304 int offset = 0; | 1304 int offset = 0; |
1305 unsigned char *tmp_data = 0; | 1305 unsigned char *tmp_data = 0; |
1306 int result; | 1306 int result; |
1307 int buffer_size = SELECTION_QUANTUM (display); | 1307 int buffer_size = SELECTION_QUANTUM (display); |
1308 | 1308 |
1309 if (buffer_size > MAX_SELECTION_QUANTUM) | 1309 if (buffer_size > MAX_SELECTION_QUANTUM) |
1310 buffer_size = MAX_SELECTION_QUANTUM; | 1310 buffer_size = MAX_SELECTION_QUANTUM; |
1311 | 1311 |
1312 BLOCK_INPUT; | 1312 BLOCK_INPUT; |
1313 | 1313 |
1314 /* First probe the thing to find out how big it is. */ | 1314 /* First probe the thing to find out how big it is. */ |
1315 result = XGetWindowProperty (display, window, property, | 1315 result = XGetWindowProperty (display, window, property, |
1316 0L, 0L, False, AnyPropertyType, | 1316 0L, 0L, False, AnyPropertyType, |
1317 actual_type_ret, actual_format_ret, | 1317 actual_type_ret, actual_format_ret, |
1318 actual_size_ret, | 1318 actual_size_ret, |
1322 UNBLOCK_INPUT; | 1322 UNBLOCK_INPUT; |
1323 *data_ret = 0; | 1323 *data_ret = 0; |
1324 *bytes_ret = 0; | 1324 *bytes_ret = 0; |
1325 return; | 1325 return; |
1326 } | 1326 } |
1327 | 1327 |
1328 /* This was allocated by Xlib, so use XFree. */ | 1328 /* This was allocated by Xlib, so use XFree. */ |
1329 XFree ((char *) tmp_data); | 1329 XFree ((char *) tmp_data); |
1330 | 1330 |
1331 if (*actual_type_ret == None || *actual_format_ret == 0) | 1331 if (*actual_type_ret == None || *actual_format_ret == 0) |
1332 { | 1332 { |
1333 UNBLOCK_INPUT; | 1333 UNBLOCK_INPUT; |
1334 return; | 1334 return; |
1335 } | 1335 } |
1336 | 1336 |
1337 total_size = bytes_remaining + 1; | 1337 total_size = bytes_remaining + 1; |
1338 *data_ret = (unsigned char *) xmalloc (total_size); | 1338 *data_ret = (unsigned char *) xmalloc (total_size); |
1339 | 1339 |
1340 /* Now read, until we've gotten it all. */ | 1340 /* Now read, until we've gotten it all. */ |
1341 while (bytes_remaining) | 1341 while (bytes_remaining) |
1342 { | 1342 { |
1343 #ifdef TRACE_SELECTION | 1343 #ifdef TRACE_SELECTION |
1344 int last = bytes_remaining; | 1344 int last = bytes_remaining; |
1361 if (result != Success) | 1361 if (result != Success) |
1362 break; | 1362 break; |
1363 *actual_size_ret *= *actual_format_ret / 8; | 1363 *actual_size_ret *= *actual_format_ret / 8; |
1364 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); | 1364 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); |
1365 offset += *actual_size_ret; | 1365 offset += *actual_size_ret; |
1366 | 1366 |
1367 /* This was allocated by Xlib, so use XFree. */ | 1367 /* This was allocated by Xlib, so use XFree. */ |
1368 XFree ((char *) tmp_data); | 1368 XFree ((char *) tmp_data); |
1369 } | 1369 } |
1370 | 1370 |
1371 XFlush (display); | 1371 XFlush (display); |
1422 unsigned char *tmp_data; | 1422 unsigned char *tmp_data; |
1423 int tmp_size_bytes; | 1423 int tmp_size_bytes; |
1424 | 1424 |
1425 TRACE0 (" Wait for property change"); | 1425 TRACE0 (" Wait for property change"); |
1426 wait_for_property_change (wait_object); | 1426 wait_for_property_change (wait_object); |
1427 | 1427 |
1428 /* expect it again immediately, because x_get_window_property may | 1428 /* expect it again immediately, because x_get_window_property may |
1429 .. no it won't, I don't get it. | 1429 .. no it won't, I don't get it. |
1430 .. Ok, I get it now, the Xt code that implements INCR is broken. */ | 1430 .. Ok, I get it now, the Xt code that implements INCR is broken. */ |
1431 TRACE0 (" Get property value"); | 1431 TRACE0 (" Get property value"); |
1432 x_get_window_property (display, window, property, | 1432 x_get_window_property (display, window, property, |
1460 if (*size_bytes_ret < offset + tmp_size_bytes) | 1460 if (*size_bytes_ret < offset + tmp_size_bytes) |
1461 { | 1461 { |
1462 *size_bytes_ret = offset + tmp_size_bytes; | 1462 *size_bytes_ret = offset + tmp_size_bytes; |
1463 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); | 1463 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); |
1464 } | 1464 } |
1465 | 1465 |
1466 bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); | 1466 bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); |
1467 offset += tmp_size_bytes; | 1467 offset += tmp_size_bytes; |
1468 | 1468 |
1469 /* Use xfree, not XFree, because x_get_window_property | 1469 /* Use xfree, not XFree, because x_get_window_property |
1470 calls xmalloc itself. */ | 1470 calls xmalloc itself. */ |
1471 xfree (tmp_data); | 1471 xfree (tmp_data); |
1472 } | 1472 } |
1473 } | 1473 } |
1517 : Fcons (build_string ("no selection"), | 1517 : Fcons (build_string ("no selection"), |
1518 Fcons (x_atom_to_symbol (display, | 1518 Fcons (x_atom_to_symbol (display, |
1519 selection_atom), | 1519 selection_atom), |
1520 Qnil))); | 1520 Qnil))); |
1521 } | 1521 } |
1522 | 1522 |
1523 if (actual_type == dpyinfo->Xatom_INCR) | 1523 if (actual_type == dpyinfo->Xatom_INCR) |
1524 { | 1524 { |
1525 /* That wasn't really the data, just the beginning. */ | 1525 /* That wasn't really the data, just the beginning. */ |
1526 | 1526 |
1527 unsigned int min_size_bytes = * ((unsigned int *) data); | 1527 unsigned int min_size_bytes = * ((unsigned int *) data); |
1544 | 1544 |
1545 /* It's been read. Now convert it to a lisp object in some semi-rational | 1545 /* It's been read. Now convert it to a lisp object in some semi-rational |
1546 manner. */ | 1546 manner. */ |
1547 val = selection_data_to_lisp_data (display, data, bytes, | 1547 val = selection_data_to_lisp_data (display, data, bytes, |
1548 actual_type, actual_format); | 1548 actual_type, actual_format); |
1549 | 1549 |
1550 /* Use xfree, not XFree, because x_get_window_property | 1550 /* Use xfree, not XFree, because x_get_window_property |
1551 calls xmalloc itself. */ | 1551 calls xmalloc itself. */ |
1552 xfree ((char *) data); | 1552 xfree ((char *) data); |
1553 return val; | 1553 return val; |
1554 } | 1554 } |
1774 Lisp_Object unibyte_string; | 1774 Lisp_Object unibyte_string; |
1775 | 1775 |
1776 unibyte_string = string_make_unibyte (obj); | 1776 unibyte_string = string_make_unibyte (obj); |
1777 *data_ret = XSTRING (unibyte_string)->data; | 1777 *data_ret = XSTRING (unibyte_string)->data; |
1778 *nofree_ret = 1; | 1778 *nofree_ret = 1; |
1779 *size_ret = STRING_BYTES (*data_ret); | 1779 *size_ret = SBYTES (unibyte_string); |
1780 } | 1780 } |
1781 else | 1781 else |
1782 { | 1782 { |
1783 *data_ret = x_encode_text (obj, Vnext_selection_coding_system, 1, | 1783 *data_ret = x_encode_text (obj, Vnext_selection_coding_system, 1, |
1784 (int *) size_ret, &stringp); | 1784 (int *) size_ret, &stringp); |
1862 if (VECTORP (XVECTOR (obj)->contents [i])) | 1862 if (VECTORP (XVECTOR (obj)->contents [i])) |
1863 { | 1863 { |
1864 Lisp_Object pair = XVECTOR (obj)->contents [i]; | 1864 Lisp_Object pair = XVECTOR (obj)->contents [i]; |
1865 if (XVECTOR (pair)->size != 2) | 1865 if (XVECTOR (pair)->size != 2) |
1866 Fsignal (Qerror, | 1866 Fsignal (Qerror, |
1867 Fcons (build_string | 1867 Fcons (build_string |
1868 ("elements of the vector must be vectors of exactly two elements"), | 1868 ("elements of the vector must be vectors of exactly two elements"), |
1869 Fcons (pair, Qnil))); | 1869 Fcons (pair, Qnil))); |
1870 | 1870 |
1871 (*(Atom **) data_ret) [i * 2] | 1871 (*(Atom **) data_ret) [i * 2] |
1872 = symbol_to_x_atom (dpyinfo, display, | 1872 = symbol_to_x_atom (dpyinfo, display, |
1873 XVECTOR (pair)->contents [0]); | 1873 XVECTOR (pair)->contents [0]); |
1874 (*(Atom **) data_ret) [(i * 2) + 1] | 1874 (*(Atom **) data_ret) [(i * 2) + 1] |
1875 = symbol_to_x_atom (dpyinfo, display, | 1875 = symbol_to_x_atom (dpyinfo, display, |
1878 else | 1878 else |
1879 Fsignal (Qerror, | 1879 Fsignal (Qerror, |
1880 Fcons (build_string | 1880 Fcons (build_string |
1881 ("all elements of the vector must be of the same type"), | 1881 ("all elements of the vector must be of the same type"), |
1882 Fcons (obj, Qnil))); | 1882 Fcons (obj, Qnil))); |
1883 | 1883 |
1884 } | 1884 } |
1885 #endif | 1885 #endif |
1886 else | 1886 else |
1887 /* This vector is an INTEGER set, or something like it */ | 1887 /* This vector is an INTEGER set, or something like it */ |
1888 { | 1888 { |
2122 { | 2122 { |
2123 check_x (); | 2123 check_x (); |
2124 CHECK_SYMBOL (selection); | 2124 CHECK_SYMBOL (selection); |
2125 if (EQ (selection, Qnil)) selection = QPRIMARY; | 2125 if (EQ (selection, Qnil)) selection = QPRIMARY; |
2126 if (EQ (selection, Qt)) selection = QSECONDARY; | 2126 if (EQ (selection, Qt)) selection = QSECONDARY; |
2127 | 2127 |
2128 if (NILP (Fassq (selection, Vselection_alist))) | 2128 if (NILP (Fassq (selection, Vselection_alist))) |
2129 return Qnil; | 2129 return Qnil; |
2130 return Qt; | 2130 return Qt; |
2131 } | 2131 } |
2132 | 2132 |
2229 | 2229 |
2230 x_get_window_property (display, window, buffer_atom, &data, &bytes, | 2230 x_get_window_property (display, window, buffer_atom, &data, &bytes, |
2231 &type, &format, &size, 0); | 2231 &type, &format, &size, 0); |
2232 if (!data || !format) | 2232 if (!data || !format) |
2233 return Qnil; | 2233 return Qnil; |
2234 | 2234 |
2235 if (format != 8 || type != XA_STRING) | 2235 if (format != 8 || type != XA_STRING) |
2236 Fsignal (Qerror, | 2236 Fsignal (Qerror, |
2237 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), | 2237 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), |
2238 Fcons (x_atom_to_symbol (display, type), | 2238 Fcons (x_atom_to_symbol (display, type), |
2239 Fcons (make_number (format), Qnil)))); | 2239 Fcons (make_number (format), Qnil)))); |