diff options
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 53 |
1 files changed, 12 insertions, 41 deletions
diff --git a/src/xselect.c b/src/xselect.c index b422a22d68b..6a80eddc82c 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -45,26 +45,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | struct prop_location; | 45 | struct prop_location; |
| 46 | struct selection_data; | 46 | struct selection_data; |
| 47 | 47 | ||
| 48 | static Lisp_Object x_atom_to_symbol (Display *dpy, Atom atom); | ||
| 49 | static Atom symbol_to_x_atom (struct x_display_info *, Lisp_Object); | ||
| 50 | static void x_own_selection (Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 51 | static Lisp_Object x_get_local_selection (Lisp_Object, Lisp_Object, int, | ||
| 52 | struct x_display_info *); | ||
| 53 | static void x_decline_selection_request (struct input_event *); | 48 | static void x_decline_selection_request (struct input_event *); |
| 54 | static Lisp_Object x_selection_request_lisp_error (Lisp_Object); | ||
| 55 | static Lisp_Object queue_selection_requests_unwind (Lisp_Object); | ||
| 56 | static Lisp_Object x_catch_errors_unwind (Lisp_Object); | ||
| 57 | static void x_reply_selection_request (struct input_event *, struct x_display_info *); | ||
| 58 | static int x_convert_selection (struct input_event *, Lisp_Object, Lisp_Object, | 49 | static int x_convert_selection (struct input_event *, Lisp_Object, Lisp_Object, |
| 59 | Atom, int, struct x_display_info *); | 50 | Atom, int, struct x_display_info *); |
| 60 | static int waiting_for_other_props_on_window (Display *, Window); | 51 | static int waiting_for_other_props_on_window (Display *, Window); |
| 61 | static struct prop_location *expect_property_change (Display *, Window, | 52 | static struct prop_location *expect_property_change (Display *, Window, |
| 62 | Atom, int); | 53 | Atom, int); |
| 63 | static void unexpect_property_change (struct prop_location *); | 54 | static void unexpect_property_change (struct prop_location *); |
| 64 | static Lisp_Object wait_for_property_change_unwind (Lisp_Object); | ||
| 65 | static void wait_for_property_change (struct prop_location *); | 55 | static void wait_for_property_change (struct prop_location *); |
| 66 | static Lisp_Object x_get_foreign_selection (Lisp_Object, Lisp_Object, | ||
| 67 | Lisp_Object, Lisp_Object); | ||
| 68 | static Lisp_Object x_get_window_property_as_lisp_data (Display *, | 56 | static Lisp_Object x_get_window_property_as_lisp_data (Display *, |
| 69 | Window, Atom, | 57 | Window, Atom, |
| 70 | Lisp_Object, Atom); | 58 | Lisp_Object, Atom); |
| @@ -74,7 +62,6 @@ static Lisp_Object selection_data_to_lisp_data (Display *, | |||
| 74 | static void lisp_data_to_selection_data (Display *, Lisp_Object, | 62 | static void lisp_data_to_selection_data (Display *, Lisp_Object, |
| 75 | unsigned char **, Atom *, | 63 | unsigned char **, Atom *, |
| 76 | ptrdiff_t *, int *, int *); | 64 | ptrdiff_t *, int *, int *); |
| 77 | static Lisp_Object clean_local_selection_data (Lisp_Object); | ||
| 78 | 65 | ||
| 79 | /* Printing traces to stderr. */ | 66 | /* Printing traces to stderr. */ |
| 80 | 67 | ||
| @@ -513,8 +500,8 @@ static Atom conversion_fail_tag; | |||
| 513 | an error, we tell the requestor that we were unable to do what they wanted | 500 | an error, we tell the requestor that we were unable to do what they wanted |
| 514 | before we throw to top-level or go into the debugger or whatever. */ | 501 | before we throw to top-level or go into the debugger or whatever. */ |
| 515 | 502 | ||
| 516 | static Lisp_Object | 503 | static void |
| 517 | x_selection_request_lisp_error (Lisp_Object ignore) | 504 | x_selection_request_lisp_error (void) |
| 518 | { | 505 | { |
| 519 | struct selection_data *cs, *next; | 506 | struct selection_data *cs, *next; |
| 520 | 507 | ||
| @@ -530,16 +517,14 @@ x_selection_request_lisp_error (Lisp_Object ignore) | |||
| 530 | if (x_selection_current_request != 0 | 517 | if (x_selection_current_request != 0 |
| 531 | && selection_request_dpyinfo->display) | 518 | && selection_request_dpyinfo->display) |
| 532 | x_decline_selection_request (x_selection_current_request); | 519 | x_decline_selection_request (x_selection_current_request); |
| 533 | return Qnil; | ||
| 534 | } | 520 | } |
| 535 | 521 | ||
| 536 | static Lisp_Object | 522 | static void |
| 537 | x_catch_errors_unwind (Lisp_Object dummy) | 523 | x_catch_errors_unwind (void) |
| 538 | { | 524 | { |
| 539 | block_input (); | 525 | block_input (); |
| 540 | x_uncatch_errors (); | 526 | x_uncatch_errors (); |
| 541 | unblock_input (); | 527 | unblock_input (); |
| 542 | return Qnil; | ||
| 543 | } | 528 | } |
| 544 | 529 | ||
| 545 | 530 | ||
| @@ -560,11 +545,6 @@ struct prop_location | |||
| 560 | struct prop_location *next; | 545 | struct prop_location *next; |
| 561 | }; | 546 | }; |
| 562 | 547 | ||
| 563 | static struct prop_location *expect_property_change (Display *display, Window window, Atom property, int state); | ||
| 564 | static void wait_for_property_change (struct prop_location *location); | ||
| 565 | static void unexpect_property_change (struct prop_location *location); | ||
| 566 | static int waiting_for_other_props_on_window (Display *display, Window window); | ||
| 567 | |||
| 568 | static int prop_location_identifier; | 548 | static int prop_location_identifier; |
| 569 | 549 | ||
| 570 | static Lisp_Object property_change_reply; | 550 | static Lisp_Object property_change_reply; |
| @@ -573,13 +553,6 @@ static struct prop_location *property_change_reply_object; | |||
| 573 | 553 | ||
| 574 | static struct prop_location *property_change_wait_list; | 554 | static struct prop_location *property_change_wait_list; |
| 575 | 555 | ||
| 576 | static Lisp_Object | ||
| 577 | queue_selection_requests_unwind (Lisp_Object tem) | ||
| 578 | { | ||
| 579 | x_stop_queuing_selection_requests (); | ||
| 580 | return Qnil; | ||
| 581 | } | ||
| 582 | |||
| 583 | 556 | ||
| 584 | /* Send the reply to a selection request event EVENT. */ | 557 | /* Send the reply to a selection request event EVENT. */ |
| 585 | 558 | ||
| @@ -614,7 +587,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 614 | /* The protected block contains wait_for_property_change, which can | 587 | /* The protected block contains wait_for_property_change, which can |
| 615 | run random lisp code (process handlers) or signal. Therefore, we | 588 | run random lisp code (process handlers) or signal. Therefore, we |
| 616 | put the x_uncatch_errors call in an unwind. */ | 589 | put the x_uncatch_errors call in an unwind. */ |
| 617 | record_unwind_protect (x_catch_errors_unwind, Qnil); | 590 | record_unwind_protect_void (x_catch_errors_unwind); |
| 618 | x_catch_errors (display); | 591 | x_catch_errors (display); |
| 619 | 592 | ||
| 620 | /* Loop over converted selections, storing them in the requested | 593 | /* Loop over converted selections, storing them in the requested |
| @@ -805,12 +778,12 @@ x_handle_selection_request (struct input_event *event) | |||
| 805 | 778 | ||
| 806 | x_selection_current_request = event; | 779 | x_selection_current_request = event; |
| 807 | selection_request_dpyinfo = dpyinfo; | 780 | selection_request_dpyinfo = dpyinfo; |
| 808 | record_unwind_protect (x_selection_request_lisp_error, Qnil); | 781 | record_unwind_protect_void (x_selection_request_lisp_error); |
| 809 | 782 | ||
| 810 | /* We might be able to handle nested x_handle_selection_requests, | 783 | /* We might be able to handle nested x_handle_selection_requests, |
| 811 | but this is difficult to test, and seems unimportant. */ | 784 | but this is difficult to test, and seems unimportant. */ |
| 812 | x_start_queuing_selection_requests (); | 785 | x_start_queuing_selection_requests (); |
| 813 | record_unwind_protect (queue_selection_requests_unwind, Qnil); | 786 | record_unwind_protect_void (x_stop_queuing_selection_requests); |
| 814 | 787 | ||
| 815 | TRACE2 ("x_handle_selection_request: selection=%s, target=%s", | 788 | TRACE2 ("x_handle_selection_request: selection=%s, target=%s", |
| 816 | SDATA (SYMBOL_NAME (selection_symbol)), | 789 | SDATA (SYMBOL_NAME (selection_symbol)), |
| @@ -1117,15 +1090,14 @@ unexpect_property_change (struct prop_location *location) | |||
| 1117 | 1090 | ||
| 1118 | /* Remove the property change expectation element for IDENTIFIER. */ | 1091 | /* Remove the property change expectation element for IDENTIFIER. */ |
| 1119 | 1092 | ||
| 1120 | static Lisp_Object | 1093 | static void |
| 1121 | wait_for_property_change_unwind (Lisp_Object loc) | 1094 | wait_for_property_change_unwind (void *loc) |
| 1122 | { | 1095 | { |
| 1123 | struct prop_location *location = XSAVE_POINTER (loc, 0); | 1096 | struct prop_location *location = loc; |
| 1124 | 1097 | ||
| 1125 | unexpect_property_change (location); | 1098 | unexpect_property_change (location); |
| 1126 | if (location == property_change_reply_object) | 1099 | if (location == property_change_reply_object) |
| 1127 | property_change_reply_object = 0; | 1100 | property_change_reply_object = 0; |
| 1128 | return Qnil; | ||
| 1129 | } | 1101 | } |
| 1130 | 1102 | ||
| 1131 | /* Actually wait for a property change. | 1103 | /* Actually wait for a property change. |
| @@ -1140,8 +1112,7 @@ wait_for_property_change (struct prop_location *location) | |||
| 1140 | emacs_abort (); | 1112 | emacs_abort (); |
| 1141 | 1113 | ||
| 1142 | /* Make sure to do unexpect_property_change if we quit or err. */ | 1114 | /* Make sure to do unexpect_property_change if we quit or err. */ |
| 1143 | record_unwind_protect (wait_for_property_change_unwind, | 1115 | record_unwind_protect_ptr (wait_for_property_change_unwind, location); |
| 1144 | make_save_pointer (location)); | ||
| 1145 | 1116 | ||
| 1146 | XSETCAR (property_change_reply, Qnil); | 1117 | XSETCAR (property_change_reply, Qnil); |
| 1147 | property_change_reply_object = location; | 1118 | property_change_reply_object = location; |
| @@ -1254,7 +1225,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 1254 | SelectionNotify. */ | 1225 | SelectionNotify. */ |
| 1255 | #if 0 | 1226 | #if 0 |
| 1256 | x_start_queuing_selection_requests (); | 1227 | x_start_queuing_selection_requests (); |
| 1257 | record_unwind_protect (queue_selection_requests_unwind, Qnil); | 1228 | record_unwind_protect_void (x_stop_queuing_selection_requests); |
| 1258 | #endif | 1229 | #endif |
| 1259 | 1230 | ||
| 1260 | unblock_input (); | 1231 | unblock_input (); |