From 9654230233e49cf93e6a8f38685e4b809f02789e Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 12 Dec 2013 08:04:35 +0400 Subject: [PATCH] * xterm.c (x_make_frame_visible): Restore hack which is needed when input polling is used. This is still meaningful for Cygwin, see http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. * keyboard.c (poll_for_input_1, input_polling_used): Define unconditionally. --- src/ChangeLog | 8 ++++++++ src/keyboard.c | 5 ----- src/xterm.c | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 89c640bd8c7..60258810fe2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2013-12-12 Dmitry Antipov + + * xterm.c (x_make_frame_visible): Restore hack which is needed when + input polling is used. This is still meaningful for Cygwin, see + http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. + * keyboard.c (poll_for_input_1, input_polling_used): Define + unconditionally. + 2013-12-11 Ken Brown * dispextern.h (erase_phys_cursor): diff --git a/src/keyboard.c b/src/keyboard.c index 913a277ca79..915ce9dcf23 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1954,7 +1954,6 @@ int poll_suppress_count; static struct atimer *poll_timer; -#ifdef HAVE_NTGUI /* Poll for input, so that we catch a C-g if it comes in. */ void poll_for_input_1 (void) @@ -1963,7 +1962,6 @@ poll_for_input_1 (void) && !waiting_for_input) gobble_input (); } -#endif /* Timer callback function for poll_timer. TIMER is equal to poll_timer. */ @@ -2015,8 +2013,6 @@ start_polling (void) #endif } -#ifdef HAVE_NTGUI - /* True if we are using polling to handle input asynchronously. */ bool @@ -2031,7 +2027,6 @@ input_polling_used (void) return 0; #endif } -#endif /* Turn off polling. */ diff --git a/src/xterm.c b/src/xterm.c index 2c5c01baa84..8498382511b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8923,6 +8923,27 @@ x_make_frame_visible (struct frame *f) { /* Force processing of queued events. */ x_sync (f); + + /* This hack is still in use at least for Cygwin. See + http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. + + Machines that do polling rather than SIGIO have been + observed to go into a busy-wait here. So we'll fake an + alarm signal to let the handler know that there's something + to be read. We used to raise a real alarm, but it seems + that the handler isn't always enabled here. This is + probably a bug. */ + if (input_polling_used ()) + { + /* It could be confusing if a real alarm arrives while + processing the fake one. Turn it off and let the + handler reset it. */ + int old_poll_suppress_count = poll_suppress_count; + poll_suppress_count = 1; + poll_for_input_1 (); + poll_suppress_count = old_poll_suppress_count; + } + if (XPending (FRAME_X_DISPLAY (f))) { XEvent xev; -- 2.39.2