diff options
| author | Gerd Moellmann | 2000-01-25 15:55:13 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-01-25 15:55:13 +0000 |
| commit | bffcfca9242ee5cdcabe135ded69bf96fc86a1f3 (patch) | |
| tree | 95a9b84221eb03758c706d137559377d09bf40f6 /src/xterm.c | |
| parent | acb137e591de51bfbfcb843511e66c8a2c6955ae (diff) | |
| download | emacs-bffcfca9242ee5cdcabe135ded69bf96fc86a1f3.tar.gz emacs-bffcfca9242ee5cdcabe135ded69bf96fc86a1f3.zip | |
(toplevel): Include atimer.h.
(toolkit_scroll_bar_interaction): New variable.
(Fxt_process_timeouts): Removed.
(x_process_timeouts): New function.
(xt_action_hook): Clear toolkit_scroll_bar_interaction.
(x_send_scroll_bar_event): Set toolkit_scroll_bar_interaction.
(x_make_frame_visible): Call poll_for_input_1 instead of
input_poll_signal. Don't call alarm.
(x_initialize): Install timer calling x_process_timeouts.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/src/xterm.c b/src/xterm.c index 0f2c50fcbce..ddcca1cb1a5 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -88,6 +88,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 88 | #include "keyboard.h" | 88 | #include "keyboard.h" |
| 89 | #include "intervals.h" | 89 | #include "intervals.h" |
| 90 | #include "process.h" | 90 | #include "process.h" |
| 91 | #include "atimer.h" | ||
| 91 | 92 | ||
| 92 | #ifdef USE_X_TOOLKIT | 93 | #ifdef USE_X_TOOLKIT |
| 93 | #include <X11/Shell.h> | 94 | #include <X11/Shell.h> |
| @@ -298,6 +299,9 @@ static String Xt_default_resources[] = {0}; | |||
| 298 | 299 | ||
| 299 | struct cursor_pos output_cursor; | 300 | struct cursor_pos output_cursor; |
| 300 | 301 | ||
| 302 | /* Non-zero means user is interacting with a toolkit scroll bar. */ | ||
| 303 | |||
| 304 | static int toolkit_scroll_bar_interaction; | ||
| 301 | 305 | ||
| 302 | /* Mouse movement. | 306 | /* Mouse movement. |
| 303 | 307 | ||
| @@ -7178,21 +7182,27 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 7178 | } | 7182 | } |
| 7179 | 7183 | ||
| 7180 | 7184 | ||
| 7181 | DEFUN ("xt-process-timeouts", Fxt_process_timeouts, Sxt_process_timeouts, | ||
| 7182 | 0, 0, 0, | ||
| 7183 | "Arrange for Xt timeout callbacks to be called.") | ||
| 7184 | () | ||
| 7185 | { | ||
| 7186 | #ifdef USE_X_TOOLKIT | 7185 | #ifdef USE_X_TOOLKIT |
| 7187 | BLOCK_INPUT; | 7186 | |
| 7188 | while (XtAppPending (Xt_app_con) & XtIMTimer) | 7187 | /* Atimer callback function for TIMER. Called every 0.1s to process |
| 7189 | XtAppProcessEvent (Xt_app_con, XtIMTimer); | 7188 | Xt timeouts, if needed. We must avoid calling XtAppPending as |
| 7190 | UNBLOCK_INPUT; | 7189 | much as possible because that function does an implicit XFlush |
| 7191 | #endif /* USE_X_TOOLKIT */ | 7190 | that slows us down. */ |
| 7192 | 7191 | ||
| 7193 | return Qnil; | 7192 | static void |
| 7193 | x_process_timeouts (timer) | ||
| 7194 | struct atimer *timer; | ||
| 7195 | { | ||
| 7196 | if (toolkit_scroll_bar_interaction || popup_activated_flag) | ||
| 7197 | { | ||
| 7198 | BLOCK_INPUT; | ||
| 7199 | while (XtAppPending (Xt_app_con) & XtIMTimer) | ||
| 7200 | XtAppProcessEvent (Xt_app_con, XtIMTimer); | ||
| 7201 | UNBLOCK_INPUT; | ||
| 7202 | } | ||
| 7194 | } | 7203 | } |
| 7195 | 7204 | ||
| 7205 | #endif /* USE_X_TOOLKIT */ | ||
| 7196 | 7206 | ||
| 7197 | 7207 | ||
| 7198 | /* Scroll bar support. */ | 7208 | /* Scroll bar support. */ |
| @@ -7200,6 +7210,7 @@ DEFUN ("xt-process-timeouts", Fxt_process_timeouts, Sxt_process_timeouts, | |||
| 7200 | /* Given an X window ID, find the struct scroll_bar which manages it. | 7210 | /* Given an X window ID, find the struct scroll_bar which manages it. |
| 7201 | This can be called in GC, so we have to make sure to strip off mark | 7211 | This can be called in GC, so we have to make sure to strip off mark |
| 7202 | bits. */ | 7212 | bits. */ |
| 7213 | |||
| 7203 | static struct scroll_bar * | 7214 | static struct scroll_bar * |
| 7204 | x_window_to_scroll_bar (window_id) | 7215 | x_window_to_scroll_bar (window_id) |
| 7205 | Window window_id; | 7216 | Window window_id; |
| @@ -7301,8 +7312,6 @@ xt_action_hook (widget, client_data, action_name, event, params, | |||
| 7301 | end_action = "EndScroll"; | 7312 | end_action = "EndScroll"; |
| 7302 | #endif /* USE_MOTIF */ | 7313 | #endif /* USE_MOTIF */ |
| 7303 | 7314 | ||
| 7304 | /* Although LessTif uses XtTimeouts like Xaw3d, the timer hack to | ||
| 7305 | let Xt timeouts be processed doesn't work. */ | ||
| 7306 | if (scroll_bar_p | 7315 | if (scroll_bar_p |
| 7307 | && strcmp (action_name, end_action) == 0 | 7316 | && strcmp (action_name, end_action) == 0 |
| 7308 | && WINDOWP (window_being_scrolled)) | 7317 | && WINDOWP (window_being_scrolled)) |
| @@ -7315,6 +7324,9 @@ xt_action_hook (widget, client_data, action_name, event, params, | |||
| 7315 | XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; | 7324 | XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; |
| 7316 | window_being_scrolled = Qnil; | 7325 | window_being_scrolled = Qnil; |
| 7317 | last_scroll_bar_part = -1; | 7326 | last_scroll_bar_part = -1; |
| 7327 | |||
| 7328 | /* Xt timeouts no longer needed. */ | ||
| 7329 | toolkit_scroll_bar_interaction = 0; | ||
| 7318 | } | 7330 | } |
| 7319 | } | 7331 | } |
| 7320 | 7332 | ||
| @@ -7345,6 +7357,9 @@ x_send_scroll_bar_event (window, part, portion, whole) | |||
| 7345 | ev->data.l[3] = (long) portion; | 7357 | ev->data.l[3] = (long) portion; |
| 7346 | ev->data.l[4] = (long) whole; | 7358 | ev->data.l[4] = (long) whole; |
| 7347 | 7359 | ||
| 7360 | /* Make Xt timeouts work while the scroll bar is active. */ | ||
| 7361 | toolkit_scroll_bar_interaction = 1; | ||
| 7362 | |||
| 7348 | /* Setting the event mask to zero means that the message will | 7363 | /* Setting the event mask to zero means that the message will |
| 7349 | be sent to the client that created the window, and if that | 7364 | be sent to the client that created the window, and if that |
| 7350 | window no longer exists, no event will be sent. */ | 7365 | window no longer exists, no event will be sent. */ |
| @@ -11370,8 +11385,10 @@ x_make_frame_visible (f) | |||
| 11370 | /* It could be confusing if a real alarm arrives while | 11385 | /* It could be confusing if a real alarm arrives while |
| 11371 | processing the fake one. Turn it off and let the | 11386 | processing the fake one. Turn it off and let the |
| 11372 | handler reset it. */ | 11387 | handler reset it. */ |
| 11373 | alarm (0); | 11388 | int old_poll_suppress_count = poll_suppress_count; |
| 11374 | input_poll_signal (0); | 11389 | poll_suppress_count = 1; |
| 11390 | poll_for_input_1 (); | ||
| 11391 | poll_suppress_count = old_poll_suppress_count; | ||
| 11375 | } | 11392 | } |
| 11376 | 11393 | ||
| 11377 | /* See if a MapNotify event has been processed. */ | 11394 | /* See if a MapNotify event has been processed. */ |
| @@ -12918,8 +12935,7 @@ x_delete_display (dpyinfo) | |||
| 12918 | tail = x_display_name_list; | 12935 | tail = x_display_name_list; |
| 12919 | while (CONSP (tail) && CONSP (XCDR (tail))) | 12936 | while (CONSP (tail) && CONSP (XCDR (tail))) |
| 12920 | { | 12937 | { |
| 12921 | if (EQ (XCAR (XCDR (tail)), | 12938 | if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element)) |
| 12922 | dpyinfo->name_list_element)) | ||
| 12923 | { | 12939 | { |
| 12924 | XCDR (tail) = XCDR (XCDR (tail)); | 12940 | XCDR (tail) = XCDR (XCDR (tail)); |
| 12925 | break; | 12941 | break; |
| @@ -13017,7 +13033,19 @@ x_initialize () | |||
| 13017 | XtToolkitInitialize (); | 13033 | XtToolkitInitialize (); |
| 13018 | Xt_app_con = XtCreateApplicationContext (); | 13034 | Xt_app_con = XtCreateApplicationContext (); |
| 13019 | XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); | 13035 | XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); |
| 13036 | |||
| 13037 | /* Install an asynchronous timer that processes Xt timeout events | ||
| 13038 | every 0.1s. This is necessary because some widget sets use | ||
| 13039 | timeouts internally, for example the LessTif menu bar, or the | ||
| 13040 | Xaw3d scroll bar. When Xt timouts aren't processed, these | ||
| 13041 | widgets don't behave normally. */ | ||
| 13042 | { | ||
| 13043 | EMACS_TIME interval; | ||
| 13044 | EMACS_SET_SECS_USECS (interval, 0, 100000); | ||
| 13045 | start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); | ||
| 13046 | } | ||
| 13020 | #endif | 13047 | #endif |
| 13048 | |||
| 13021 | #if USE_TOOLKIT_SCROLL_BARS | 13049 | #if USE_TOOLKIT_SCROLL_BARS |
| 13022 | xaw3d_arrow_scroll = False; | 13050 | xaw3d_arrow_scroll = False; |
| 13023 | xaw3d_pick_top = True; | 13051 | xaw3d_pick_top = True; |
| @@ -13074,7 +13102,6 @@ wide as that tab on the display."); | |||
| 13074 | x_toolkit_scroll_bars_p = 0; | 13102 | x_toolkit_scroll_bars_p = 0; |
| 13075 | #endif | 13103 | #endif |
| 13076 | 13104 | ||
| 13077 | defsubr (&Sxt_process_timeouts); | ||
| 13078 | staticpro (&last_mouse_motion_frame); | 13105 | staticpro (&last_mouse_motion_frame); |
| 13079 | last_mouse_motion_frame = Qnil; | 13106 | last_mouse_motion_frame = Qnil; |
| 13080 | } | 13107 | } |