aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-12-06 09:49:05 +0400
committerDmitry Antipov2013-12-06 09:49:05 +0400
commit64ed4306fc76b2b5386deef8cdd101a2dfe13b74 (patch)
tree7df684934a1aeedd645ff77e818edc6dca3f6ead /src/xterm.c
parentb2856a6f7cbd625e195b5bfb7a87925ebc4c22f8 (diff)
downloademacs-64ed4306fc76b2b5386deef8cdd101a2dfe13b74.tar.gz
emacs-64ed4306fc76b2b5386deef8cdd101a2dfe13b74.zip
* xterm.c (input_signal_count): Remove.
(x_dispatch_event): Define unconditionally. (x_make_frame_visible): Process X events until the frame is really visible (Bug#16027). * xterm.h (x_dispatch_event): Declare unconditionally.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/src/xterm.c b/src/xterm.c
index b1e773c437b..e8e69c666ee 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -165,11 +165,6 @@ static bool toolkit_scroll_bar_interaction;
165 165
166static Time ignore_next_mouse_click_timeout; 166static Time ignore_next_mouse_click_timeout;
167 167
168/* Incremented by XTread_socket whenever it really tries to read
169 events. */
170
171static int volatile input_signal_count;
172
173/* Used locally within XTread_socket. */ 168/* Used locally within XTread_socket. */
174 169
175static int x_noop_count; 170static int x_noop_count;
@@ -253,9 +248,6 @@ static void x_sync_with_move (struct frame *, int, int, int);
253static int handle_one_xevent (struct x_display_info *, 248static int handle_one_xevent (struct x_display_info *,
254 const XEvent *, int *, 249 const XEvent *, int *,
255 struct input_event *); 250 struct input_event *);
256#ifdef USE_GTK
257static int x_dispatch_event (XEvent *, Display *);
258#endif
259/* Don't declare this _Noreturn because we want no 251/* Don't declare this _Noreturn because we want no
260 interference with debugging failing X calls. */ 252 interference with debugging failing X calls. */
261static void x_connection_closed (Display *, const char *); 253static void x_connection_closed (Display *, const char *);
@@ -6853,8 +6845,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6853 return count; 6845 return count;
6854} 6846}
6855 6847
6856#if defined USE_GTK || defined USE_X_TOOLKIT
6857
6858/* Handles the XEvent EVENT on display DISPLAY. 6848/* Handles the XEvent EVENT on display DISPLAY.
6859 This is used for event loops outside the normal event handling, 6849 This is used for event loops outside the normal event handling,
6860 i.e. looping while a popup menu or a dialog is posted. 6850 i.e. looping while a popup menu or a dialog is posted.
@@ -6873,8 +6863,6 @@ x_dispatch_event (XEvent *event, Display *display)
6873 6863
6874 return finish; 6864 return finish;
6875} 6865}
6876#endif
6877
6878 6866
6879/* Read events coming from the X server. 6867/* Read events coming from the X server.
6880 Return as soon as there are no more events to be read. 6868 Return as soon as there are no more events to be read.
@@ -6893,9 +6881,6 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
6893 6881
6894 block_input (); 6882 block_input ();
6895 6883
6896 /* So people can tell when we have read the available input. */
6897 input_signal_count++;
6898
6899 /* For debugging, this gives a way to fake an I/O error. */ 6884 /* For debugging, this gives a way to fake an I/O error. */
6900 if (dpyinfo == XTread_socket_fake_io_error) 6885 if (dpyinfo == XTread_socket_fake_io_error)
6901 { 6886 {
@@ -8826,9 +8811,6 @@ void
8826x_make_frame_visible (struct frame *f) 8811x_make_frame_visible (struct frame *f)
8827{ 8812{
8828 int original_top, original_left; 8813 int original_top, original_left;
8829 int retry_count = 2;
8830
8831 retry:
8832 8814
8833 block_input (); 8815 block_input ();
8834 8816
@@ -8877,7 +8859,6 @@ x_make_frame_visible (struct frame *f)
8877 so that incoming events are handled. */ 8859 so that incoming events are handled. */
8878 { 8860 {
8879 Lisp_Object frame; 8861 Lisp_Object frame;
8880 int count;
8881 /* This must be before UNBLOCK_INPUT 8862 /* This must be before UNBLOCK_INPUT
8882 since events that arrive in response to the actions above 8863 since events that arrive in response to the actions above
8883 will set it when they are handled. */ 8864 will set it when they are handled. */
@@ -8931,46 +8912,18 @@ x_make_frame_visible (struct frame *f)
8931 8912
8932 XSETFRAME (frame, f); 8913 XSETFRAME (frame, f);
8933 8914
8934 /* Wait until the frame is visible. Process X events until a 8915 /* Process X events until a MapNotify event has been seen. */
8935 MapNotify event has been seen, or until we think we won't get a 8916 while (!FRAME_VISIBLE_P (f))
8936 MapNotify at all.. */
8937 for (count = input_signal_count + 10;
8938 input_signal_count < count && !FRAME_VISIBLE_P (f);)
8939 { 8917 {
8940 /* Force processing of queued events. */ 8918 /* Force processing of queued events. */
8941 x_sync (f); 8919 x_sync (f);
8942 8920 if (XPending (FRAME_X_DISPLAY (f)))
8943 /* Machines that do polling rather than SIGIO have been
8944 observed to go into a busy-wait here. So we'll fake an
8945 alarm signal to let the handler know that there's something
8946 to be read. We used to raise a real alarm, but it seems
8947 that the handler isn't always enabled here. This is
8948 probably a bug. */
8949 if (input_polling_used ())
8950 { 8921 {
8951 /* It could be confusing if a real alarm arrives while 8922 XEvent xev;
8952 processing the fake one. Turn it off and let the 8923 XNextEvent (FRAME_X_DISPLAY (f), &xev);
8953 handler reset it. */ 8924 x_dispatch_event (&xev, FRAME_X_DISPLAY (f));
8954 int old_poll_suppress_count = poll_suppress_count;
8955 poll_suppress_count = 1;
8956 poll_for_input_1 ();
8957 poll_suppress_count = old_poll_suppress_count;
8958 } 8925 }
8959 } 8926 }
8960
8961 /* 2000-09-28: In
8962
8963 (let ((f (selected-frame)))
8964 (iconify-frame f)
8965 (raise-frame f))
8966
8967 the frame is not raised with various window managers on
8968 FreeBSD, GNU/Linux and Solaris. It turns out that, for some
8969 unknown reason, the call to XtMapWidget is completely ignored.
8970 Mapping the widget a second time works. */
8971
8972 if (!FRAME_VISIBLE_P (f) && --retry_count != 0)
8973 goto retry;
8974 } 8927 }
8975} 8928}
8976 8929