Mercurial > emacs
comparison src/xterm.c @ 9337:7b933936a676
(input_signal_count): New variable.
(XTread_socket): Increment it.
(x_make_frame_visible): Exit final loop when XTread_sockets has run.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 04 Oct 1994 19:38:53 +0000 |
parents | 84c4f61445c9 |
children | 873508897cc2 |
comparison
equal
deleted
inserted
replaced
9336:d5ffd9c9edb0 | 9337:7b933936a676 |
---|---|
285 static FRAME_PTR mouse_face_mouse_frame; | 285 static FRAME_PTR mouse_face_mouse_frame; |
286 static int mouse_face_mouse_x, mouse_face_mouse_y; | 286 static int mouse_face_mouse_x, mouse_face_mouse_y; |
287 | 287 |
288 /* Nonzero means defer mouse-motion highlighting. */ | 288 /* Nonzero means defer mouse-motion highlighting. */ |
289 static int mouse_face_defer; | 289 static int mouse_face_defer; |
290 | |
291 /* Incremented by XTread_socket whenever it really tries to read events. */ | |
292 #ifdef __STDC__ | |
293 static int volatile input_signal_count; | |
294 #else | |
295 static int input_signal_count; | |
296 #endif | |
290 | 297 |
291 /* `t' if a mouse button is depressed. */ | 298 /* `t' if a mouse button is depressed. */ |
292 | 299 |
293 extern Lisp_Object Vmouse_depressed; | 300 extern Lisp_Object Vmouse_depressed; |
294 | 301 |
3164 return -1; | 3171 return -1; |
3165 } | 3172 } |
3166 | 3173 |
3167 interrupt_input_pending = 0; | 3174 interrupt_input_pending = 0; |
3168 BLOCK_INPUT; | 3175 BLOCK_INPUT; |
3169 | 3176 |
3177 /* So people can tell when we have read the available input. */ | |
3178 input_signal_count++; | |
3179 | |
3170 if (numchars <= 0) | 3180 if (numchars <= 0) |
3171 abort (); /* Don't think this happens. */ | 3181 abort (); /* Don't think this happens. */ |
3172 | 3182 |
3173 #ifdef FIOSNBIO | 3183 #ifdef FIOSNBIO |
3174 /* If available, Xlib uses FIOSNBIO to make the socket | 3184 /* If available, Xlib uses FIOSNBIO to make the socket |
4903 x_raise_frame (f); | 4913 x_raise_frame (f); |
4904 else | 4914 else |
4905 x_lower_frame (f); | 4915 x_lower_frame (f); |
4906 } | 4916 } |
4907 | 4917 |
4908 | |
4909 /* Change from withdrawn state to mapped state, | 4918 /* Change from withdrawn state to mapped state, |
4910 or deiconify. */ | 4919 or deiconify. */ |
4911 | 4920 |
4912 x_make_frame_visible (f) | 4921 x_make_frame_visible (f) |
4913 struct frame *f; | 4922 struct frame *f; |
4939 #endif | 4948 #endif |
4940 } | 4949 } |
4941 | 4950 |
4942 XFlushQueue (); | 4951 XFlushQueue (); |
4943 | 4952 |
4944 UNBLOCK_INPUT; | |
4945 | |
4946 /* Synchronize to ensure Emacs knows the frame is visible | 4953 /* Synchronize to ensure Emacs knows the frame is visible |
4947 before we do anything else. We do this loop with input not blocked | 4954 before we do anything else. We do this loop with input not blocked |
4948 so that incoming events are handled. */ | 4955 so that incoming events are handled. */ |
4949 { | 4956 { |
4950 Lisp_Object frame; | 4957 Lisp_Object frame; |
4958 int count = input_signal_count; | |
4959 | |
4960 /* This must come after we set COUNT. */ | |
4961 UNBLOCK_INPUT; | |
4962 | |
4951 XSET (frame, Lisp_Frame, f); | 4963 XSET (frame, Lisp_Frame, f); |
4952 while (! f->async_visible) | 4964 |
4965 while (1) | |
4953 { | 4966 { |
4954 x_sync (frame); | 4967 x_sync (frame); |
4968 /* Once we have handled input events, | |
4969 we should have received the MapNotify if one is coming. | |
4970 So if we have not got it yet, stop looping. | |
4971 Some window managers make their own decisions | |
4972 about visibility. */ | |
4973 if (input_signal_count != count) | |
4974 break; | |
4955 /* Machines that do polling rather than SIGIO have been observed | 4975 /* Machines that do polling rather than SIGIO have been observed |
4956 to go into a busy-wait here. So we'll fake an alarm signal | 4976 to go into a busy-wait here. So we'll fake an alarm signal |
4957 to let the handler know that there's something to be read. | 4977 to let the handler know that there's something to be read. |
4958 We used to raise a real alarm, but it seems that the handler | 4978 We used to raise a real alarm, but it seems that the handler |
4959 isn't always enabled here. This is probably a bug. */ | 4979 isn't always enabled here. This is probably a bug. */ |
4962 /* It could be confusing if a real alarm arrives while processing | 4982 /* It could be confusing if a real alarm arrives while processing |
4963 the fake one. Turn it off and let the handler reset it. */ | 4983 the fake one. Turn it off and let the handler reset it. */ |
4964 alarm (0); | 4984 alarm (0); |
4965 input_poll_signal (); | 4985 input_poll_signal (); |
4966 } | 4986 } |
4987 /* Once we have handled input events, | |
4988 we should have received the MapNotify if one is coming. | |
4989 So if we have not got it yet, stop looping. | |
4990 Some window managers make their own decisions | |
4991 about visibility. */ | |
4992 if (input_signal_count != count) | |
4993 break; | |
4967 } | 4994 } |
4968 FRAME_SAMPLE_VISIBILITY (f); | 4995 FRAME_SAMPLE_VISIBILITY (f); |
4969 } | 4996 } |
4970 } | 4997 } |
4971 | 4998 |