comparison src/xselect.c @ 3492:3e75726d76c7

(x_get_foreign_selection): Handle x_selection_timeout as milliseconds, not as seconds. (syms_of_xselect): Doc fix to match.
author Richard M. Stallman <rms@gnu.org>
date Sat, 05 Jun 1993 08:37:45 +0000
parents e1d043cb2f1a
children 507f64624555
comparison
equal deleted inserted replaced
3491:a211389a145f 3492:3e75726d76c7
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to 17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20 /* x_handle_selection_notify 20 /* x_handle_selection_notify
21 x_reply_selection_request 21 x_reply_selection_request */
22 XFree 22
23 x_selection_timeout initial value */
24 23
25 /* Rewritten by jwz */ 24 /* Rewritten by jwz */
26 25
27 #include "config.h" 26 #include "config.h"
28 #include "lisp.h" 27 #include "lisp.h"
94 selection handling. 93 selection handling.
95 */ 94 */
96 Lisp_Object Vselection_converter_alist; 95 Lisp_Object Vselection_converter_alist;
97 96
98 /* If the selection owner takes too long to reply to a selection request, 97 /* If the selection owner takes too long to reply to a selection request,
99 we give up on it. This is in seconds (0 = no timeout.) 98 we give up on it. This is in milliseconds (0 = no timeout.)
100 */ 99 */
101 int x_selection_timeout; 100 int x_selection_timeout;
102 101
103 102
104 /* Utility functions */ 103 /* Utility functions */
956 #endif 955 #endif
957 Time requestor_time = last_event_timestamp; 956 Time requestor_time = last_event_timestamp;
958 Atom target_property = Xatom_EMACS_TMP; 957 Atom target_property = Xatom_EMACS_TMP;
959 Atom selection_atom = symbol_to_x_atom (display, selection_symbol); 958 Atom selection_atom = symbol_to_x_atom (display, selection_symbol);
960 Atom type_atom; 959 Atom type_atom;
960 int secs, usecs;
961 961
962 if (CONSP (target_type)) 962 if (CONSP (target_type))
963 type_atom = symbol_to_x_atom (display, XCONS (target_type)->car); 963 type_atom = symbol_to_x_atom (display, XCONS (target_type)->car);
964 else 964 else
965 type_atom = symbol_to_x_atom (display, target_type); 965 type_atom = symbol_to_x_atom (display, target_type);
973 reading_selection_window = requestor_window; 973 reading_selection_window = requestor_window;
974 reading_which_selection = selection_atom; 974 reading_which_selection = selection_atom;
975 XCONS (reading_selection_reply)->car = Qnil; 975 XCONS (reading_selection_reply)->car = Qnil;
976 UNBLOCK_INPUT; 976 UNBLOCK_INPUT;
977 977
978 /* This allows quits. */ 978 /* This allows quits. Also, don't wait forever. */
979 wait_reading_process_input (x_selection_timeout, 0, 979 secs = x_selection_timeout / 1000;
980 reading_selection_reply, 0); 980 usecs = (x_selection_timeout % 1000) * 1000;
981 wait_reading_process_input (secs, usecs, reading_selection_reply, 0);
981 982
982 if (NILP (XCONS (reading_selection_reply)->car)) 983 if (NILP (XCONS (reading_selection_reply)->car))
983 error ("timed out waiting for reply from selection owner"); 984 error ("timed out waiting for reply from selection owner");
984 985
985 /* Otherwise, the selection is waiting for us on the requested property. */ 986 /* Otherwise, the selection is waiting for us on the requested property. */
1933 This hook doesn't let you change the behavior of Emacs's selection replies,\n\ 1934 This hook doesn't let you change the behavior of Emacs's selection replies,\n\
1934 it merely informs you that they have happened."); 1935 it merely informs you that they have happened.");
1935 Vx_sent_selection_hooks = Qnil; 1936 Vx_sent_selection_hooks = Qnil;
1936 1937
1937 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout, 1938 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout,
1938 "Number of seconds to wait for a selection reply from another X client.\n\ 1939 "Number of milliseconds to wait for a selection reply.\n\
1939 If the selection owner doens't reply in this many seconds, we give up.\n\ 1940 If the selection owner doens't reply in this time, we give up.\n\
1940 A value of 0 means wait as long as necessary. This is initialized from the\n\ 1941 A value of 0 means wait as long as necessary. This is initialized from the\n\
1941 \"*selectionTimeout\" resource (which is expressed in milliseconds)."); 1942 \"*selectionTimeout\" resource.");
1942 x_selection_timeout = 0; 1943 x_selection_timeout = 0;
1943 1944
1944 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); 1945 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
1945 QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); 1946 QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY);
1946 QSTRING = intern ("STRING"); staticpro (&QSTRING); 1947 QSTRING = intern ("STRING"); staticpro (&QSTRING);