diff options
| author | Karoly Lorentey | 2006-03-04 23:07:13 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-03-04 23:07:13 +0000 |
| commit | 00bc10dab1f80e3fcf1b8e67dd7618c32ae3926d (patch) | |
| tree | 875ed4fe8e87a4a52d5ea46140b3c70487847c81 /src/xselect.c | |
| parent | bdf36482bbea390390ae7ab1461b14b807c4fb1f (diff) | |
| parent | 5e9edb94b78ef77981213fca9319d591c7362855 (diff) | |
| download | emacs-00bc10dab1f80e3fcf1b8e67dd7618c32ae3926d.tar.gz emacs-00bc10dab1f80e3fcf1b8e67dd7618c32ae3926d.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-128
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-129
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-130
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-131
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-132
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-133
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-134
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-135
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-43
Munge arch explicit ids in etc/images to match Emacs
* emacs@sv.gnu.org/gnus--rel--5.10--patch-44
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-45
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-46
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-47
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-48
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-524
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/xselect.c b/src/xselect.c index 8c82a4b85d3..6776e732734 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -55,6 +55,7 @@ static void x_decline_selection_request P_ ((struct input_event *)); | |||
| 55 | static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object)); | 55 | static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object)); |
| 56 | static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object)); | 56 | static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object)); |
| 57 | static Lisp_Object some_frame_on_display P_ ((struct x_display_info *)); | 57 | static Lisp_Object some_frame_on_display P_ ((struct x_display_info *)); |
| 58 | static Lisp_Object x_catch_errors_unwind P_ ((Lisp_Object)); | ||
| 58 | static void x_reply_selection_request P_ ((struct input_event *, int, | 59 | static void x_reply_selection_request P_ ((struct input_event *, int, |
| 59 | unsigned char *, int, Atom)); | 60 | unsigned char *, int, Atom)); |
| 60 | static int waiting_for_other_props_on_window P_ ((Display *, Window)); | 61 | static int waiting_for_other_props_on_window P_ ((Display *, Window)); |
| @@ -618,6 +619,15 @@ x_selection_request_lisp_error (ignore) | |||
| 618 | x_decline_selection_request (x_selection_current_request); | 619 | x_decline_selection_request (x_selection_current_request); |
| 619 | return Qnil; | 620 | return Qnil; |
| 620 | } | 621 | } |
| 622 | |||
| 623 | static Lisp_Object | ||
| 624 | x_catch_errors_unwind (dummy) | ||
| 625 | Lisp_Object dummy; | ||
| 626 | { | ||
| 627 | BLOCK_INPUT; | ||
| 628 | x_uncatch_errors (); | ||
| 629 | UNBLOCK_INPUT; | ||
| 630 | } | ||
| 621 | 631 | ||
| 622 | 632 | ||
| 623 | /* This stuff is so that INCR selections are reentrant (that is, so we can | 633 | /* This stuff is so that INCR selections are reentrant (that is, so we can |
| @@ -711,8 +721,11 @@ x_reply_selection_request (event, format, data, size, type) | |||
| 711 | if (reply.property == None) | 721 | if (reply.property == None) |
| 712 | reply.property = reply.target; | 722 | reply.property = reply.target; |
| 713 | 723 | ||
| 714 | /* #### XChangeProperty can generate BadAlloc, and we must handle it! */ | ||
| 715 | BLOCK_INPUT; | 724 | BLOCK_INPUT; |
| 725 | /* The protected block contains wait_for_property_change, which can | ||
| 726 | run random lisp code (process handlers) or signal. Therefore, we | ||
| 727 | put the x_uncatch_errors call in an unwind. */ | ||
| 728 | record_unwind_protect (x_catch_errors_unwind, Qnil); | ||
| 716 | x_catch_errors (display); | 729 | x_catch_errors (display); |
| 717 | 730 | ||
| 718 | #ifdef TRACE_SELECTION | 731 | #ifdef TRACE_SELECTION |
| @@ -866,9 +879,8 @@ x_reply_selection_request (event, format, data, size, type) | |||
| 866 | UNBLOCK to enter the event loop and get possible errors delivered, | 879 | UNBLOCK to enter the event loop and get possible errors delivered, |
| 867 | and then BLOCK again because x_uncatch_errors requires it. */ | 880 | and then BLOCK again because x_uncatch_errors requires it. */ |
| 868 | BLOCK_INPUT; | 881 | BLOCK_INPUT; |
| 869 | 882 | /* This calls x_uncatch_errors. */ | |
| 870 | unbind_to (count, Qnil); | 883 | unbind_to (count, Qnil); |
| 871 | x_uncatch_errors (); | ||
| 872 | UNBLOCK_INPUT; | 884 | UNBLOCK_INPUT; |
| 873 | } | 885 | } |
| 874 | 886 | ||
| @@ -1378,7 +1390,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1378 | Atom selection_atom; | 1390 | Atom selection_atom; |
| 1379 | Atom type_atom; | 1391 | Atom type_atom; |
| 1380 | int secs, usecs; | 1392 | int secs, usecs; |
| 1381 | int count; | 1393 | int count = SPECPDL_INDEX (); |
| 1382 | Lisp_Object frame; | 1394 | Lisp_Object frame; |
| 1383 | 1395 | ||
| 1384 | if (! FRAME_X_P (sf)) | 1396 | if (! FRAME_X_P (sf)) |
| @@ -1409,6 +1421,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1409 | 1421 | ||
| 1410 | BLOCK_INPUT; | 1422 | BLOCK_INPUT; |
| 1411 | 1423 | ||
| 1424 | /* The protected block contains wait_reading_process_output, which | ||
| 1425 | can run random lisp code (process handlers) or signal. | ||
| 1426 | Therefore, we put the x_uncatch_errors call in an unwind. */ | ||
| 1427 | record_unwind_protect (x_catch_errors_unwind, Qnil); | ||
| 1412 | x_catch_errors (display); | 1428 | x_catch_errors (display); |
| 1413 | 1429 | ||
| 1414 | TRACE2 ("Get selection %s, type %s", | 1430 | TRACE2 ("Get selection %s, type %s", |
| @@ -1426,8 +1442,6 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1426 | 1442 | ||
| 1427 | frame = some_frame_on_display (dpyinfo); | 1443 | frame = some_frame_on_display (dpyinfo); |
| 1428 | 1444 | ||
| 1429 | count = SPECPDL_INDEX (); | ||
| 1430 | |||
| 1431 | /* If the display no longer has frames, we can't expect | 1445 | /* If the display no longer has frames, we can't expect |
| 1432 | to get many more selection requests from it, so don't | 1446 | to get many more selection requests from it, so don't |
| 1433 | bother trying to queue them. */ | 1447 | bother trying to queue them. */ |
| @@ -1449,9 +1463,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1449 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); | 1463 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); |
| 1450 | 1464 | ||
| 1451 | BLOCK_INPUT; | 1465 | BLOCK_INPUT; |
| 1466 | if (x_had_errors_p (display)) | ||
| 1467 | error ("Cannot get selection"); | ||
| 1468 | /* This calls x_uncatch_errors. */ | ||
| 1452 | unbind_to (count, Qnil); | 1469 | unbind_to (count, Qnil); |
| 1453 | x_check_errors (display, "Cannot get selection: %s"); | ||
| 1454 | x_uncatch_errors (); | ||
| 1455 | UNBLOCK_INPUT; | 1470 | UNBLOCK_INPUT; |
| 1456 | 1471 | ||
| 1457 | if (NILP (XCAR (reading_selection_reply))) | 1472 | if (NILP (XCAR (reading_selection_reply))) |
| @@ -2687,6 +2702,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2687 | Lisp_Object ret = Qnil; | 2702 | Lisp_Object ret = Qnil; |
| 2688 | Display *dpy = FRAME_X_DISPLAY (f); | 2703 | Display *dpy = FRAME_X_DISPLAY (f); |
| 2689 | Atom atom; | 2704 | Atom atom; |
| 2705 | int had_errors; | ||
| 2690 | 2706 | ||
| 2691 | if (INTEGERP (value)) | 2707 | if (INTEGERP (value)) |
| 2692 | atom = (Atom) XUINT (value); | 2708 | atom = (Atom) XUINT (value); |
| @@ -2699,14 +2715,13 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2699 | 2715 | ||
| 2700 | BLOCK_INPUT; | 2716 | BLOCK_INPUT; |
| 2701 | x_catch_errors (dpy); | 2717 | x_catch_errors (dpy); |
| 2702 | |||
| 2703 | name = atom ? XGetAtomName (dpy, atom) : ""; | 2718 | name = atom ? XGetAtomName (dpy, atom) : ""; |
| 2719 | had_errors = x_had_errors_p (dpy); | ||
| 2720 | x_uncatch_errors (); | ||
| 2704 | 2721 | ||
| 2705 | if (! x_had_errors_p (dpy)) | 2722 | if (!had_errors) |
| 2706 | ret = make_string (name, strlen (name)); | 2723 | ret = make_string (name, strlen (name)); |
| 2707 | 2724 | ||
| 2708 | x_uncatch_errors (); | ||
| 2709 | |||
| 2710 | if (atom && name) XFree (name); | 2725 | if (atom && name) XFree (name); |
| 2711 | if (NILP (ret)) ret = make_string ("", 0); | 2726 | if (NILP (ret)) ret = make_string ("", 0); |
| 2712 | 2727 | ||