Mercurial > hg > xemacs-beta
comparison src/xselect.c @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | cc15677e0335 |
children | 7d59cb494b73 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
686 void | 686 void |
687 x_handle_selection_request (XSelectionRequestEvent *event) | 687 x_handle_selection_request (XSelectionRequestEvent *event) |
688 { | 688 { |
689 /* This function can GC */ | 689 /* This function can GC */ |
690 struct gcpro gcpro1, gcpro2, gcpro3; | 690 struct gcpro gcpro1, gcpro2, gcpro3; |
691 XSelectionEvent reply; | |
692 Lisp_Object local_selection_data = Qnil; | 691 Lisp_Object local_selection_data = Qnil; |
693 Lisp_Object selection_symbol; | 692 Lisp_Object selection_symbol; |
694 Lisp_Object target_symbol = Qnil; | 693 Lisp_Object target_symbol = Qnil; |
695 Lisp_Object converted_selection = Qnil; | 694 Lisp_Object converted_selection = Qnil; |
696 Time local_selection_time; | 695 Time local_selection_time; |
698 int count; | 697 int count; |
699 struct device *d = get_device_from_display (event->display); | 698 struct device *d = get_device_from_display (event->display); |
700 | 699 |
701 GCPRO3 (local_selection_data, converted_selection, target_symbol); | 700 GCPRO3 (local_selection_data, converted_selection, target_symbol); |
702 | 701 |
703 reply.type = SelectionNotify; /* Construct the reply event */ | |
704 reply.display = event->display; | |
705 reply.requestor = event->requestor; | |
706 reply.selection = event->selection; | |
707 reply.time = event->time; | |
708 reply.target = event->target; | |
709 reply.property = (event->property == None ? event->target : event->property); | |
710 | |
711 selection_symbol = x_atom_to_symbol (d, event->selection); | 702 selection_symbol = x_atom_to_symbol (d, event->selection); |
712 | 703 |
713 local_selection_data = assq_no_quit (selection_symbol, Vselection_alist); | 704 local_selection_data = assq_no_quit (selection_symbol, Vselection_alist); |
714 | 705 |
715 #if 0 | 706 #if 0 |
716 # define CDR(x) (XCDR (x)) | |
717 # define CAR(x) (XCAR (x)) | |
718 /* This list isn't user-visible, so it can't "go bad." */ | 707 /* This list isn't user-visible, so it can't "go bad." */ |
719 if (!CONSP (local_selection_data)) abort (); | 708 assert (CONSP (local_selection_data)); |
720 if (!CONSP (CDR (local_selection_data))) abort (); | 709 assert (CONSP (XCDR (local_selection_data))); |
721 if (!CONSP (CDR (CDR (local_selection_data)))) abort (); | 710 assert (CONSP (XCDR (XCDR (local_selection_data)))); |
722 if (!NILP (CDR (CDR (CDR (local_selection_data))))) abort (); | 711 assert (NILP (XCDR (XCDR (XCDR (local_selection_data))))); |
723 if (!CONSP (CAR (CDR (CDR (local_selection_data))))) abort (); | 712 assert (CONSP (XCAR (XCDR (XCDR (local_selection_data))))); |
724 if (!INTP (CAR (CAR (CDR (CDR (local_selection_data)))))) abort (); | 713 assert (INTP (XCAR (XCAR (XCDR (XCDR (local_selection_data)))))); |
725 if (!INTP (CDR (CAR (CDR (CDR (local_selection_data)))))) abort (); | 714 assert (INTP (XCDR (XCAR (XCDR (XCDR (local_selection_data)))))); |
726 # undef CAR | |
727 # undef CDR | |
728 #endif | 715 #endif |
729 | 716 |
730 if (NILP (local_selection_data)) | 717 if (NILP (local_selection_data)) |
731 { | 718 { |
732 /* Someone asked for the selection, but we don't have it any more. | 719 /* Someone asked for the selection, but we don't have it any more. */ |
733 */ | |
734 x_decline_selection_request (event); | 720 x_decline_selection_request (event); |
735 goto DONE_LABEL; | 721 goto DONE_LABEL; |
736 } | 722 } |
737 | 723 |
738 local_selection_time = | 724 local_selection_time = |
740 | 726 |
741 if (event->time != CurrentTime && | 727 if (event->time != CurrentTime && |
742 local_selection_time > event->time) | 728 local_selection_time > event->time) |
743 { | 729 { |
744 /* Someone asked for the selection, and we have one, but not the one | 730 /* Someone asked for the selection, and we have one, but not the one |
745 they're looking for. | 731 they're looking for. */ |
746 */ | |
747 x_decline_selection_request (event); | 732 x_decline_selection_request (event); |
748 goto DONE_LABEL; | 733 goto DONE_LABEL; |
749 } | 734 } |
750 | 735 |
751 count = specpdl_depth (); | 736 count = specpdl_depth (); |
1150 } | 1135 } |
1151 | 1136 |
1152 total_size = bytes_remaining + 1; | 1137 total_size = bytes_remaining + 1; |
1153 *data_ret = (unsigned char *) xmalloc (total_size); | 1138 *data_ret = (unsigned char *) xmalloc (total_size); |
1154 | 1139 |
1155 /* Now read, until weve gotten it all. */ | 1140 /* Now read, until we've gotten it all. */ |
1156 while (bytes_remaining) | 1141 while (bytes_remaining) |
1157 { | 1142 { |
1158 #if 0 | 1143 #if 0 |
1159 int last = bytes_remaining; | 1144 int last = bytes_remaining; |
1160 #endif | 1145 #endif |
1213 { | 1198 { |
1214 unsigned char *tmp_data; | 1199 unsigned char *tmp_data; |
1215 int tmp_size_bytes; | 1200 int tmp_size_bytes; |
1216 wait_for_property_change (prop_id); | 1201 wait_for_property_change (prop_id); |
1217 /* expect it again immediately, because x_get_window_property may | 1202 /* expect it again immediately, because x_get_window_property may |
1218 .. no it wont, I dont get it. | 1203 .. no it won't, I don't get it. |
1219 .. Ok, I get it now, the Xt code that implements INCR is broken. | 1204 .. Ok, I get it now, the Xt code that implements INCR is broken. |
1220 */ | 1205 */ |
1221 prop_id = expect_property_change (display, window, property, | 1206 prop_id = expect_property_change (display, window, property, |
1222 PropertyNewValue); | 1207 PropertyNewValue); |
1223 x_get_window_property (display, window, property, | 1208 x_get_window_property (display, window, property, |