Mercurial > hg > xemacs-beta
comparison src/select-x.c @ 563:183866b06e0b
[xemacs-hg @ 2001-05-24 07:50:48 by ben]
Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c:
-- defsymbol -> DEFSYMBOL.
-- add an error type to all errors.
-- eliminate the error functions in eval.c that let you just
use Qerror as the type.
-- redo the error API to be more consistent, sensibly named,
and easier to use.
-- redo the error hierarchy somewhat. create new errors:
structure-formation-error, gui-error, invalid-constant,
stack-overflow, out-of-memory, process-error, network-error,
sound-error, printing-unreadable-object, base64-conversion-
error; coding-system-error renamed to text-conversion error;
some others.
-- fix Mule problems in error strings in emodules.c, tooltalk.c.
-- fix error handling in mswin open-network-stream.
-- Mule-ize all sound files and clean up the headers.
-- nativesound.h -> sound.h and used for all sound files.
-- move some shared stuff into glyphs-shared.c: first attempt
at eliminating some of the massive GTK code duplication.
xemacs.mak: add glyphs-shared.c.
xemacs-faq.texi: document how to debug X errors
subr.el: fix doc string to reflect reality
author | ben |
---|---|
date | Thu, 24 May 2001 07:51:33 +0000 |
parents | c33ae14dd6d0 |
children | b39c14581166 |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
398 || EQ (XCAR (selection), QTEXT) | 398 || EQ (XCAR (selection), QTEXT) |
399 || EQ (XCAR (selection), QCOMPOUND_TEXT))) | 399 || EQ (XCAR (selection), QCOMPOUND_TEXT))) |
400 selection = XCDR (selection); | 400 selection = XCDR (selection); |
401 | 401 |
402 if (NILP (selection)) | 402 if (NILP (selection)) |
403 signal_error (Qselection_conversion_error, | 403 signal_error (Qselection_conversion_error, "no selection", |
404 build_string ("no selection")); | 404 Qunbound); |
405 | 405 |
406 if (!STRINGP (selection)) | 406 if (!STRINGP (selection)) |
407 signal_error (Qselection_conversion_error, | 407 signal_error (Qselection_conversion_error, |
408 build_string ("couldn't convert selection to string")); | 408 "couldn't convert selection to string", Qunbound); |
409 | 409 |
410 | 410 |
411 XmClipboardCopyByName (dpy, window, *data_id, | 411 XmClipboardCopyByName (dpy, window, *data_id, |
412 (char *) XSTRING_DATA (selection), | 412 (char *) XSTRING_DATA (selection), |
413 XSTRING_LENGTH (selection) + 1, | 413 XSTRING_LENGTH (selection) + 1, |
511 { | 511 { |
512 /* Send an INCR selection. */ | 512 /* Send an INCR selection. */ |
513 int prop_id; | 513 int prop_id; |
514 | 514 |
515 if (x_window_to_frame (d, window)) /* #### debug */ | 515 if (x_window_to_frame (d, window)) /* #### debug */ |
516 error ("attempt to transfer an INCR to ourself!"); | 516 invalid_operation ("attempt to transfer an INCR to ourself!", Qunbound); |
517 #if 0 | 517 #if 0 |
518 stderr_out ("\nINCR %d\n", bytes_remaining); | 518 stderr_out ("\nINCR %d\n", bytes_remaining); |
519 #endif | 519 #endif |
520 prop_id = expect_property_change (display, window, reply.property, | 520 prop_id = expect_property_change (display, window, reply.property, |
521 PropertyDelete); | 521 PropertyDelete); |
859 for (i = 0; i < len; i++) | 859 for (i = 0; i < len; i++) |
860 { | 860 { |
861 Lisp_Object vec2 = XVECTOR_DATA (obj) [i]; | 861 Lisp_Object vec2 = XVECTOR_DATA (obj) [i]; |
862 CHECK_VECTOR (vec2); | 862 CHECK_VECTOR (vec2); |
863 if (XVECTOR_LENGTH (vec2) != 2) | 863 if (XVECTOR_LENGTH (vec2) != 2) |
864 signal_error (Qerror, list2 (build_string | 864 sferror ("vectors must be of length 2", vec2); |
865 ("vectors must be of length 2"), | |
866 vec2)); | |
867 XVECTOR_DATA (vec) [i] = make_vector (2, Qnil); | 865 XVECTOR_DATA (vec) [i] = make_vector (2, Qnil); |
868 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [0] = XVECTOR_DATA (vec2) [0]; | 866 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [0] = XVECTOR_DATA (vec2) [0]; |
869 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [1] = XVECTOR_DATA (vec2) [1]; | 867 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [1] = XVECTOR_DATA (vec2) [1]; |
870 } | 868 } |
871 return vec; | 869 return vec; |
936 | 934 |
937 /* This is ^Gable */ | 935 /* This is ^Gable */ |
938 wait_delaying_user_input (selection_reply_done, 0); | 936 wait_delaying_user_input (selection_reply_done, 0); |
939 | 937 |
940 if (selection_reply_timed_out) | 938 if (selection_reply_timed_out) |
941 error ("timed out waiting for reply from selection owner"); | 939 signal_error (Qselection_conversion_error, "timed out waiting for reply from selection owner", Qunbound); |
942 | 940 |
943 unbind_to (speccount, Qnil); | 941 unbind_to (speccount, Qnil); |
944 | 942 |
945 /* otherwise, the selection is waiting for us on the requested property. */ | 943 /* otherwise, the selection is waiting for us on the requested property. */ |
946 | 944 |
1114 &actual_type, &actual_format, &actual_size, 1); | 1112 &actual_type, &actual_format, &actual_size, 1); |
1115 if (! data) | 1113 if (! data) |
1116 { | 1114 { |
1117 if (XGetSelectionOwner (display, selection_atom)) | 1115 if (XGetSelectionOwner (display, selection_atom)) |
1118 /* there is a selection owner */ | 1116 /* there is a selection owner */ |
1119 signal_error | 1117 signal_error (Qselection_conversion_error, |
1120 (Qselection_conversion_error, | 1118 "selection owner couldn't convert", |
1121 Fcons (build_string ("selection owner couldn't convert"), | 1119 Fcons (Qunbound, |
1122 Fcons (x_atom_to_symbol (d, selection_atom), | 1120 Fcons (x_atom_to_symbol (d, selection_atom), |
1123 actual_type ? | 1121 actual_type ? |
1124 list2 (target_type, x_atom_to_symbol (d, actual_type)) : | 1122 list2 (target_type, |
1125 list1 (target_type)))); | 1123 x_atom_to_symbol (d, actual_type)) : |
1124 list1 (target_type)))); | |
1126 else | 1125 else |
1127 signal_error (Qerror, | 1126 signal_error (Qselection_conversion_error, |
1128 list2 (build_string ("no selection"), | 1127 "no selection", |
1129 x_atom_to_symbol (d, selection_atom))); | 1128 x_atom_to_symbol (d, selection_atom)); |
1130 } | 1129 } |
1131 | 1130 |
1132 if (actual_type == DEVICE_XATOM_INCR (d)) | 1131 if (actual_type == DEVICE_XATOM_INCR (d)) |
1133 { | 1132 { |
1134 /* Ok, that data wasn't *the* data, it was just the beginning. */ | 1133 /* Ok, that data wasn't *the* data, it was just the beginning. */ |
1380 for (i = 0; i < (int) (*size_ret); i++) | 1379 for (i = 0; i < (int) (*size_ret); i++) |
1381 if (SYMBOLP (XVECTOR_DATA (obj) [i])) | 1380 if (SYMBOLP (XVECTOR_DATA (obj) [i])) |
1382 (*(Atom **) data_ret) [i] = | 1381 (*(Atom **) data_ret) [i] = |
1383 symbol_to_x_atom (d, XVECTOR_DATA (obj) [i], 0); | 1382 symbol_to_x_atom (d, XVECTOR_DATA (obj) [i], 0); |
1384 else | 1383 else |
1385 signal_error (Qerror, /* Qselection_error */ | 1384 syntax_error |
1386 list2 (build_string | 1385 ("all elements of the vector must be of the same type", obj); |
1387 ("all elements of the vector must be of the same type"), | |
1388 obj)); | |
1389 } | 1386 } |
1390 #if 0 /* #### MULTIPLE doesn't work yet */ | 1387 #if 0 /* #### MULTIPLE doesn't work yet */ |
1391 else if (VECTORP (XVECTOR_DATA (obj) [0])) | 1388 else if (VECTORP (XVECTOR_DATA (obj) [0])) |
1392 /* This vector is an ATOM_PAIR set */ | 1389 /* This vector is an ATOM_PAIR set */ |
1393 { | 1390 { |
1399 for (i = 0; i < *size_ret; i++) | 1396 for (i = 0; i < *size_ret; i++) |
1400 if (VECTORP (XVECTOR_DATA (obj) [i])) | 1397 if (VECTORP (XVECTOR_DATA (obj) [i])) |
1401 { | 1398 { |
1402 Lisp_Object pair = XVECTOR_DATA (obj) [i]; | 1399 Lisp_Object pair = XVECTOR_DATA (obj) [i]; |
1403 if (XVECTOR_LENGTH (pair) != 2) | 1400 if (XVECTOR_LENGTH (pair) != 2) |
1404 signal_error (Qerror, | 1401 syntax_error |
1405 list2 (build_string | 1402 ("elements of the vector must be vectors of exactly two elements", pair); |
1406 ("elements of the vector must be vectors of exactly two elements"), | |
1407 pair)); | |
1408 | 1403 |
1409 (*(Atom **) data_ret) [i * 2] = | 1404 (*(Atom **) data_ret) [i * 2] = |
1410 symbol_to_x_atom (d, XVECTOR_DATA (pair) [0], 0); | 1405 symbol_to_x_atom (d, XVECTOR_DATA (pair) [0], 0); |
1411 (*(Atom **) data_ret) [(i * 2) + 1] = | 1406 (*(Atom **) data_ret) [(i * 2) + 1] = |
1412 symbol_to_x_atom (d, XVECTOR_DATA (pair) [1], 0); | 1407 symbol_to_x_atom (d, XVECTOR_DATA (pair) [1], 0); |
1413 } | 1408 } |
1414 else | 1409 else |
1415 signal_error (Qerror, | 1410 syntax_error |
1416 list2 (build_string | 1411 ("all elements of the vector must be of the same type", obj); |
1417 ("all elements of the vector must be of the same type"), | |
1418 obj)); | |
1419 } | 1412 } |
1420 #endif | 1413 #endif |
1421 else | 1414 else |
1422 /* This vector is an INTEGER set, or something like it */ | 1415 /* This vector is an INTEGER set, or something like it */ |
1423 { | 1416 { |
1426 *format_ret = 16; | 1419 *format_ret = 16; |
1427 for (i = 0; i < (int) (*size_ret); i++) | 1420 for (i = 0; i < (int) (*size_ret); i++) |
1428 if (CONSP (XVECTOR_DATA (obj) [i])) | 1421 if (CONSP (XVECTOR_DATA (obj) [i])) |
1429 *format_ret = 32; | 1422 *format_ret = 32; |
1430 else if (!INTP (XVECTOR_DATA (obj) [i])) | 1423 else if (!INTP (XVECTOR_DATA (obj) [i])) |
1431 signal_error (Qerror, /* Qselection_error */ | 1424 syntax_error |
1432 list2 (build_string | 1425 ("all elements of the vector must be integers or conses of integers", obj); |
1433 ("all elements of the vector must be integers or conses of integers"), | |
1434 obj)); | |
1435 | 1426 |
1436 *data_ret = (unsigned char *) xmalloc (*size_ret * (*format_ret/8)); | 1427 *data_ret = (unsigned char *) xmalloc (*size_ret * (*format_ret/8)); |
1437 for (i = 0; i < (int) (*size_ret); i++) | 1428 for (i = 0; i < (int) (*size_ret); i++) |
1438 if (*format_ret == 32) | 1429 if (*format_ret == 32) |
1439 (*((unsigned long **) data_ret)) [i] = | 1430 (*((unsigned long **) data_ret)) [i] = |
1442 (*((unsigned short **) data_ret)) [i] = | 1433 (*((unsigned short **) data_ret)) [i] = |
1443 (unsigned short) lisp_to_word (XVECTOR_DATA (obj) [i]); | 1434 (unsigned short) lisp_to_word (XVECTOR_DATA (obj) [i]); |
1444 } | 1435 } |
1445 } | 1436 } |
1446 else | 1437 else |
1447 signal_error (Qerror, /* Qselection_error */ | 1438 invalid_argument ("unrecognized selection data", obj); |
1448 list2 (build_string ("unrecognized selection data"), | |
1449 obj)); | |
1450 | 1439 |
1451 *type_ret = symbol_to_x_atom (d, type, 0); | 1440 *type_ret = symbol_to_x_atom (d, type, 0); |
1452 } | 1441 } |
1453 | 1442 |
1454 | 1443 |
1538 EQ (symbol, QCUT_BUFFER3) || \ | 1527 EQ (symbol, QCUT_BUFFER3) || \ |
1539 EQ (symbol, QCUT_BUFFER4) || \ | 1528 EQ (symbol, QCUT_BUFFER4) || \ |
1540 EQ (symbol, QCUT_BUFFER5) || \ | 1529 EQ (symbol, QCUT_BUFFER5) || \ |
1541 EQ (symbol, QCUT_BUFFER6) || \ | 1530 EQ (symbol, QCUT_BUFFER6) || \ |
1542 EQ (symbol, QCUT_BUFFER7))) \ | 1531 EQ (symbol, QCUT_BUFFER7))) \ |
1543 signal_simple_error ("Doesn't name a cutbuffer", symbol); \ | 1532 invalid_constant ("Doesn't name a cutbuffer", symbol); \ |
1544 } while (0) | 1533 } while (0) |
1545 | 1534 |
1546 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, 1, 1, 0, /* | 1535 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, 1, 1, 0, /* |
1547 Return the value of the named CUTBUFFER (typically CUT_BUFFER0). | 1536 Return the value of the named CUTBUFFER (typically CUT_BUFFER0). |
1548 */ | 1537 */ |
1565 x_get_window_property (display, window, cut_buffer_atom, &data, &bytes, | 1554 x_get_window_property (display, window, cut_buffer_atom, &data, &bytes, |
1566 &type, &format, &size, 0); | 1555 &type, &format, &size, 0); |
1567 if (!data) return Qnil; | 1556 if (!data) return Qnil; |
1568 | 1557 |
1569 if (format != 8 || type != XA_STRING) | 1558 if (format != 8 || type != XA_STRING) |
1570 signal_simple_error_2 ("Cut buffer doesn't contain 8-bit STRING data", | 1559 invalid_state_2 ("Cut buffer doesn't contain 8-bit STRING data", |
1571 x_atom_to_symbol (d, type), | 1560 x_atom_to_symbol (d, type), |
1572 make_int (format)); | 1561 make_int (format)); |
1573 | 1562 |
1574 /* We cheat - if the string contains an ESC character, that's | 1563 /* We cheat - if the string contains an ESC character, that's |
1575 technically not allowed in a STRING, so we assume it's | 1564 technically not allowed in a STRING, so we assume it's |
1576 COMPOUND_TEXT that we stored there ourselves earlier, | 1565 COMPOUND_TEXT that we stored there ourselves earlier, |
1577 in x-store-cutbuffer-internal */ | 1566 in x-store-cutbuffer-internal */ |
1711 DEFSUBR (Fx_store_cutbuffer_internal); | 1700 DEFSUBR (Fx_store_cutbuffer_internal); |
1712 DEFSUBR (Fx_rotate_cutbuffers_internal); | 1701 DEFSUBR (Fx_rotate_cutbuffers_internal); |
1713 #endif /* CUT_BUFFER_SUPPORT */ | 1702 #endif /* CUT_BUFFER_SUPPORT */ |
1714 | 1703 |
1715 /* Unfortunately, timeout handlers must be lisp functions. */ | 1704 /* Unfortunately, timeout handlers must be lisp functions. */ |
1716 defsymbol (&Qx_selection_reply_timeout_internal, | 1705 DEFSYMBOL (Qx_selection_reply_timeout_internal); |
1717 "x-selection-reply-timeout-internal"); | |
1718 DEFSUBR (Fx_selection_reply_timeout_internal); | 1706 DEFSUBR (Fx_selection_reply_timeout_internal); |
1719 | 1707 |
1720 #ifdef CUT_BUFFER_SUPPORT | 1708 #ifdef CUT_BUFFER_SUPPORT |
1721 defsymbol (&QCUT_BUFFER0, "CUT_BUFFER0"); | 1709 defsymbol (&QCUT_BUFFER0, "CUT_BUFFER0"); |
1722 defsymbol (&QCUT_BUFFER1, "CUT_BUFFER1"); | 1710 defsymbol (&QCUT_BUFFER1, "CUT_BUFFER1"); |