aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorChong Yidong2006-09-13 22:39:23 +0000
committerChong Yidong2006-09-13 22:39:23 +0000
commit98a20c65dfeee04bb7d25e081c5b863de8fa9f33 (patch)
treeca0765f4ed42e8ad059794c7bb2b2a4496b58c2a /src/xterm.c
parent29e49c4ee2957619bf7544254688e0f9314e0446 (diff)
downloademacs-98a20c65dfeee04bb7d25e081c5b863de8fa9f33.tar.gz
emacs-98a20c65dfeee04bb7d25e081c5b863de8fa9f33.zip
* xterm.c (x_initialize): Don't install Xt event timer here.
(x_timeout_atimer_activated_flag): New var. (x_activate_timeout_atimer): New function to install Xt timer. (x_send_scroll_bar_event, x_process_timeouts): Use it. * xmenu.c (x_menu_set_in_use, popup_activate_callback) (create_and_show_popup_menu, create_and_show_dialog): Use it. * xterm.h (x_activate_timeout_atimer): prototype.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/src/xterm.c b/src/xterm.c
index e7a462aef58..9858d55f4d5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4091,6 +4091,9 @@ x_send_scroll_bar_event (window, part, portion, whole)
4091 4091
4092 /* Make Xt timeouts work while the scroll bar is active. */ 4092 /* Make Xt timeouts work while the scroll bar is active. */
4093 toolkit_scroll_bar_interaction = 1; 4093 toolkit_scroll_bar_interaction = 1;
4094#ifdef USE_X_TOOLKIT
4095 x_activate_timeout_atimer ();
4096#endif
4094 4097
4095 /* Setting the event mask to zero means that the message will 4098 /* Setting the event mask to zero means that the message will
4096 be sent to the client that created the window, and if that 4099 be sent to the client that created the window, and if that
@@ -10134,6 +10137,11 @@ static XrmOptionDescRec emacs_options[] = {
10134 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, 10137 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL},
10135 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} 10138 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL}
10136}; 10139};
10140
10141/* Whether atimer for Xt timeouts is activated or not. */
10142
10143static int x_timeout_atimer_activated_flag;
10144
10137#endif /* USE_X_TOOLKIT */ 10145#endif /* USE_X_TOOLKIT */
10138 10146
10139static int x_initialized; 10147static int x_initialized;
@@ -10815,13 +10823,39 @@ static void
10815x_process_timeouts (timer) 10823x_process_timeouts (timer)
10816 struct atimer *timer; 10824 struct atimer *timer;
10817{ 10825{
10826 BLOCK_INPUT;
10827 x_timeout_atimer_activated_flag = 0;
10818 if (toolkit_scroll_bar_interaction || popup_activated ()) 10828 if (toolkit_scroll_bar_interaction || popup_activated ())
10819 { 10829 {
10820 BLOCK_INPUT;
10821 while (XtAppPending (Xt_app_con) & XtIMTimer) 10830 while (XtAppPending (Xt_app_con) & XtIMTimer)
10822 XtAppProcessEvent (Xt_app_con, XtIMTimer); 10831 XtAppProcessEvent (Xt_app_con, XtIMTimer);
10823 UNBLOCK_INPUT; 10832 /* Reactivate the atimer for next time. */
10833 x_activate_timeout_atimer ();
10834 }
10835 UNBLOCK_INPUT;
10836}
10837
10838/* Install an asynchronous timer that processes Xt timeout events
10839 every 0.1s as long as either `toolkit_scroll_bar_interaction' or
10840 `popup_activated_flag' (in xmenu.c) is set. Make sure to call this
10841 function whenever these variables are set. This is necessary
10842 because some widget sets use timeouts internally, for example the
10843 LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't
10844 processed, these widgets don't behave normally. */
10845
10846void
10847x_activate_timeout_atimer ()
10848{
10849 BLOCK_INPUT;
10850 if (!x_timeout_atimer_activated_flag)
10851 {
10852 EMACS_TIME interval;
10853
10854 EMACS_SET_SECS_USECS (interval, 0, 100000);
10855 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
10856 x_timeout_atimer_activated_flag = 1;
10824 } 10857 }
10858 UNBLOCK_INPUT;
10825} 10859}
10826 10860
10827#endif /* USE_X_TOOLKIT */ 10861#endif /* USE_X_TOOLKIT */
@@ -10927,17 +10961,6 @@ x_initialize ()
10927 XtCacheByDisplay, cvt_pixel_dtor); 10961 XtCacheByDisplay, cvt_pixel_dtor);
10928 10962
10929 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); 10963 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources);
10930
10931 /* Install an asynchronous timer that processes Xt timeout events
10932 every 0.1s. This is necessary because some widget sets use
10933 timeouts internally, for example the LessTif menu bar, or the
10934 Xaw3d scroll bar. When Xt timouts aren't processed, these
10935 widgets don't behave normally. */
10936 {
10937 EMACS_TIME interval;
10938 EMACS_SET_SECS_USECS (interval, 0, 100000);
10939 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
10940 }
10941#endif 10964#endif
10942 10965
10943#ifdef USE_TOOLKIT_SCROLL_BARS 10966#ifdef USE_TOOLKIT_SCROLL_BARS