Mercurial > hg > xemacs-beta
comparison src/select-x.c @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | e7ef97881643 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
82 unsigned char **data_ret, | 82 unsigned char **data_ret, |
83 Atom *type_ret, | 83 Atom *type_ret, |
84 unsigned int *size_ret, | 84 unsigned int *size_ret, |
85 int *format_ret); | 85 int *format_ret); |
86 static Lisp_Object selection_data_to_lisp_data (struct device *, | 86 static Lisp_Object selection_data_to_lisp_data (struct device *, |
87 unsigned char *data, | 87 Extbyte *data, |
88 size_t size, | 88 size_t size, |
89 Atom type, | 89 Atom type, |
90 int format); | 90 int format); |
91 static Lisp_Object x_get_window_property_as_lisp_data (Display *, | 91 static Lisp_Object x_get_window_property_as_lisp_data (Display *, |
92 Window, | 92 Window, |
282 #else | 282 #else |
283 int dataid; /* 1.2 wants long, but 1.1.5 wants int... */ | 283 int dataid; /* 1.2 wants long, but 1.1.5 wants int... */ |
284 #endif | 284 #endif |
285 XmString fmh; | 285 XmString fmh; |
286 String encoding = "STRING"; | 286 String encoding = "STRING"; |
287 const Extbyte *data = XSTRING_DATA (selection_value); | 287 const Bufbyte *data = XSTRING_DATA (selection_value); |
288 Extcount bytes = XSTRING_LENGTH (selection_value); | 288 Bytecount bytes = XSTRING_LENGTH (selection_value); |
289 | 289 |
290 #ifdef MULE | 290 #ifdef MULE |
291 { | 291 { |
292 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; | 292 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; |
293 const Bufbyte *ptr = data, *end = ptr + bytes; | 293 const Bufbyte *ptr = data, *end = ptr + bytes; |
946 } | 946 } |
947 | 947 |
948 | 948 |
949 static void | 949 static void |
950 x_get_window_property (Display *display, Window window, Atom property, | 950 x_get_window_property (Display *display, Window window, Atom property, |
951 unsigned char **data_ret, int *bytes_ret, | 951 Extbyte **data_ret, int *bytes_ret, |
952 Atom *actual_type_ret, int *actual_format_ret, | 952 Atom *actual_type_ret, int *actual_format_ret, |
953 unsigned long *actual_size_ret, int delete_p) | 953 unsigned long *actual_size_ret, int delete_p) |
954 { | 954 { |
955 int total_size; | 955 size_t total_size; |
956 unsigned long bytes_remaining; | 956 unsigned long bytes_remaining; |
957 int offset = 0; | 957 int offset = 0; |
958 unsigned char *tmp_data = 0; | 958 unsigned char *tmp_data = 0; |
959 int result; | 959 int result; |
960 int buffer_size = SELECTION_QUANTUM (display); | 960 int buffer_size = SELECTION_QUANTUM (display); |
981 *bytes_ret = 0; | 981 *bytes_ret = 0; |
982 return; | 982 return; |
983 } | 983 } |
984 | 984 |
985 total_size = bytes_remaining + 1; | 985 total_size = bytes_remaining + 1; |
986 *data_ret = (unsigned char *) xmalloc (total_size); | 986 *data_ret = (Extbyte *) xmalloc (total_size); |
987 | 987 |
988 /* Now read, until we've gotten it all. */ | 988 /* Now read, until we've gotten it all. */ |
989 while (bytes_remaining) | 989 while (bytes_remaining) |
990 { | 990 { |
991 #if 0 | 991 #if 0 |
1018 static void | 1018 static void |
1019 receive_incremental_selection (Display *display, Window window, Atom property, | 1019 receive_incremental_selection (Display *display, Window window, Atom property, |
1020 /* this one is for error messages only */ | 1020 /* this one is for error messages only */ |
1021 Lisp_Object target_type, | 1021 Lisp_Object target_type, |
1022 unsigned int min_size_bytes, | 1022 unsigned int min_size_bytes, |
1023 unsigned char **data_ret, int *size_bytes_ret, | 1023 Extbyte **data_ret, int *size_bytes_ret, |
1024 Atom *type_ret, int *format_ret, | 1024 Atom *type_ret, int *format_ret, |
1025 unsigned long *size_ret) | 1025 unsigned long *size_ret) |
1026 { | 1026 { |
1027 /* This function can GC */ | 1027 /* This function can GC */ |
1028 int offset = 0; | 1028 int offset = 0; |
1029 int prop_id; | 1029 int prop_id; |
1030 *size_bytes_ret = min_size_bytes; | 1030 *size_bytes_ret = min_size_bytes; |
1031 *data_ret = (unsigned char *) xmalloc (*size_bytes_ret); | 1031 *data_ret = (Extbyte *) xmalloc (*size_bytes_ret); |
1032 #if 0 | 1032 #if 0 |
1033 stderr_out ("\nread INCR %d\n", min_size_bytes); | 1033 stderr_out ("\nread INCR %d\n", min_size_bytes); |
1034 #endif | 1034 #endif |
1035 /* At this point, we have read an INCR property, and deleted it (which | 1035 /* At this point, we have read an INCR property, and deleted it (which |
1036 is how we ack its receipt: the sending window will be selecting | 1036 is how we ack its receipt: the sending window will be selecting |
1042 */ | 1042 */ |
1043 prop_id = expect_property_change (display, window, property, | 1043 prop_id = expect_property_change (display, window, property, |
1044 PropertyNewValue); | 1044 PropertyNewValue); |
1045 while (1) | 1045 while (1) |
1046 { | 1046 { |
1047 unsigned char *tmp_data; | 1047 Extbyte *tmp_data; |
1048 int tmp_size_bytes; | 1048 int tmp_size_bytes; |
1049 wait_for_property_change (prop_id); | 1049 wait_for_property_change (prop_id); |
1050 /* expect it again immediately, because x_get_window_property may | 1050 /* expect it again immediately, because x_get_window_property may |
1051 .. no it won't, I don't get it. | 1051 .. no it won't, I don't get it. |
1052 .. Ok, I get it now, the Xt code that implements INCR is broken. | 1052 .. Ok, I get it now, the Xt code that implements INCR is broken. |
1074 #if 0 | 1074 #if 0 |
1075 stderr_out (" read INCR realloc %d -> %d\n", | 1075 stderr_out (" read INCR realloc %d -> %d\n", |
1076 *size_bytes_ret, offset + tmp_size_bytes); | 1076 *size_bytes_ret, offset + tmp_size_bytes); |
1077 #endif | 1077 #endif |
1078 *size_bytes_ret = offset + tmp_size_bytes; | 1078 *size_bytes_ret = offset + tmp_size_bytes; |
1079 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); | 1079 *data_ret = (Extbyte *) xrealloc (*data_ret, *size_bytes_ret); |
1080 } | 1080 } |
1081 memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes); | 1081 memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes); |
1082 offset += tmp_size_bytes; | 1082 offset += tmp_size_bytes; |
1083 xfree (tmp_data); | 1083 xfree (tmp_data); |
1084 } | 1084 } |
1095 { | 1095 { |
1096 /* This function can GC */ | 1096 /* This function can GC */ |
1097 Atom actual_type; | 1097 Atom actual_type; |
1098 int actual_format; | 1098 int actual_format; |
1099 unsigned long actual_size; | 1099 unsigned long actual_size; |
1100 unsigned char *data = NULL; | 1100 Extbyte *data = NULL; |
1101 int bytes = 0; | 1101 int bytes = 0; |
1102 Lisp_Object val; | 1102 Lisp_Object val; |
1103 struct device *d = get_device_from_display (display); | 1103 struct device *d = get_device_from_display (display); |
1104 | 1104 |
1105 x_get_window_property (display, window, property, &data, &bytes, | 1105 x_get_window_property (display, window, property, &data, &bytes, |
1177 */ | 1177 */ |
1178 | 1178 |
1179 | 1179 |
1180 static Lisp_Object | 1180 static Lisp_Object |
1181 selection_data_to_lisp_data (struct device *d, | 1181 selection_data_to_lisp_data (struct device *d, |
1182 unsigned char *data, | 1182 Extbyte *data, |
1183 size_t size, | 1183 size_t size, |
1184 Atom type, | 1184 Atom type, |
1185 int format) | 1185 int format) |
1186 { | 1186 { |
1187 if (type == DEVICE_XATOM_NULL (d)) | 1187 if (type == DEVICE_XATOM_NULL (d)) |
1542 { | 1542 { |
1543 struct device *d = decode_x_device (Qnil); | 1543 struct device *d = decode_x_device (Qnil); |
1544 Display *display = DEVICE_X_DISPLAY (d); | 1544 Display *display = DEVICE_X_DISPLAY (d); |
1545 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ | 1545 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ |
1546 Atom cut_buffer_atom; | 1546 Atom cut_buffer_atom; |
1547 unsigned char *data; | 1547 Extbyte *data; |
1548 int bytes; | 1548 int bytes; |
1549 Atom type; | 1549 Atom type; |
1550 int format; | 1550 int format; |
1551 unsigned long size; | 1551 unsigned long size; |
1552 Lisp_Object ret; | 1552 Lisp_Object ret; |
1584 { | 1584 { |
1585 struct device *d = decode_x_device (Qnil); | 1585 struct device *d = decode_x_device (Qnil); |
1586 Display *display = DEVICE_X_DISPLAY (d); | 1586 Display *display = DEVICE_X_DISPLAY (d); |
1587 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ | 1587 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ |
1588 Atom cut_buffer_atom; | 1588 Atom cut_buffer_atom; |
1589 const Extbyte *data = XSTRING_DATA (string); | 1589 const Bufbyte *data = XSTRING_DATA (string); |
1590 Extcount bytes = XSTRING_LENGTH (string); | 1590 Bytecount bytes = XSTRING_LENGTH (string); |
1591 Extcount bytes_remaining; | 1591 Bytecount bytes_remaining; |
1592 int max_bytes = SELECTION_QUANTUM (display); | 1592 int max_bytes = SELECTION_QUANTUM (display); |
1593 #ifdef MULE | 1593 #ifdef MULE |
1594 const Bufbyte *ptr, *end; | 1594 const Bufbyte *ptr, *end; |
1595 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; | 1595 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII; |
1596 #endif | 1596 #endif |