Mercurial > emacs
comparison src/xterm.c @ 27040:900a02429efa
(x_make_frame_visible): Wait for frame becoming visible
differently.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 30 Dec 1999 11:42:34 +0000 |
parents | d7f15cd9c4ad |
children | c8b20597f0fd |
comparison
equal
deleted
inserted
replaced
27039:33ace107e6cc | 27040:900a02429efa |
---|---|
11296 /* Synchronize to ensure Emacs knows the frame is visible | 11296 /* Synchronize to ensure Emacs knows the frame is visible |
11297 before we do anything else. We do this loop with input not blocked | 11297 before we do anything else. We do this loop with input not blocked |
11298 so that incoming events are handled. */ | 11298 so that incoming events are handled. */ |
11299 { | 11299 { |
11300 Lisp_Object frame; | 11300 Lisp_Object frame; |
11301 int count = input_signal_count; | 11301 int count; |
11302 /* This must be before UNBLOCK_INPUT | 11302 /* This must be before UNBLOCK_INPUT |
11303 since events that arrive in response to the actions above | 11303 since events that arrive in response to the actions above |
11304 will set it when they are handled. */ | 11304 will set it when they are handled. */ |
11305 int previously_visible = f->output_data.x->has_been_visible; | 11305 int previously_visible = f->output_data.x->has_been_visible; |
11306 | 11306 |
11348 UNBLOCK_INPUT; | 11348 UNBLOCK_INPUT; |
11349 } | 11349 } |
11350 | 11350 |
11351 XSETFRAME (frame, f); | 11351 XSETFRAME (frame, f); |
11352 | 11352 |
11353 while (1) | 11353 /* Wait until the frame is visible. Process X events until a |
11354 MapNotify event has been seen, or until we think we won't get a | |
11355 MapNotify at all.. */ | |
11356 for (count = input_signal_count + 10; | |
11357 input_signal_count < count && !FRAME_VISIBLE_P (f);) | |
11354 { | 11358 { |
11359 /* Force processing of queued events. */ | |
11355 x_sync (f); | 11360 x_sync (f); |
11356 /* Once we have handled input events, | 11361 |
11357 we should have received the MapNotify if one is coming. | 11362 /* Machines that do polling rather than SIGIO have been |
11358 So if we have not got it yet, stop looping. | 11363 observed to go into a busy-wait here. So we'll fake an |
11359 Some window managers make their own decisions | 11364 alarm signal to let the handler know that there's something |
11360 about visibility. */ | 11365 to be read. We used to raise a real alarm, but it seems |
11361 if (input_signal_count != count) | 11366 that the handler isn't always enabled here. This is |
11362 break; | 11367 probably a bug. */ |
11363 /* Machines that do polling rather than SIGIO have been observed | |
11364 to go into a busy-wait here. So we'll fake an alarm signal | |
11365 to let the handler know that there's something to be read. | |
11366 We used to raise a real alarm, but it seems that the handler | |
11367 isn't always enabled here. This is probably a bug. */ | |
11368 if (input_polling_used ()) | 11368 if (input_polling_used ()) |
11369 { | 11369 { |
11370 /* It could be confusing if a real alarm arrives while processing | 11370 /* It could be confusing if a real alarm arrives while |
11371 the fake one. Turn it off and let the handler reset it. */ | 11371 processing the fake one. Turn it off and let the |
11372 handler reset it. */ | |
11372 alarm (0); | 11373 alarm (0); |
11373 input_poll_signal (0); | 11374 input_poll_signal (0); |
11374 } | 11375 } |
11375 /* Once we have handled input events, | 11376 |
11376 we should have received the MapNotify if one is coming. | 11377 /* See if a MapNotify event has been processed. */ |
11377 So if we have not got it yet, stop looping. | 11378 FRAME_SAMPLE_VISIBILITY (f); |
11378 Some window managers make their own decisions | |
11379 about visibility. */ | |
11380 if (input_signal_count != count) | |
11381 break; | |
11382 } | 11379 } |
11383 FRAME_SAMPLE_VISIBILITY (f); | |
11384 } | 11380 } |
11385 } | 11381 } |
11386 | 11382 |
11387 /* Change from mapped state to withdrawn state. */ | 11383 /* Change from mapped state to withdrawn state. */ |
11388 | 11384 |