From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [mituharu@math.s.chiba-u.ac.jp: Re: silent PC vs. emacs] Date: Tue, 05 Sep 2006 05:43:17 -0400 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1157449602 9679 80.91.229.2 (5 Sep 2006 09:46:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Sep 2006 09:46:42 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 05 11:46:42 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GKXVr-0006wV-O8 for ged-emacs-devel@m.gmane.org; Tue, 05 Sep 2006 11:46:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKXVr-0006FS-9P for ged-emacs-devel@m.gmane.org; Tue, 05 Sep 2006 05:46:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GKXSh-0008Ic-T4 for emacs-devel@gnu.org; Tue, 05 Sep 2006 05:43:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GKXSh-0008GR-1V for emacs-devel@gnu.org; Tue, 05 Sep 2006 05:43:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKXSg-0008G9-Tm for emacs-devel@gnu.org; Tue, 05 Sep 2006 05:43:18 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GKXdO-0007mA-PQ for emacs-devel@gnu.org; Tue, 05 Sep 2006 05:54:22 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1GKXSf-0002dX-EV; Tue, 05 Sep 2006 05:43:17 -0400 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59361 Archived-At: Does anyone see a problem with this? Can anyone confirm it is correct? ------- Start of forwarded message ------- Date: Mon, 04 Sep 2006 23:15:52 +0900 From: YAMAMOTO Mitsuharu To: rms@gnu.org Cc: dann@ics.uci.edu, emacs-pretest-bug@gnu.org, jidanni@jidanni.org, raman@users.sourceforge.net Subject: Re: silent PC vs. emacs In-Reply-To: Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed version=3.0.4 >>>>> On Mon, 04 Sep 2006 05:50:23 -0400, Richard Stallman said: > /* Install an asynchronous timer that processes Xt timeout > events every 0.1s. This is necessary because some widget > sets use timeouts internally, for example the LessTif menu > bar, or the Xaw3d scroll bar. When Xt timouts aren't > processed, these widgets don't behave normally. */ > Would it be safe to turn this off if no X events have been received > for a certain time? I don't know. As for Xt, the callback function is meaningful only when either of some two variables (`toolkit_scroll_bar_interaction' and `popup_activated_flag') is set. So, I think we can "externalize" the condition and use a non-continuous timer instead of a continuous one. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp *** xmenu.c.~1.307.~ Thu Jun 1 18:13:30 2006 - --- xmenu.c Mon Sep 4 22:47:30 2006 *************** *** 1182,1187 **** - --- 1182,1191 ---- { menu_items_inuse = in_use ? Qt : Qnil; popup_activated_flag = in_use; + #ifdef USE_X_TOOLKIT + if (popup_activated_flag) + x_activate_timeout_atimer (); + #endif } /* Wait for an X event to arrive or for a timer to expire. */ *************** *** 1498,1503 **** - --- 1502,1510 ---- XtPointer client_data; { popup_activated_flag = 1; + #ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); + #endif } #endif *************** *** 2798,2803 **** - --- 2805,2811 ---- /* Display the menu. */ lw_popup_menu (menu, (XEvent *) &dummy); popup_activated_flag = 1; + x_activate_timeout_atimer (); { int fact = 4 * sizeof (LWLIB_ID); *************** *** 3175,3180 **** - --- 3183,3189 ---- /* Display the dialog box. */ lw_pop_up_all_widgets (dialog_id); popup_activated_flag = 1; + x_activate_timeout_atimer (); /* Process events that apply to the dialog box. Also handle timers. */ *** xterm.h.~1.186.~ Thu Aug 17 15:57:55 2006 - --- xterm.h Mon Sep 4 22:46:06 2006 *************** *** 1001,1006 **** - --- 1001,1007 ---- extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, unsigned long *, double, int)); + extern void x_activate_timeout_atimer P_ ((void)); #endif extern void x_query_colors P_ ((struct frame *f, XColor *, int)); extern void x_query_color P_ ((struct frame *f, XColor *)); *** xterm.c.~1.924.~ Fri Aug 25 10:45:51 2006 - --- xterm.c Mon Sep 4 22:46:52 2006 *************** *** 4092,4097 **** - --- 4092,4100 ---- /* Make Xt timeouts work while the scroll bar is active. */ toolkit_scroll_bar_interaction = 1; + #ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); + #endif /* Setting the event mask to zero means that the message will be sent to the client that created the window, and if that *************** *** 10129,10134 **** - --- 10132,10142 ---- {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} }; + + /* Whether atimer for Xt timeouts is activated or not. */ + + static int x_timeout_atimer_activated_flag; + #endif /* USE_X_TOOLKIT */ static int x_initialized; *************** *** 10810,10822 **** x_process_timeouts (timer) struct atimer *timer; { if (toolkit_scroll_bar_interaction || popup_activated ()) { - - BLOCK_INPUT; while (XtAppPending (Xt_app_con) & XtIMTimer) XtAppProcessEvent (Xt_app_con, XtIMTimer); ! UNBLOCK_INPUT; } } #endif /* USE_X_TOOLKIT */ - --- 10818,10857 ---- x_process_timeouts (timer) struct atimer *timer; { + BLOCK_INPUT; if (toolkit_scroll_bar_interaction || popup_activated ()) { while (XtAppPending (Xt_app_con) & XtIMTimer) XtAppProcessEvent (Xt_app_con, XtIMTimer); ! /* Reactivate the atimer for next time. */ ! x_activate_timeout_atimer (); } + else + x_timeout_atimer_activated_flag = 0; + UNBLOCK_INPUT; + } + + /* Install an asynchronous timer that processes Xt timeout events + every 0.1s as long as either `toolkit_scroll_bar_interaction' or + `popup_activated_flag' (in xmenu.c) is set. Make sure to call this + function whenever these variables are set. This is necessary + because some widget sets use timeouts internally, for example the + LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't + processed, these widgets don't behave normally. */ + + void + x_activate_timeout_atimer () + { + BLOCK_INPUT; + if (!x_timeout_atimer_activated_flag) + { + EMACS_TIME interval; + + EMACS_SET_SECS_USECS (interval, 0, 100000); + start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); + x_timeout_atimer_activated_flag = 1; + } + UNBLOCK_INPUT; } #endif /* USE_X_TOOLKIT */ *************** *** 10922,10938 **** XtCacheByDisplay, cvt_pixel_dtor); XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); - - - - /* Install an asynchronous timer that processes Xt timeout events - - every 0.1s. This is necessary because some widget sets use - - timeouts internally, for example the LessTif menu bar, or the - - Xaw3d scroll bar. When Xt timouts aren't processed, these - - widgets don't behave normally. */ - - { - - EMACS_TIME interval; - - EMACS_SET_SECS_USECS (interval, 0, 100000); - - start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); - - } #endif #ifdef USE_TOOLKIT_SCROLL_BARS - --- 10957,10962 ---- ------- End of forwarded message -------