Mercurial > emacs
comparison src/xselect.c @ 53911:609de9ab5f75
* xselect.c (x_get_foreign_selection): Add new optional parameter
time_stamp.
(Fx_get_selection_internal): Ditto, pass time_stamp to
x_get_foreign_selection.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Tue, 10 Feb 2004 17:19:14 +0000 |
parents | a3c89ed1aac5 |
children | 26dc8943ee64 |
comparison
equal
deleted
inserted
replaced
53910:9c480a55fc22 | 53911:609de9ab5f75 |
---|---|
52 static struct prop_location *expect_property_change P_ ((Display *, Window, | 52 static struct prop_location *expect_property_change P_ ((Display *, Window, |
53 Atom, int)); | 53 Atom, int)); |
54 static void unexpect_property_change P_ ((struct prop_location *)); | 54 static void unexpect_property_change P_ ((struct prop_location *)); |
55 static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object)); | 55 static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object)); |
56 static void wait_for_property_change P_ ((struct prop_location *)); | 56 static void wait_for_property_change P_ ((struct prop_location *)); |
57 static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, Lisp_Object)); | 57 static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, |
58 Lisp_Object, | |
59 Lisp_Object)); | |
58 static void x_get_window_property P_ ((Display *, Window, Atom, | 60 static void x_get_window_property P_ ((Display *, Window, Atom, |
59 unsigned char **, int *, | 61 unsigned char **, int *, |
60 Atom *, int *, unsigned long *, int)); | 62 Atom *, int *, unsigned long *, int)); |
61 static void receive_incremental_selection P_ ((Display *, Window, Atom, | 63 static void receive_incremental_selection P_ ((Display *, Window, Atom, |
62 Lisp_Object, unsigned, | 64 Lisp_Object, unsigned, |
1217 | 1219 |
1218 /* Do protocol to read selection-data from the server. | 1220 /* Do protocol to read selection-data from the server. |
1219 Converts this to Lisp data and returns it. */ | 1221 Converts this to Lisp data and returns it. */ |
1220 | 1222 |
1221 static Lisp_Object | 1223 static Lisp_Object |
1222 x_get_foreign_selection (selection_symbol, target_type) | 1224 x_get_foreign_selection (selection_symbol, target_type, time_stamp) |
1223 Lisp_Object selection_symbol, target_type; | 1225 Lisp_Object selection_symbol, target_type, time_stamp; |
1224 { | 1226 { |
1225 struct frame *sf = SELECTED_FRAME (); | 1227 struct frame *sf = SELECTED_FRAME (); |
1226 Window requestor_window = FRAME_X_WINDOW (sf); | 1228 Window requestor_window = FRAME_X_WINDOW (sf); |
1227 Display *display = FRAME_X_DISPLAY (sf); | 1229 Display *display = FRAME_X_DISPLAY (sf); |
1228 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); | 1230 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); |
1236 | 1238 |
1237 if (CONSP (target_type)) | 1239 if (CONSP (target_type)) |
1238 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); | 1240 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); |
1239 else | 1241 else |
1240 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); | 1242 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); |
1243 | |
1244 if (! NILP (time_stamp)) | |
1245 { | |
1246 if (CONSP (time_stamp)) | |
1247 requestor_time = (Time) cons_to_long (time_stamp); | |
1248 else if (INTEGERP (time_stamp)) | |
1249 requestor_time = (Time) XUINT (time_stamp); | |
1250 else if (FLOATP (time_stamp)) | |
1251 requestor_time = (Time) XFLOAT (time_stamp); | |
1252 else | |
1253 error ("TIME_STAMP must be cons or number"); | |
1254 } | |
1241 | 1255 |
1242 BLOCK_INPUT; | 1256 BLOCK_INPUT; |
1243 | 1257 |
1244 count = x_catch_errors (display); | 1258 count = x_catch_errors (display); |
1245 | 1259 |
1928 /* Request the selection value from the owner. If we are the owner, | 1942 /* Request the selection value from the owner. If we are the owner, |
1929 simply return our selection value. If we are not the owner, this | 1943 simply return our selection value. If we are not the owner, this |
1930 will block until all of the data has arrived. */ | 1944 will block until all of the data has arrived. */ |
1931 | 1945 |
1932 DEFUN ("x-get-selection-internal", Fx_get_selection_internal, | 1946 DEFUN ("x-get-selection-internal", Fx_get_selection_internal, |
1933 Sx_get_selection_internal, 2, 2, 0, | 1947 Sx_get_selection_internal, 2, 3, 0, |
1934 doc: /* Return text selected from some X window. | 1948 doc: /* Return text selected from some X window. |
1935 SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. | 1949 SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
1936 \(Those are literal upper-case symbol names, since that's what X expects.) | 1950 \(Those are literal upper-case symbol names, since that's what X expects.) |
1937 TYPE is the type of data desired, typically `STRING'. */) | 1951 TYPE is the type of data desired, typically `STRING'. |
1938 (selection_symbol, target_type) | 1952 TIME_STAMP is the time to use in the XConvertSelection call for foreign |
1939 Lisp_Object selection_symbol, target_type; | 1953 selections. If omitted, defaults to the time for the last event. */) |
1954 (selection_symbol, target_type, time_stamp) | |
1955 Lisp_Object selection_symbol, target_type, time_stamp; | |
1940 { | 1956 { |
1941 Lisp_Object val = Qnil; | 1957 Lisp_Object val = Qnil; |
1942 struct gcpro gcpro1, gcpro2; | 1958 struct gcpro gcpro1, gcpro2; |
1943 GCPRO2 (target_type, val); /* we store newly consed data into these */ | 1959 GCPRO2 (target_type, val); /* we store newly consed data into these */ |
1944 check_x (); | 1960 check_x (); |
1958 | 1974 |
1959 val = x_get_local_selection (selection_symbol, target_type, 1); | 1975 val = x_get_local_selection (selection_symbol, target_type, 1); |
1960 | 1976 |
1961 if (NILP (val)) | 1977 if (NILP (val)) |
1962 { | 1978 { |
1963 val = x_get_foreign_selection (selection_symbol, target_type); | 1979 val = x_get_foreign_selection (selection_symbol, target_type, time_stamp); |
1964 goto DONE; | 1980 goto DONE; |
1965 } | 1981 } |
1966 | 1982 |
1967 if (CONSP (val) | 1983 if (CONSP (val) |
1968 && SYMBOLP (XCAR (val))) | 1984 && SYMBOLP (XCAR (val))) |