aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2017-01-13 19:47:22 -0500
committerNoam Postavsky2017-01-20 23:36:26 -0500
commit6a788d2fc18c23dcfc5d0352649b2f690e9cbff7 (patch)
tree25f37dfc5979a35534f5046bdc5ada929037d866
parente5e42cefd7f2eb47d2c8660a7a317e8b08d36a82 (diff)
downloademacs-6a788d2fc18c23dcfc5d0352649b2f690e9cbff7.tar.gz
emacs-6a788d2fc18c23dcfc5d0352649b2f690e9cbff7.zip
Don't wait for frame to become visible
* src/xterm.c (x_make_frame_visible): Remove code that waits for the frame to become visible. We have to deal with invisible frames anyway, the loop could sometimes before the frame turned visible, and for some window managers (e.g., XMonad, i3wm) it caused Emacs to get stuck in a busy loop (Bug#24091).
-rw-r--r--src/xterm.c58
1 files changed, 4 insertions, 54 deletions
diff --git a/src/xterm.c b/src/xterm.c
index adc02e2768d..db561c902a6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10993,19 +10993,12 @@ xembed_send_message (struct frame *f, Time t, enum xembed_message msg,
10993 10993
10994/* Change of visibility. */ 10994/* Change of visibility. */
10995 10995
10996/* This tries to wait until the frame is really visible. 10996/* This function sends the request to make the frame visible, but may
10997 However, if the window manager asks the user where to position 10997 return before it the frame's visibility is changed. */
10998 the frame, this will return before the user finishes doing that.
10999 The frame will not actually be visible at that time,
11000 but it will become visible later when the window manager
11001 finishes with it. */
11002 10998
11003void 10999void
11004x_make_frame_visible (struct frame *f) 11000x_make_frame_visible (struct frame *f)
11005{ 11001{
11006 int original_top, original_left;
11007 int tries = 0;
11008
11009 block_input (); 11002 block_input ();
11010 11003
11011 x_set_bitmap_icon (f); 11004 x_set_bitmap_icon (f);
@@ -11052,16 +11045,13 @@ x_make_frame_visible (struct frame *f)
11052 before we do anything else. We do this loop with input not blocked 11045 before we do anything else. We do this loop with input not blocked
11053 so that incoming events are handled. */ 11046 so that incoming events are handled. */
11054 { 11047 {
11055 Lisp_Object frame;
11056 /* This must be before UNBLOCK_INPUT 11048 /* This must be before UNBLOCK_INPUT
11057 since events that arrive in response to the actions above 11049 since events that arrive in response to the actions above
11058 will set it when they are handled. */ 11050 will set it when they are handled. */
11059 bool previously_visible = f->output_data.x->has_been_visible; 11051 bool previously_visible = f->output_data.x->has_been_visible;
11060 11052
11061 XSETFRAME (frame, f); 11053 int original_left = f->left_pos;
11062 11054 int original_top = f->top_pos;
11063 original_left = f->left_pos;
11064 original_top = f->top_pos;
11065 11055
11066 /* This must come after we set COUNT. */ 11056 /* This must come after we set COUNT. */
11067 unblock_input (); 11057 unblock_input ();
@@ -11105,46 +11095,6 @@ x_make_frame_visible (struct frame *f)
11105 11095
11106 unblock_input (); 11096 unblock_input ();
11107 } 11097 }
11108
11109 /* Process X events until a MapNotify event has been seen. */
11110 while (!FRAME_VISIBLE_P (f))
11111 {
11112 /* Force processing of queued events. */
11113 x_sync (f);
11114
11115 /* If on another desktop, the deiconify/map may be ignored and the
11116 frame never becomes visible. XMonad does this.
11117 Prevent an endless loop. */
11118 if (FRAME_ICONIFIED_P (f) && ++tries > 100)
11119 break;
11120
11121 /* This hack is still in use at least for Cygwin. See
11122 http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
11123
11124 Machines that do polling rather than SIGIO have been
11125 observed to go into a busy-wait here. So we'll fake an
11126 alarm signal to let the handler know that there's something
11127 to be read. We used to raise a real alarm, but it seems
11128 that the handler isn't always enabled here. This is
11129 probably a bug. */
11130 if (input_polling_used ())
11131 {
11132 /* It could be confusing if a real alarm arrives while
11133 processing the fake one. Turn it off and let the
11134 handler reset it. */
11135 int old_poll_suppress_count = poll_suppress_count;
11136 poll_suppress_count = 1;
11137 poll_for_input_1 ();
11138 poll_suppress_count = old_poll_suppress_count;
11139 }
11140
11141 if (XPending (FRAME_X_DISPLAY (f)))
11142 {
11143 XEvent xev;
11144 XNextEvent (FRAME_X_DISPLAY (f), &xev);
11145 x_dispatch_event (&xev, FRAME_X_DISPLAY (f));
11146 }
11147 }
11148 } 11098 }
11149} 11099}
11150 11100