diff options
| author | Chong Yidong | 2006-02-25 23:20:10 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-02-25 23:20:10 +0000 |
| commit | 9ba8e10d9946be97282d6ba629cf26cd22676a61 (patch) | |
| tree | 33293d21976e945b3090fb7fed6f15c7806febf7 /src/xselect.c | |
| parent | f523e0c3c54c135e24284fe90d8e67120612ff99 (diff) | |
| download | emacs-9ba8e10d9946be97282d6ba629cf26cd22676a61.tar.gz emacs-9ba8e10d9946be97282d6ba629cf26cd22676a61.zip | |
* xterm.h (x_catch_errors) Return value changed to void.
(x_uncatch_errors): Unused count argument deleted.
* xterm.c (x_catch_errors): Don't use record_unwind_protect, since
it can be called in a signal handler.
(x_catch_errors_unwind): Function deleted.
(x_uncatch_errors): Deallocate last x_error_message_stack struct.
(x_check_errors): Call x_uncatch_errors before signalling error.
(x_load_font, x_term_init, XTmouse_position, handle_one_xevent)
(x_connection_closed, x_list_fonts): Use new versions of
x_catch_errors and x_uncatch_errors.
* xselect.c (x_own_selection, x_decline_selection_request)
(x_reply_selection_request, x_get_foreign_selection)
(Fx_get_atom_name, Fx_send_client_event): Likewise.
* xfns.c (x_real_positions, x_set_mouse_color, Fx_focus_frame):
Likewise.
* eval.c (record_unwind_protect): Add an assertion.
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/xselect.c b/src/xselect.c index 850cb058e86..6efa625543e 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -402,16 +402,15 @@ x_own_selection (selection_name, selection_value) | |||
| 402 | Time time = last_event_timestamp; | 402 | Time time = last_event_timestamp; |
| 403 | Atom selection_atom; | 403 | Atom selection_atom; |
| 404 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); | 404 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); |
| 405 | int count; | ||
| 406 | 405 | ||
| 407 | CHECK_SYMBOL (selection_name); | 406 | CHECK_SYMBOL (selection_name); |
| 408 | selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name); | 407 | selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name); |
| 409 | 408 | ||
| 410 | BLOCK_INPUT; | 409 | BLOCK_INPUT; |
| 411 | count = x_catch_errors (display); | 410 | x_catch_errors (display); |
| 412 | XSetSelectionOwner (display, selection_atom, selecting_window, time); | 411 | XSetSelectionOwner (display, selection_atom, selecting_window, time); |
| 413 | x_check_errors (display, "Can't set selection: %s"); | 412 | x_check_errors (display, "Can't set selection: %s"); |
| 414 | x_uncatch_errors (display, count); | 413 | x_uncatch_errors (display); |
| 415 | UNBLOCK_INPUT; | 414 | UNBLOCK_INPUT; |
| 416 | 415 | ||
| 417 | /* Now update the local cache */ | 416 | /* Now update the local cache */ |
| @@ -572,7 +571,6 @@ x_decline_selection_request (event) | |||
| 572 | struct input_event *event; | 571 | struct input_event *event; |
| 573 | { | 572 | { |
| 574 | XSelectionEvent reply; | 573 | XSelectionEvent reply; |
| 575 | int count; | ||
| 576 | 574 | ||
| 577 | reply.type = SelectionNotify; | 575 | reply.type = SelectionNotify; |
| 578 | reply.display = SELECTION_EVENT_DISPLAY (event); | 576 | reply.display = SELECTION_EVENT_DISPLAY (event); |
| @@ -585,10 +583,10 @@ x_decline_selection_request (event) | |||
| 585 | /* The reason for the error may be that the receiver has | 583 | /* The reason for the error may be that the receiver has |
| 586 | died in the meantime. Handle that case. */ | 584 | died in the meantime. Handle that case. */ |
| 587 | BLOCK_INPUT; | 585 | BLOCK_INPUT; |
| 588 | count = x_catch_errors (reply.display); | 586 | x_catch_errors (reply.display); |
| 589 | XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply); | 587 | XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply); |
| 590 | XFlush (reply.display); | 588 | XFlush (reply.display); |
| 591 | x_uncatch_errors (reply.display, count); | 589 | x_uncatch_errors (reply.display); |
| 592 | UNBLOCK_INPUT; | 590 | UNBLOCK_INPUT; |
| 593 | } | 591 | } |
| 594 | 592 | ||
| @@ -690,7 +688,7 @@ x_reply_selection_request (event, format, data, size, type) | |||
| 690 | int format_bytes = format/8; | 688 | int format_bytes = format/8; |
| 691 | int max_bytes = SELECTION_QUANTUM (display); | 689 | int max_bytes = SELECTION_QUANTUM (display); |
| 692 | struct x_display_info *dpyinfo = x_display_info_for_display (display); | 690 | struct x_display_info *dpyinfo = x_display_info_for_display (display); |
| 693 | int count; | 691 | int count = SPECPDL_INDEX (); |
| 694 | 692 | ||
| 695 | if (max_bytes > MAX_SELECTION_QUANTUM) | 693 | if (max_bytes > MAX_SELECTION_QUANTUM) |
| 696 | max_bytes = MAX_SELECTION_QUANTUM; | 694 | max_bytes = MAX_SELECTION_QUANTUM; |
| @@ -707,7 +705,7 @@ x_reply_selection_request (event, format, data, size, type) | |||
| 707 | 705 | ||
| 708 | /* #### XChangeProperty can generate BadAlloc, and we must handle it! */ | 706 | /* #### XChangeProperty can generate BadAlloc, and we must handle it! */ |
| 709 | BLOCK_INPUT; | 707 | BLOCK_INPUT; |
| 710 | count = x_catch_errors (display); | 708 | x_catch_errors (display); |
| 711 | 709 | ||
| 712 | #ifdef TRACE_SELECTION | 710 | #ifdef TRACE_SELECTION |
| 713 | { | 711 | { |
| @@ -860,7 +858,9 @@ x_reply_selection_request (event, format, data, size, type) | |||
| 860 | UNBLOCK to enter the event loop and get possible errors delivered, | 858 | UNBLOCK to enter the event loop and get possible errors delivered, |
| 861 | and then BLOCK again because x_uncatch_errors requires it. */ | 859 | and then BLOCK again because x_uncatch_errors requires it. */ |
| 862 | BLOCK_INPUT; | 860 | BLOCK_INPUT; |
| 863 | x_uncatch_errors (display, count); | 861 | |
| 862 | unbind_to (count, Qnil); | ||
| 863 | x_uncatch_errors (display); | ||
| 864 | UNBLOCK_INPUT; | 864 | UNBLOCK_INPUT; |
| 865 | } | 865 | } |
| 866 | 866 | ||
| @@ -1392,7 +1392,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1392 | 1392 | ||
| 1393 | BLOCK_INPUT; | 1393 | BLOCK_INPUT; |
| 1394 | 1394 | ||
| 1395 | count = x_catch_errors (display); | 1395 | x_catch_errors (display); |
| 1396 | 1396 | ||
| 1397 | TRACE2 ("Get selection %s, type %s", | 1397 | TRACE2 ("Get selection %s, type %s", |
| 1398 | XGetAtomName (display, type_atom), | 1398 | XGetAtomName (display, type_atom), |
| @@ -1409,6 +1409,8 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1409 | 1409 | ||
| 1410 | frame = some_frame_on_display (dpyinfo); | 1410 | frame = some_frame_on_display (dpyinfo); |
| 1411 | 1411 | ||
| 1412 | count = SPECPDL_INDEX (); | ||
| 1413 | |||
| 1412 | /* If the display no longer has frames, we can't expect | 1414 | /* If the display no longer has frames, we can't expect |
| 1413 | to get many more selection requests from it, so don't | 1415 | to get many more selection requests from it, so don't |
| 1414 | bother trying to queue them. */ | 1416 | bother trying to queue them. */ |
| @@ -1430,8 +1432,9 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1430 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); | 1432 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); |
| 1431 | 1433 | ||
| 1432 | BLOCK_INPUT; | 1434 | BLOCK_INPUT; |
| 1435 | unbind_to (count, Qnil); | ||
| 1433 | x_check_errors (display, "Cannot get selection: %s"); | 1436 | x_check_errors (display, "Cannot get selection: %s"); |
| 1434 | x_uncatch_errors (display, count); | 1437 | x_uncatch_errors (display); |
| 1435 | UNBLOCK_INPUT; | 1438 | UNBLOCK_INPUT; |
| 1436 | 1439 | ||
| 1437 | if (NILP (XCAR (reading_selection_reply))) | 1440 | if (NILP (XCAR (reading_selection_reply))) |
| @@ -2650,7 +2653,6 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2650 | struct frame *f = check_x_frame (frame); | 2653 | struct frame *f = check_x_frame (frame); |
| 2651 | char *name = 0; | 2654 | char *name = 0; |
| 2652 | Lisp_Object ret = Qnil; | 2655 | Lisp_Object ret = Qnil; |
| 2653 | int count; | ||
| 2654 | Display *dpy = FRAME_X_DISPLAY (f); | 2656 | Display *dpy = FRAME_X_DISPLAY (f); |
| 2655 | Atom atom; | 2657 | Atom atom; |
| 2656 | 2658 | ||
| @@ -2664,14 +2666,14 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2664 | error ("Wrong type, value must be number or cons"); | 2666 | error ("Wrong type, value must be number or cons"); |
| 2665 | 2667 | ||
| 2666 | BLOCK_INPUT; | 2668 | BLOCK_INPUT; |
| 2667 | count = x_catch_errors (dpy); | 2669 | x_catch_errors (dpy); |
| 2668 | 2670 | ||
| 2669 | name = atom ? XGetAtomName (dpy, atom) : ""; | 2671 | name = atom ? XGetAtomName (dpy, atom) : ""; |
| 2670 | 2672 | ||
| 2671 | if (! x_had_errors_p (dpy)) | 2673 | if (! x_had_errors_p (dpy)) |
| 2672 | ret = make_string (name, strlen (name)); | 2674 | ret = make_string (name, strlen (name)); |
| 2673 | 2675 | ||
| 2674 | x_uncatch_errors (dpy, count); | 2676 | x_uncatch_errors (dpy); |
| 2675 | 2677 | ||
| 2676 | if (atom && name) XFree (name); | 2678 | if (atom && name) XFree (name); |
| 2677 | if (NILP (ret)) ret = make_string ("", 0); | 2679 | if (NILP (ret)) ret = make_string ("", 0); |
| @@ -2771,7 +2773,6 @@ are ignored. */) | |||
| 2771 | Lisp_Object cons; | 2773 | Lisp_Object cons; |
| 2772 | int size; | 2774 | int size; |
| 2773 | struct frame *f = check_x_frame (from); | 2775 | struct frame *f = check_x_frame (from); |
| 2774 | int count; | ||
| 2775 | int to_root; | 2776 | int to_root; |
| 2776 | 2777 | ||
| 2777 | CHECK_STRING (message_type); | 2778 | CHECK_STRING (message_type); |
| @@ -2841,14 +2842,14 @@ are ignored. */) | |||
| 2841 | the destination window. But if we are sending to the root window, | 2842 | the destination window. But if we are sending to the root window, |
| 2842 | there is no such client. Then we set the event mask to 0xffff. The | 2843 | there is no such client. Then we set the event mask to 0xffff. The |
| 2843 | event then goes to clients selecting for events on the root window. */ | 2844 | event then goes to clients selecting for events on the root window. */ |
| 2844 | count = x_catch_errors (dpyinfo->display); | 2845 | x_catch_errors (dpyinfo->display); |
| 2845 | { | 2846 | { |
| 2846 | int propagate = to_root ? False : True; | 2847 | int propagate = to_root ? False : True; |
| 2847 | unsigned mask = to_root ? 0xffff : 0; | 2848 | unsigned mask = to_root ? 0xffff : 0; |
| 2848 | XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); | 2849 | XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); |
| 2849 | XFlush (dpyinfo->display); | 2850 | XFlush (dpyinfo->display); |
| 2850 | } | 2851 | } |
| 2851 | x_uncatch_errors (dpyinfo->display, count); | 2852 | x_uncatch_errors (dpyinfo->display); |
| 2852 | UNBLOCK_INPUT; | 2853 | UNBLOCK_INPUT; |
| 2853 | 2854 | ||
| 2854 | return Qnil; | 2855 | return Qnil; |