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 | |
| 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')
| -rw-r--r-- | src/ChangeLog | 24 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 16 | ||||
| -rw-r--r-- | src/xselect.c | 35 | ||||
| -rw-r--r-- | src/xterm.c | 96 | ||||
| -rw-r--r-- | src/xterm.h | 8 |
6 files changed, 90 insertions, 91 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8ea097fa118..ea5f5e317b8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2006-02-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * xterm.h (x_catch_errors) Return value changed to void. | ||
| 4 | (x_uncatch_errors): Unused count argument deleted. | ||
| 5 | |||
| 6 | * xterm.c (x_catch_errors): Don't use record_unwind_protect, since | ||
| 7 | it can be called in a signal handler. | ||
| 8 | (x_catch_errors_unwind): Function deleted. | ||
| 9 | (x_uncatch_errors): Deallocate last x_error_message_stack struct. | ||
| 10 | (x_check_errors): Call x_uncatch_errors before signalling error. | ||
| 11 | |||
| 12 | (x_load_font, x_term_init, XTmouse_position, handle_one_xevent) | ||
| 13 | (x_connection_closed, x_list_fonts): Use new versions of | ||
| 14 | x_catch_errors and x_uncatch_errors. | ||
| 15 | |||
| 16 | * xselect.c (x_own_selection, x_decline_selection_request) | ||
| 17 | (x_reply_selection_request, x_get_foreign_selection) | ||
| 18 | (Fx_get_atom_name, Fx_send_client_event): Likewise. | ||
| 19 | |||
| 20 | * xfns.c (x_real_positions, x_set_mouse_color, Fx_focus_frame): | ||
| 21 | Likewise. | ||
| 22 | |||
| 23 | * eval.c (record_unwind_protect): Add an assertion. | ||
| 24 | |||
| 1 | 2006-02-25 Stefan Monnier <monnier@iro.umontreal.ca> | 25 | 2006-02-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 26 | ||
| 3 | * process.c (Fmake_network_process): Init the process's mark. | 27 | * process.c (Fmake_network_process): Init the process's mark. |
diff --git a/src/eval.c b/src/eval.c index eff284820f0..06d53c907b4 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -3199,6 +3199,8 @@ record_unwind_protect (function, arg) | |||
| 3199 | Lisp_Object (*function) P_ ((Lisp_Object)); | 3199 | Lisp_Object (*function) P_ ((Lisp_Object)); |
| 3200 | Lisp_Object arg; | 3200 | Lisp_Object arg; |
| 3201 | { | 3201 | { |
| 3202 | eassert (!handling_signal); | ||
| 3203 | |||
| 3202 | if (specpdl_ptr == specpdl + specpdl_size) | 3204 | if (specpdl_ptr == specpdl + specpdl_size) |
| 3203 | grow_specpdl (); | 3205 | grow_specpdl (); |
| 3204 | specpdl_ptr->func = function; | 3206 | specpdl_ptr->func = function; |
diff --git a/src/xfns.c b/src/xfns.c index 9f221efb5de..a65cf31a360 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -577,11 +577,9 @@ x_real_positions (f, xptr, yptr) | |||
| 577 | int had_errors = 0; | 577 | int had_errors = 0; |
| 578 | Window win = f->output_data.x->parent_desc; | 578 | Window win = f->output_data.x->parent_desc; |
| 579 | 579 | ||
| 580 | int count; | ||
| 581 | |||
| 582 | BLOCK_INPUT; | 580 | BLOCK_INPUT; |
| 583 | 581 | ||
| 584 | count = x_catch_errors (FRAME_X_DISPLAY (f)); | 582 | x_catch_errors (FRAME_X_DISPLAY (f)); |
| 585 | 583 | ||
| 586 | if (win == FRAME_X_DISPLAY_INFO (f)->root_window) | 584 | if (win == FRAME_X_DISPLAY_INFO (f)->root_window) |
| 587 | win = FRAME_OUTER_WINDOW (f); | 585 | win = FRAME_OUTER_WINDOW (f); |
| @@ -668,7 +666,7 @@ x_real_positions (f, xptr, yptr) | |||
| 668 | had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); | 666 | had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); |
| 669 | } | 667 | } |
| 670 | 668 | ||
| 671 | x_uncatch_errors (FRAME_X_DISPLAY (f), count); | 669 | x_uncatch_errors (FRAME_X_DISPLAY (f)); |
| 672 | 670 | ||
| 673 | UNBLOCK_INPUT; | 671 | UNBLOCK_INPUT; |
| 674 | 672 | ||
| @@ -946,7 +944,6 @@ x_set_mouse_color (f, arg, oldval) | |||
| 946 | Display *dpy = FRAME_X_DISPLAY (f); | 944 | Display *dpy = FRAME_X_DISPLAY (f); |
| 947 | Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; | 945 | Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; |
| 948 | Cursor hourglass_cursor, horizontal_drag_cursor; | 946 | Cursor hourglass_cursor, horizontal_drag_cursor; |
| 949 | int count; | ||
| 950 | unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 947 | unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 951 | unsigned long mask_color = x->background_pixel; | 948 | unsigned long mask_color = x->background_pixel; |
| 952 | 949 | ||
| @@ -963,7 +960,7 @@ x_set_mouse_color (f, arg, oldval) | |||
| 963 | BLOCK_INPUT; | 960 | BLOCK_INPUT; |
| 964 | 961 | ||
| 965 | /* It's not okay to crash if the user selects a screwy cursor. */ | 962 | /* It's not okay to crash if the user selects a screwy cursor. */ |
| 966 | count = x_catch_errors (dpy); | 963 | x_catch_errors (dpy); |
| 967 | 964 | ||
| 968 | if (!NILP (Vx_pointer_shape)) | 965 | if (!NILP (Vx_pointer_shape)) |
| 969 | { | 966 | { |
| @@ -1024,7 +1021,7 @@ x_set_mouse_color (f, arg, oldval) | |||
| 1024 | 1021 | ||
| 1025 | /* Check and report errors with the above calls. */ | 1022 | /* Check and report errors with the above calls. */ |
| 1026 | x_check_errors (dpy, "can't set cursor shape: %s"); | 1023 | x_check_errors (dpy, "can't set cursor shape: %s"); |
| 1027 | x_uncatch_errors (dpy, count); | 1024 | x_uncatch_errors (dpy); |
| 1028 | 1025 | ||
| 1029 | { | 1026 | { |
| 1030 | XColor fore_color, back_color; | 1027 | XColor fore_color, back_color; |
| @@ -3441,13 +3438,12 @@ FRAME nil means use the selected frame. */) | |||
| 3441 | { | 3438 | { |
| 3442 | struct frame *f = check_x_frame (frame); | 3439 | struct frame *f = check_x_frame (frame); |
| 3443 | Display *dpy = FRAME_X_DISPLAY (f); | 3440 | Display *dpy = FRAME_X_DISPLAY (f); |
| 3444 | int count; | ||
| 3445 | 3441 | ||
| 3446 | BLOCK_INPUT; | 3442 | BLOCK_INPUT; |
| 3447 | count = x_catch_errors (dpy); | 3443 | x_catch_errors (dpy); |
| 3448 | XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3444 | XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3449 | RevertToParent, CurrentTime); | 3445 | RevertToParent, CurrentTime); |
| 3450 | x_uncatch_errors (dpy, count); | 3446 | x_uncatch_errors (dpy); |
| 3451 | UNBLOCK_INPUT; | 3447 | UNBLOCK_INPUT; |
| 3452 | 3448 | ||
| 3453 | return Qnil; | 3449 | return Qnil; |
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; |
diff --git a/src/xterm.c b/src/xterm.c index ec5f657ab31..b7c1ba14caf 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -324,8 +324,8 @@ static void x_update_window_end P_ ((struct window *, int, int)); | |||
| 324 | void x_delete_display P_ ((struct x_display_info *)); | 324 | void x_delete_display P_ ((struct x_display_info *)); |
| 325 | 325 | ||
| 326 | static int x_io_error_quitter P_ ((Display *)); | 326 | static int x_io_error_quitter P_ ((Display *)); |
| 327 | int x_catch_errors P_ ((Display *)); | 327 | void x_catch_errors P_ ((Display *)); |
| 328 | void x_uncatch_errors P_ ((Display *, int)); | 328 | void x_uncatch_errors P_ ((Display *)); |
| 329 | void x_lower_frame P_ ((struct frame *)); | 329 | void x_lower_frame P_ ((struct frame *)); |
| 330 | void x_scroll_bar_clear P_ ((struct frame *)); | 330 | void x_scroll_bar_clear P_ ((struct frame *)); |
| 331 | int x_had_errors_p P_ ((Display *)); | 331 | int x_had_errors_p P_ ((Display *)); |
| @@ -3719,7 +3719,6 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3719 | Window win, child; | 3719 | Window win, child; |
| 3720 | int win_x, win_y; | 3720 | int win_x, win_y; |
| 3721 | int parent_x = 0, parent_y = 0; | 3721 | int parent_x = 0, parent_y = 0; |
| 3722 | int count; | ||
| 3723 | 3722 | ||
| 3724 | win = root; | 3723 | win = root; |
| 3725 | 3724 | ||
| @@ -3727,7 +3726,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3727 | structure is changing at the same time this function | 3726 | structure is changing at the same time this function |
| 3728 | is running. So at least we must not crash from them. */ | 3727 | is running. So at least we must not crash from them. */ |
| 3729 | 3728 | ||
| 3730 | count = x_catch_errors (FRAME_X_DISPLAY (*fp)); | 3729 | x_catch_errors (FRAME_X_DISPLAY (*fp)); |
| 3731 | 3730 | ||
| 3732 | if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame | 3731 | if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame |
| 3733 | && FRAME_LIVE_P (last_mouse_frame)) | 3732 | && FRAME_LIVE_P (last_mouse_frame)) |
| @@ -3796,7 +3795,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3796 | if (x_had_errors_p (FRAME_X_DISPLAY (*fp))) | 3795 | if (x_had_errors_p (FRAME_X_DISPLAY (*fp))) |
| 3797 | f1 = 0; | 3796 | f1 = 0; |
| 3798 | 3797 | ||
| 3799 | x_uncatch_errors (FRAME_X_DISPLAY (*fp), count); | 3798 | x_uncatch_errors (FRAME_X_DISPLAY (*fp)); |
| 3800 | 3799 | ||
| 3801 | /* If not, is it one of our scroll bars? */ | 3800 | /* If not, is it one of our scroll bars? */ |
| 3802 | if (! f1) | 3801 | if (! f1) |
| @@ -5713,7 +5712,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 5713 | Display *d = event.xclient.display; | 5712 | Display *d = event.xclient.display; |
| 5714 | /* Catch and ignore errors, in case window has been | 5713 | /* Catch and ignore errors, in case window has been |
| 5715 | iconified by a window manager such as GWM. */ | 5714 | iconified by a window manager such as GWM. */ |
| 5716 | int count = x_catch_errors (d); | 5715 | x_catch_errors (d); |
| 5717 | XSetInputFocus (d, event.xclient.window, | 5716 | XSetInputFocus (d, event.xclient.window, |
| 5718 | /* The ICCCM says this is | 5717 | /* The ICCCM says this is |
| 5719 | the only valid choice. */ | 5718 | the only valid choice. */ |
| @@ -5722,7 +5721,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 5722 | /* This is needed to detect the error | 5721 | /* This is needed to detect the error |
| 5723 | if there is an error. */ | 5722 | if there is an error. */ |
| 5724 | XSync (d, False); | 5723 | XSync (d, False); |
| 5725 | x_uncatch_errors (d, count); | 5724 | x_uncatch_errors (d); |
| 5726 | } | 5725 | } |
| 5727 | /* Not certain about handling scroll bars here */ | 5726 | /* Not certain about handling scroll bars here */ |
| 5728 | #endif /* 0 */ | 5727 | #endif /* 0 */ |
| @@ -7469,7 +7468,11 @@ x_text_icon (f, icon_name) | |||
| 7469 | #define X_ERROR_MESSAGE_SIZE 200 | 7468 | #define X_ERROR_MESSAGE_SIZE 200 |
| 7470 | 7469 | ||
| 7471 | /* If non-nil, this should be a string. | 7470 | /* If non-nil, this should be a string. |
| 7472 | It means catch X errors and store the error message in this string. */ | 7471 | It means catch X errors and store the error message in this string. |
| 7472 | |||
| 7473 | The reason we use a stack is that x_catch_error/x_uncatch_error can | ||
| 7474 | be called from a signal handler. | ||
| 7475 | */ | ||
| 7473 | 7476 | ||
| 7474 | struct x_error_message_stack { | 7477 | struct x_error_message_stack { |
| 7475 | char string[X_ERROR_MESSAGE_SIZE]; | 7478 | char string[X_ERROR_MESSAGE_SIZE]; |
| @@ -7506,20 +7509,12 @@ x_error_catcher (display, error) | |||
| 7506 | Calling x_uncatch_errors resumes the normal error handling. */ | 7509 | Calling x_uncatch_errors resumes the normal error handling. */ |
| 7507 | 7510 | ||
| 7508 | void x_check_errors (); | 7511 | void x_check_errors (); |
| 7509 | static Lisp_Object x_catch_errors_unwind (); | ||
| 7510 | 7512 | ||
| 7511 | int | 7513 | void |
| 7512 | x_catch_errors (dpy) | 7514 | x_catch_errors (dpy) |
| 7513 | Display *dpy; | 7515 | Display *dpy; |
| 7514 | { | 7516 | { |
| 7515 | int count = SPECPDL_INDEX (); | ||
| 7516 | struct x_error_message_stack *data = xmalloc (sizeof (*data)); | 7517 | struct x_error_message_stack *data = xmalloc (sizeof (*data)); |
| 7517 | Lisp_Object dummy; | ||
| 7518 | #ifdef ENABLE_CHECKING | ||
| 7519 | dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message); | ||
| 7520 | #else | ||
| 7521 | dummy = Qnil; | ||
| 7522 | #endif | ||
| 7523 | 7518 | ||
| 7524 | /* Make sure any errors from previous requests have been dealt with. */ | 7519 | /* Make sure any errors from previous requests have been dealt with. */ |
| 7525 | XSync (dpy, False); | 7520 | XSync (dpy, False); |
| @@ -7528,21 +7523,19 @@ x_catch_errors (dpy) | |||
| 7528 | data->string[0] = 0; | 7523 | data->string[0] = 0; |
| 7529 | data->prev = x_error_message; | 7524 | data->prev = x_error_message; |
| 7530 | x_error_message = data; | 7525 | x_error_message = data; |
| 7531 | |||
| 7532 | record_unwind_protect (x_catch_errors_unwind, dummy); | ||
| 7533 | |||
| 7534 | return count; | ||
| 7535 | } | 7526 | } |
| 7536 | 7527 | ||
| 7537 | /* Unbind the binding that we made to check for X errors. */ | 7528 | /* Undo the last x_catch_errors call. |
| 7529 | DPY should be the display that was passed to x_catch_errors. */ | ||
| 7538 | 7530 | ||
| 7539 | static Lisp_Object | 7531 | void |
| 7540 | x_catch_errors_unwind (dummy) | 7532 | x_uncatch_errors (dpy) |
| 7541 | Lisp_Object dummy; | 7533 | Display *dpy; |
| 7542 | { | 7534 | { |
| 7543 | Display *dpy = x_error_message->dpy; | ||
| 7544 | struct x_error_message_stack *tmp; | 7535 | struct x_error_message_stack *tmp; |
| 7545 | 7536 | ||
| 7537 | eassert (x_error_message && dpy == x_error_message->dpy); | ||
| 7538 | |||
| 7546 | /* The display may have been closed before this function is called. | 7539 | /* The display may have been closed before this function is called. |
| 7547 | Check if it is still open before calling XSync. */ | 7540 | Check if it is still open before calling XSync. */ |
| 7548 | if (x_display_info_for_display (dpy) != 0) | 7541 | if (x_display_info_for_display (dpy) != 0) |
| @@ -7554,12 +7547,7 @@ x_catch_errors_unwind (dummy) | |||
| 7554 | 7547 | ||
| 7555 | tmp = x_error_message; | 7548 | tmp = x_error_message; |
| 7556 | x_error_message = x_error_message->prev; | 7549 | x_error_message = x_error_message->prev; |
| 7557 | free (tmp); | 7550 | xfree (tmp); |
| 7558 | |||
| 7559 | eassert (EQ (dummy, | ||
| 7560 | make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message))); | ||
| 7561 | |||
| 7562 | return Qnil; | ||
| 7563 | } | 7551 | } |
| 7564 | 7552 | ||
| 7565 | /* If any X protocol errors have arrived since the last call to | 7553 | /* If any X protocol errors have arrived since the last call to |
| @@ -7575,7 +7563,12 @@ x_check_errors (dpy, format) | |||
| 7575 | XSync (dpy, False); | 7563 | XSync (dpy, False); |
| 7576 | 7564 | ||
| 7577 | if (x_error_message->string[0]) | 7565 | if (x_error_message->string[0]) |
| 7578 | error (format, x_error_message->string); | 7566 | { |
| 7567 | char string[X_ERROR_MESSAGE_SIZE]; | ||
| 7568 | bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE); | ||
| 7569 | x_uncatch_errors (dpy); | ||
| 7570 | error (format, string); | ||
| 7571 | } | ||
| 7579 | } | 7572 | } |
| 7580 | 7573 | ||
| 7581 | /* Nonzero if we had any X protocol errors | 7574 | /* Nonzero if we had any X protocol errors |
| @@ -7600,19 +7593,6 @@ x_clear_errors (dpy) | |||
| 7600 | x_error_message->string[0] = 0; | 7593 | x_error_message->string[0] = 0; |
| 7601 | } | 7594 | } |
| 7602 | 7595 | ||
| 7603 | /* Stop catching X protocol errors and let them make Emacs die. | ||
| 7604 | DPY should be the display that was passed to x_catch_errors. | ||
| 7605 | COUNT should be the value that was returned by | ||
| 7606 | the corresponding call to x_catch_errors. */ | ||
| 7607 | |||
| 7608 | void | ||
| 7609 | x_uncatch_errors (dpy, count) | ||
| 7610 | Display *dpy; | ||
| 7611 | int count; | ||
| 7612 | { | ||
| 7613 | unbind_to (count, Qnil); | ||
| 7614 | } | ||
| 7615 | |||
| 7616 | #if 0 | 7596 | #if 0 |
| 7617 | static unsigned int x_wire_count; | 7597 | static unsigned int x_wire_count; |
| 7618 | x_trace_wire () | 7598 | x_trace_wire () |
| @@ -7669,7 +7649,6 @@ x_connection_closed (dpy, error_message) | |||
| 7669 | { | 7649 | { |
| 7670 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); | 7650 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); |
| 7671 | Lisp_Object frame, tail; | 7651 | Lisp_Object frame, tail; |
| 7672 | int count; | ||
| 7673 | 7652 | ||
| 7674 | error_msg = (char *) alloca (strlen (error_message) + 1); | 7653 | error_msg = (char *) alloca (strlen (error_message) + 1); |
| 7675 | strcpy (error_msg, error_message); | 7654 | strcpy (error_msg, error_message); |
| @@ -7679,7 +7658,7 @@ x_connection_closed (dpy, error_message) | |||
| 7679 | below. Otherwise, we might end up with printing ``can't find per | 7658 | below. Otherwise, we might end up with printing ``can't find per |
| 7680 | display information'' in the recursive call instead of printing | 7659 | display information'' in the recursive call instead of printing |
| 7681 | the original message here. */ | 7660 | the original message here. */ |
| 7682 | count = x_catch_errors (dpy); | 7661 | x_catch_errors (dpy); |
| 7683 | 7662 | ||
| 7684 | /* We have to close the display to inform Xt that it doesn't | 7663 | /* We have to close the display to inform Xt that it doesn't |
| 7685 | exist anymore. If we don't, Xt will continue to wait for | 7664 | exist anymore. If we don't, Xt will continue to wait for |
| @@ -7747,7 +7726,7 @@ x_connection_closed (dpy, error_message) | |||
| 7747 | if (dpyinfo) | 7726 | if (dpyinfo) |
| 7748 | x_delete_display (dpyinfo); | 7727 | x_delete_display (dpyinfo); |
| 7749 | 7728 | ||
| 7750 | x_uncatch_errors (dpy, count); | 7729 | x_uncatch_errors (dpy); |
| 7751 | 7730 | ||
| 7752 | if (x_display_list == 0) | 7731 | if (x_display_list == 0) |
| 7753 | { | 7732 | { |
| @@ -9353,7 +9332,6 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 9353 | = f ? FRAME_X_DISPLAY_INFO (f) : x_display_list; | 9332 | = f ? FRAME_X_DISPLAY_INFO (f) : x_display_list; |
| 9354 | Display *dpy = dpyinfo->display; | 9333 | Display *dpy = dpyinfo->display; |
| 9355 | int try_XLoadQueryFont = 0; | 9334 | int try_XLoadQueryFont = 0; |
| 9356 | int count; | ||
| 9357 | int allow_auto_scaled_font = 0; | 9335 | int allow_auto_scaled_font = 0; |
| 9358 | 9336 | ||
| 9359 | if (size < 0) | 9337 | if (size < 0) |
| @@ -9393,7 +9371,7 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 9393 | /* At first, put PATTERN in the cache. */ | 9371 | /* At first, put PATTERN in the cache. */ |
| 9394 | 9372 | ||
| 9395 | BLOCK_INPUT; | 9373 | BLOCK_INPUT; |
| 9396 | count = x_catch_errors (dpy); | 9374 | x_catch_errors (dpy); |
| 9397 | 9375 | ||
| 9398 | if (try_XLoadQueryFont) | 9376 | if (try_XLoadQueryFont) |
| 9399 | { | 9377 | { |
| @@ -9474,7 +9452,7 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 9474 | } | 9452 | } |
| 9475 | } | 9453 | } |
| 9476 | 9454 | ||
| 9477 | x_uncatch_errors (dpy, count); | 9455 | x_uncatch_errors (dpy); |
| 9478 | UNBLOCK_INPUT; | 9456 | UNBLOCK_INPUT; |
| 9479 | 9457 | ||
| 9480 | if (names) | 9458 | if (names) |
| @@ -9565,7 +9543,7 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 9565 | XFontStruct *thisinfo; | 9543 | XFontStruct *thisinfo; |
| 9566 | 9544 | ||
| 9567 | BLOCK_INPUT; | 9545 | BLOCK_INPUT; |
| 9568 | count = x_catch_errors (dpy); | 9546 | x_catch_errors (dpy); |
| 9569 | thisinfo = XLoadQueryFont (dpy, | 9547 | thisinfo = XLoadQueryFont (dpy, |
| 9570 | SDATA (XCAR (tem))); | 9548 | SDATA (XCAR (tem))); |
| 9571 | if (x_had_errors_p (dpy)) | 9549 | if (x_had_errors_p (dpy)) |
| @@ -9575,7 +9553,7 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 9575 | thisinfo = NULL; | 9553 | thisinfo = NULL; |
| 9576 | x_clear_errors (dpy); | 9554 | x_clear_errors (dpy); |
| 9577 | } | 9555 | } |
| 9578 | x_uncatch_errors (dpy, count); | 9556 | x_uncatch_errors (dpy); |
| 9579 | UNBLOCK_INPUT; | 9557 | UNBLOCK_INPUT; |
| 9580 | 9558 | ||
| 9581 | if (thisinfo) | 9559 | if (thisinfo) |
| @@ -9731,7 +9709,6 @@ x_load_font (f, fontname, size) | |||
| 9731 | { | 9709 | { |
| 9732 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 9710 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 9733 | Lisp_Object font_names; | 9711 | Lisp_Object font_names; |
| 9734 | int count; | ||
| 9735 | 9712 | ||
| 9736 | /* Get a list of all the fonts that match this name. Once we | 9713 | /* Get a list of all the fonts that match this name. Once we |
| 9737 | have a list of matching fonts, we compare them against the fonts | 9714 | have a list of matching fonts, we compare them against the fonts |
| @@ -9770,7 +9747,7 @@ x_load_font (f, fontname, size) | |||
| 9770 | fontname = (char *) SDATA (XCAR (font_names)); | 9747 | fontname = (char *) SDATA (XCAR (font_names)); |
| 9771 | 9748 | ||
| 9772 | BLOCK_INPUT; | 9749 | BLOCK_INPUT; |
| 9773 | count = x_catch_errors (FRAME_X_DISPLAY (f)); | 9750 | x_catch_errors (FRAME_X_DISPLAY (f)); |
| 9774 | font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname); | 9751 | font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname); |
| 9775 | if (x_had_errors_p (FRAME_X_DISPLAY (f))) | 9752 | if (x_had_errors_p (FRAME_X_DISPLAY (f))) |
| 9776 | { | 9753 | { |
| @@ -9779,7 +9756,7 @@ x_load_font (f, fontname, size) | |||
| 9779 | font = NULL; | 9756 | font = NULL; |
| 9780 | x_clear_errors (FRAME_X_DISPLAY (f)); | 9757 | x_clear_errors (FRAME_X_DISPLAY (f)); |
| 9781 | } | 9758 | } |
| 9782 | x_uncatch_errors (FRAME_X_DISPLAY (f), count); | 9759 | x_uncatch_errors (FRAME_X_DISPLAY (f)); |
| 9783 | UNBLOCK_INPUT; | 9760 | UNBLOCK_INPUT; |
| 9784 | if (!font) | 9761 | if (!font) |
| 9785 | return NULL; | 9762 | return NULL; |
| @@ -10552,7 +10529,6 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 10552 | Display *dpy = dpyinfo->display; | 10529 | Display *dpy = dpyinfo->display; |
| 10553 | XrmValue d, fr, to; | 10530 | XrmValue d, fr, to; |
| 10554 | Font font; | 10531 | Font font; |
| 10555 | int count; | ||
| 10556 | 10532 | ||
| 10557 | d.addr = (XPointer)&dpy; | 10533 | d.addr = (XPointer)&dpy; |
| 10558 | d.size = sizeof (Display *); | 10534 | d.size = sizeof (Display *); |
| @@ -10560,12 +10536,12 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 10560 | fr.size = sizeof (XtDefaultFont); | 10536 | fr.size = sizeof (XtDefaultFont); |
| 10561 | to.size = sizeof (Font *); | 10537 | to.size = sizeof (Font *); |
| 10562 | to.addr = (XPointer)&font; | 10538 | to.addr = (XPointer)&font; |
| 10563 | count = x_catch_errors (dpy); | 10539 | x_catch_errors (dpy); |
| 10564 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) | 10540 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) |
| 10565 | abort (); | 10541 | abort (); |
| 10566 | if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) | 10542 | if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) |
| 10567 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); | 10543 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); |
| 10568 | x_uncatch_errors (dpy, count); | 10544 | x_uncatch_errors (dpy); |
| 10569 | } | 10545 | } |
| 10570 | #endif | 10546 | #endif |
| 10571 | #endif | 10547 | #endif |
diff --git a/src/xterm.h b/src/xterm.h index bc52efe379d..b2fa92fa4e4 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -958,9 +958,9 @@ void x_delete_display P_ ((struct x_display_info *)); | |||
| 958 | void x_make_frame_visible P_ ((struct frame *)); | 958 | void x_make_frame_visible P_ ((struct frame *)); |
| 959 | void x_iconify_frame P_ ((struct frame *)); | 959 | void x_iconify_frame P_ ((struct frame *)); |
| 960 | void x_wm_set_size_hint P_ ((struct frame *, long, int)); | 960 | void x_wm_set_size_hint P_ ((struct frame *, long, int)); |
| 961 | int x_catch_errors P_ ((Display *)); | 961 | void x_catch_errors P_ ((Display *)); |
| 962 | int x_had_errors_p P_ ((Display *)); | 962 | int x_had_errors_p P_ ((Display *)); |
| 963 | void x_uncatch_errors P_ ((Display *, int)); | 963 | void x_uncatch_errors P_ ((Display *)); |
| 964 | void x_check_errors P_ ((Display *, char *)); | 964 | void x_check_errors P_ ((Display *, char *)); |
| 965 | int x_text_icon P_ ((struct frame *, char *)); | 965 | int x_text_icon P_ ((struct frame *, char *)); |
| 966 | int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); | 966 | int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); |
| @@ -974,10 +974,10 @@ extern void cancel_mouse_face P_ ((struct frame *)); | |||
| 974 | extern void x_scroll_bar_clear P_ ((struct frame *)); | 974 | extern void x_scroll_bar_clear P_ ((struct frame *)); |
| 975 | extern int x_text_icon P_ ((struct frame *, char *)); | 975 | extern int x_text_icon P_ ((struct frame *, char *)); |
| 976 | extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); | 976 | extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); |
| 977 | extern int x_catch_errors P_ ((Display *)); | 977 | extern void x_catch_errors P_ ((Display *)); |
| 978 | extern void x_check_errors P_ ((Display *, char *)); | 978 | extern void x_check_errors P_ ((Display *, char *)); |
| 979 | extern int x_had_errors_p P_ ((Display *)); | 979 | extern int x_had_errors_p P_ ((Display *)); |
| 980 | extern void x_uncatch_errors P_ ((Display *, int)); | 980 | extern void x_uncatch_errors P_ ((Display *)); |
| 981 | extern void x_set_window_size P_ ((struct frame *, int, int, int)); | 981 | extern void x_set_window_size P_ ((struct frame *, int, int, int)); |
| 982 | extern void x_set_mouse_position P_ ((struct frame *, int, int)); | 982 | extern void x_set_mouse_position P_ ((struct frame *, int, int)); |
| 983 | extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); | 983 | extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); |