diff options
| author | Chong Yidong | 2006-09-13 22:39:23 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-09-13 22:39:23 +0000 |
| commit | 98a20c65dfeee04bb7d25e081c5b863de8fa9f33 (patch) | |
| tree | ca0765f4ed42e8ad059794c7bb2b2a4496b58c2a /src | |
| parent | 29e49c4ee2957619bf7544254688e0f9314e0446 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/xmenu.c | 9 | ||||
| -rw-r--r-- | src/xterm.c | 49 | ||||
| -rw-r--r-- | src/xterm.h | 1 |
4 files changed, 58 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f2125895c2c..4f026bac9b9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * xterm.c (x_initialize): Don't install Xt event timer here. | ||
| 4 | (x_timeout_atimer_activated_flag): New var. | ||
| 5 | (x_activate_timeout_atimer): New function to install Xt timer. | ||
| 6 | (x_send_scroll_bar_event, x_process_timeouts): Use it. | ||
| 7 | |||
| 8 | * xmenu.c (x_menu_set_in_use, popup_activate_callback) | ||
| 9 | (create_and_show_popup_menu, create_and_show_dialog): Use it. | ||
| 10 | |||
| 11 | * xterm.h (x_activate_timeout_atimer): prototype. | ||
| 12 | |||
| 1 | 2006-09-13 Richard Stallman <rms@gnu.org> | 13 | 2006-09-13 Richard Stallman <rms@gnu.org> |
| 2 | 14 | ||
| 3 | * print.c (print_string): When printcharfun is t, | 15 | * print.c (print_string): When printcharfun is t, |
diff --git a/src/xmenu.c b/src/xmenu.c index 574240a4560..63dfb5102bd 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1182,6 +1182,10 @@ x_menu_set_in_use (in_use) | |||
| 1182 | { | 1182 | { |
| 1183 | menu_items_inuse = in_use ? Qt : Qnil; | 1183 | menu_items_inuse = in_use ? Qt : Qnil; |
| 1184 | popup_activated_flag = in_use; | 1184 | popup_activated_flag = in_use; |
| 1185 | #ifdef USE_X_TOOLKIT | ||
| 1186 | if (popup_activated_flag) | ||
| 1187 | x_activate_timeout_atimer (); | ||
| 1188 | #endif | ||
| 1185 | } | 1189 | } |
| 1186 | 1190 | ||
| 1187 | /* Wait for an X event to arrive or for a timer to expire. */ | 1191 | /* Wait for an X event to arrive or for a timer to expire. */ |
| @@ -1498,6 +1502,9 @@ popup_activate_callback (widget, id, client_data) | |||
| 1498 | XtPointer client_data; | 1502 | XtPointer client_data; |
| 1499 | { | 1503 | { |
| 1500 | popup_activated_flag = 1; | 1504 | popup_activated_flag = 1; |
| 1505 | #ifdef USE_X_TOOLKIT | ||
| 1506 | x_activate_timeout_atimer (); | ||
| 1507 | #endif | ||
| 1501 | } | 1508 | } |
| 1502 | #endif | 1509 | #endif |
| 1503 | 1510 | ||
| @@ -2798,6 +2805,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2798 | /* Display the menu. */ | 2805 | /* Display the menu. */ |
| 2799 | lw_popup_menu (menu, (XEvent *) &dummy); | 2806 | lw_popup_menu (menu, (XEvent *) &dummy); |
| 2800 | popup_activated_flag = 1; | 2807 | popup_activated_flag = 1; |
| 2808 | x_activate_timeout_atimer (); | ||
| 2801 | 2809 | ||
| 2802 | { | 2810 | { |
| 2803 | int fact = 4 * sizeof (LWLIB_ID); | 2811 | int fact = 4 * sizeof (LWLIB_ID); |
| @@ -3175,6 +3183,7 @@ create_and_show_dialog (f, first_wv) | |||
| 3175 | /* Display the dialog box. */ | 3183 | /* Display the dialog box. */ |
| 3176 | lw_pop_up_all_widgets (dialog_id); | 3184 | lw_pop_up_all_widgets (dialog_id); |
| 3177 | popup_activated_flag = 1; | 3185 | popup_activated_flag = 1; |
| 3186 | x_activate_timeout_atimer (); | ||
| 3178 | 3187 | ||
| 3179 | /* Process events that apply to the dialog box. | 3188 | /* Process events that apply to the dialog box. |
| 3180 | Also handle timers. */ | 3189 | Also handle timers. */ |
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 | |||
| 10143 | static int x_timeout_atimer_activated_flag; | ||
| 10144 | |||
| 10137 | #endif /* USE_X_TOOLKIT */ | 10145 | #endif /* USE_X_TOOLKIT */ |
| 10138 | 10146 | ||
| 10139 | static int x_initialized; | 10147 | static int x_initialized; |
| @@ -10815,13 +10823,39 @@ static void | |||
| 10815 | x_process_timeouts (timer) | 10823 | x_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 | |||
| 10846 | void | ||
| 10847 | x_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 |
diff --git a/src/xterm.h b/src/xterm.h index 9aa1d8fcacb..94ae9472200 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1001,6 +1001,7 @@ extern XtAppContext Xt_app_con; | |||
| 1001 | extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, | 1001 | extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, |
| 1002 | unsigned long *, | 1002 | unsigned long *, |
| 1003 | double, int)); | 1003 | double, int)); |
| 1004 | extern void x_activate_timeout_atimer P_ ((void)); | ||
| 1004 | #endif | 1005 | #endif |
| 1005 | extern void x_query_colors P_ ((struct frame *f, XColor *, int)); | 1006 | extern void x_query_colors P_ ((struct frame *f, XColor *, int)); |
| 1006 | extern void x_query_color P_ ((struct frame *f, XColor *)); | 1007 | extern void x_query_color P_ ((struct frame *f, XColor *)); |