Mercurial > emacs
comparison src/xterm.c @ 4683:6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
instead of dup2. Use the existing X desc number in fcntl calls.
(XTread_socket): Don't forget to clear out `mask'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 08 Sep 1993 17:53:49 +0000 |
parents | 70247ce8b381 |
children | 1fc792473491 |
comparison
equal
deleted
inserted
replaced
4682:c4d471244116 | 4683:6a5197116086 |
---|---|
3354 Act as if there had been a hangup. */ | 3354 Act as if there had been a hangup. */ |
3355 int fd = ConnectionNumber (x_current_display); | 3355 int fd = ConnectionNumber (x_current_display); |
3356 SELECT_TYPE mask; | 3356 SELECT_TYPE mask; |
3357 EMACS_TIME timeout; | 3357 EMACS_TIME timeout; |
3358 | 3358 |
3359 FD_SET(fd, &mask); | 3359 FD_ZERO (&mask); |
3360 FD_SET (fd, &mask); | |
3360 EMACS_SET_SECS_USECS (timeout, 0, 0); | 3361 EMACS_SET_SECS_USECS (timeout, 0, 0); |
3361 if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, &timeout) | 3362 if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, &timeout) |
3362 && !XStuffPending ()) | 3363 && !XStuffPending ()) |
3363 kill (getpid (), SIGHUP); | 3364 kill (getpid (), SIGHUP); |
3364 } | 3365 } |
3365 #endif /* ! defined (HAVE_SELECT) */ | 3366 #endif /* HAVE_SELECT */ |
3366 | 3367 |
3367 #ifndef HAVE_X11 | 3368 #ifndef HAVE_X11 |
3368 if (updating_frame == 0) | 3369 if (updating_frame == 0) |
3369 x_do_pending_expose (); | 3370 x_do_pending_expose (); |
3370 #endif | 3371 #endif |
4870 to figure out when to invalidate our cache of the cut buffers. */ | 4871 to figure out when to invalidate our cache of the cut buffers. */ |
4871 x_watch_cut_buffer_cache (); | 4872 x_watch_cut_buffer_cache (); |
4872 #endif | 4873 #endif |
4873 | 4874 |
4874 if (ConnectionNumber (x_current_display) != 0) | 4875 if (ConnectionNumber (x_current_display) != 0) |
4875 { | 4876 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display)); |
4876 dup2 (ConnectionNumber (x_current_display), 0); | 4877 change_input_fd (ConnectionNumber (x_current_display)); |
4877 | |
4878 #ifndef SYSV_STREAMS | |
4879 /* Streams somehow keeps track of which descriptor number | |
4880 is being used to talk to X. So it is not safe to substitute | |
4881 descriptor 0. But it is safe to make descriptor 0 a copy of it. */ | |
4882 close (ConnectionNumber (x_current_display)); | |
4883 ConnectionNumber (x_current_display) = 0; /* Looks a little strange? | |
4884 * check the def of the macro; | |
4885 * it is a genuine lvalue */ | |
4886 #endif /* SYSV_STREAMS */ | |
4887 } | |
4888 | 4878 |
4889 #endif /* ! defined (HAVE_X11) */ | 4879 #endif /* ! defined (HAVE_X11) */ |
4890 | 4880 |
4891 #ifndef F_SETOWN_BUG | 4881 #ifndef F_SETOWN_BUG |
4892 #ifdef F_SETOWN | 4882 #ifdef F_SETOWN |
4893 old_fcntl_owner = fcntl (0, F_GETOWN, 0); | 4883 old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0); |
4894 #ifdef F_SETOWN_SOCK_NEG | 4884 #ifdef F_SETOWN_SOCK_NEG |
4895 fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */ | 4885 /* stdin is a socket here */ |
4886 fcntl (ConnectionNumber (x_current_display), F_SETOWN, -getpid ()); | |
4896 #else /* ! defined (F_SETOWN_SOCK_NEG) */ | 4887 #else /* ! defined (F_SETOWN_SOCK_NEG) */ |
4897 fcntl (0, F_SETOWN, getpid ()); | 4888 fcntl (ConnectionNumber (x_current_display), F_SETOWN, getpid ()); |
4898 #endif /* ! defined (F_SETOWN_SOCK_NEG) */ | 4889 #endif /* ! defined (F_SETOWN_SOCK_NEG) */ |
4899 #endif /* ! defined (F_SETOWN) */ | 4890 #endif /* ! defined (F_SETOWN) */ |
4900 #endif /* F_SETOWN_BUG */ | 4891 #endif /* F_SETOWN_BUG */ |
4901 | 4892 |
4902 #ifdef SIGIO | 4893 #ifdef SIGIO |