From debbugs-submit-bounces@debbugs.gnu.org Thu May 12 15:58:35 2011 Received: (at submit) by debbugs.gnu.org; 12 May 2011 19:58:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKc1q-0003qG-Ep for submit@debbugs.gnu.org; Thu, 12 May 2011 15:58:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKc1h-0003pv-AR for submit@debbugs.gnu.org; Thu, 12 May 2011 15:58:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKc1b-00007R-3Y for submit@debbugs.gnu.org; Thu, 12 May 2011 15:58:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:46442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKc1b-00007J-1v for submit@debbugs.gnu.org; Thu, 12 May 2011 15:58:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKc1a-0002S8-5p for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 15:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKc1Y-000072-Oq for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 15:58:18 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:38608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKc1Y-00006w-EM for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 15:58:16 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2BA6E39E80F9 for ; Thu, 12 May 2011 12:58:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qP4zZffe7YQ4 for ; Thu, 12 May 2011 12:58:14 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C6E6839E80F8 for ; Thu, 12 May 2011 12:58:14 -0700 (PDT) Message-ID: <4DCC3BD6.3000200@cs.ucla.edu> Date: Thu, 12 May 2011 12:58:14 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: * keyboard.c (make_lispy_event): Fix problem in integer overflow. Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.9 (----) Here's a patch for a potential problem with integer overflow on 64-bit hosts that I plan to install after some more testing. The problem is a bit more severe if EMACS_INT is 64-bit on a 32-bit host, and I found it by inspection. * keyboard.c (make_lispy_event): Fix problem in integer overflow. Don't assume that the difference between two unsigned long values can fit into an integer. At this point, we know button_down_time <= event->timestamp, so the difference must be nonnegative, so there's no need to cast the result if double-click-time is nonnegative, as it should be; check that it's nonnegative, just in case. This bug is triggered when events are more than 2**31 ms apart (about 25 days). === modified file 'src/keyboard.c' --- src/keyboard.c 2011-04-28 19:35:20 +0000 +++ src/keyboard.c 2011-05-12 19:33:15 +0000 @@ -5556,9 +5556,9 @@ && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) - || (INTEGERP (Vdouble_click_time) - && ((int)(event->timestamp - button_down_time) - < XINT (Vdouble_click_time))))); + || (NATNUMP (Vdouble_click_time) + && (event->timestamp - button_down_time + < XFASTINT (Vdouble_click_time))))); } last_mouse_button = button; @@ -5742,9 +5742,9 @@ && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) - || (INTEGERP (Vdouble_click_time) - && ((int)(event->timestamp - button_down_time) - < XINT (Vdouble_click_time))))); + || (NATNUMP (Vdouble_click_time) + && (event->timestamp - button_down_time + < XFASTINT (Vdouble_click_time))))); if (is_double) { double_click_count++; From debbugs-submit-bounces@debbugs.gnu.org Thu May 12 16:26:19 2011 Received: (at 8664) by debbugs.gnu.org; 12 May 2011 20:26:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKcSg-0004Tu-RL for submit@debbugs.gnu.org; Thu, 12 May 2011 16:26:19 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKcSc-0004Tf-J3 for 8664@debbugs.gnu.org; Thu, 12 May 2011 16:26:16 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 5155B39E80F9 for <8664@debbugs.gnu.org>; Thu, 12 May 2011 13:26:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9TLN9XqdbgVZ for <8664@debbugs.gnu.org>; Thu, 12 May 2011 13:26:07 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 1B52E39E80F8 for <8664@debbugs.gnu.org>; Thu, 12 May 2011 13:26:07 -0700 (PDT) Message-ID: <4DCC425E.2070608@cs.ucla.edu> Date: Thu, 12 May 2011 13:26:06 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: 8664@debbugs.gnu.org Subject: Being more-systematic about user-interface timestamps Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 8664 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) Here's a further patch, to make it easier to catch bugs like Bug#8664 in the future. Be more systematic about user-interface timestamps. Before, the code sometimes used 'Time', sometimes 'unsigned long', and sometimes 'EMACS_UINT', to represent these timestamps. This change causes it to use 'Time' uniformly, as that's what X uses. This makes the code easier to follow, and makes it easier to catch integer overflow bugs such as Bug#8664. * frame.c (Fmouse_position, Fmouse_pixel_position): Use Time, not unsigned long, for user-interface timestamps. * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise. (button_down_time, make_lispy_position, make_lispy_movement): Likewise. * keyboard.h (last_event_timestamp): Likewise. * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise. * menu.h (xmenu_show): Likewise. * term.c (term_mouse_position): Likewise. * termhooks.h (struct input_event.timestamp): Likewise. (struct terminal.mouse_position_hook): Likewise. * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise. * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise. * systime.h (Time): New decl. Pull it in from if HAVE_X_WINDOWS, otherwise define it as unsigned long, which is what it was before. * menu.h, termhooks.h: Include "systime.h", for Time. === modified file 'src/frame.c' --- src/frame.c 2011-04-19 01:15:59 +0000 +++ src/frame.c 2011-05-12 17:15:05 +0000 @@ -1631,7 +1631,7 @@ enum scroll_bar_part party_dummy; Lisp_Object x, y, retval; int col, row; - unsigned long long_dummy; + Time long_dummy; struct gcpro gcpro1; f = SELECTED_FRAME (); @@ -1676,7 +1676,7 @@ Lisp_Object lispy_dummy; enum scroll_bar_part party_dummy; Lisp_Object x, y; - unsigned long long_dummy; + Time long_dummy; f = SELECTED_FRAME (); x = y = Qnil; === modified file 'src/keyboard.c' --- src/keyboard.c 2011-05-12 19:37:40 +0000 +++ src/keyboard.c 2011-05-12 19:59:08 +0000 @@ -238,7 +238,7 @@ /* The timestamp of the last input event we received from the X server. X Windows wants this for selection ownership. */ -unsigned long last_event_timestamp; +Time last_event_timestamp; static Lisp_Object Qx_set_selection, Qhandle_switch_frame; Lisp_Object QPRIMARY; @@ -4085,7 +4085,7 @@ Lisp_Object bar_window; enum scroll_bar_part part; Lisp_Object x, y; - unsigned long t; + Time t; *kbp = current_kboard; /* Note that this uses F to determine which terminal to look at. @@ -5088,7 +5088,7 @@ static int last_mouse_button; static int last_mouse_x; static int last_mouse_y; -static unsigned long button_down_time; +static Time button_down_time; /* The number of clicks in this multiple-click. */ @@ -5099,7 +5099,7 @@ static Lisp_Object make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, - unsigned long t) + Time t) { enum window_part part; Lisp_Object posn = Qnil; @@ -5987,7 +5987,7 @@ static Lisp_Object make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, - Lisp_Object x, Lisp_Object y, unsigned long t) + Lisp_Object x, Lisp_Object y, Time t) { /* Is it a scroll bar movement? */ if (frame && ! NILP (bar_window)) === modified file 'src/keyboard.h' --- src/keyboard.h 2011-04-14 01:36:53 +0000 +++ src/keyboard.h 2011-05-12 17:08:48 +0000 @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -#include "systime.h" /* for EMACS_TIME */ +#include "systime.h" /* for EMACS_TIME, Time */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ /* Lisp fields in struct keyboard are hidden from most code and accessed @@ -459,7 +459,7 @@ /* The timestamp of the last input event we received from the X server. X Windows wants this for selection ownership. */ -extern unsigned long last_event_timestamp; +extern Time last_event_timestamp; extern int quit_char; === modified file 'src/menu.c' --- src/menu.c 2011-05-12 06:48:32 +0000 +++ src/menu.c 2011-05-12 16:55:07 +0000 @@ -1147,13 +1147,13 @@ #else /* not HAVE_X_WINDOWS */ Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; void (*mouse_position_hook) (struct frame **, int, Lisp_Object *, enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, - unsigned long *) = + Time *) = FRAME_TERMINAL (new_f)->mouse_position_hook; if (mouse_position_hook) === modified file 'src/menu.h' --- src/menu.h 2011-01-25 04:08:28 +0000 +++ src/menu.h 2011-05-12 20:09:02 +0000 @@ -19,6 +19,8 @@ #ifndef MENU_H #define MENU_H +#include "systime.h" /* for Time */ + extern void x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval); @@ -48,6 +50,5 @@ extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, Lisp_Object, const char **); extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, - Lisp_Object, const char **, EMACS_UINT); + Lisp_Object, const char **, Time); #endif /* MENU_H */ - === modified file 'src/systime.h' --- src/systime.h 2011-03-11 20:24:09 +0000 +++ src/systime.h 2011-05-12 17:07:49 +0000 @@ -30,6 +30,12 @@ #endif #endif +#ifdef HAVE_X_WINDOWS +# include +#else +typedef unsigned long Time; +#endif + #ifdef HAVE_TZNAME #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others want it this way. */ === modified file 'src/term.c' --- src/term.c 2011-05-04 07:20:46 +0000 +++ src/term.c 2011-05-12 20:16:21 +0000 @@ -2698,7 +2698,7 @@ static void term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, unsigned long *timeptr) + Lisp_Object *y, Time *timeptr) { struct timeval now; === modified file 'src/termhooks.h' --- src/termhooks.h 2011-04-25 19:40:22 +0000 +++ src/termhooks.h 2011-05-12 17:13:37 +0000 @@ -20,6 +20,8 @@ /* Miscellanea. */ +#include "systime.h" /* for Time */ + struct glyph; struct frame; @@ -233,7 +235,7 @@ int modifiers; /* See enum below for interpretation. */ Lisp_Object x, y; - unsigned long timestamp; + Time timestamp; /* This is padding just to put the frame_or_window field past the size of struct selection_input_event. */ @@ -463,7 +465,7 @@ enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *); + Time *); /* The window system handling code should set this if the mouse has moved since the last call to the mouse_position_hook. Calling that === modified file 'src/xmenu.c' --- src/xmenu.c 2011-05-12 16:16:40 +0000 +++ src/xmenu.c 2011-05-12 16:32:07 +0000 @@ -240,7 +240,7 @@ FRAME_PTR new_f = SELECTED_FRAME (); Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; Lisp_Object x, y; (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); @@ -1420,7 +1420,8 @@ menu pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) +create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, + int for_click, Time timestamp) { int i; GtkWidget *menu; @@ -1464,7 +1465,7 @@ gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, - timestamp > 0 ? timestamp : gtk_get_current_event_time()); + timestamp ? timestamp : gtk_get_current_event_time ()); record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); @@ -1524,7 +1525,7 @@ menu_item_selection will be set to the selection. */ static void create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, - int x, int y, int for_click, EMACS_UINT timestamp) + int x, int y, int for_click, Time timestamp) { int i; Arg av[2]; @@ -1598,7 +1599,7 @@ Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -2241,7 +2242,7 @@ Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { Window root; XMenu *menu; === modified file 'src/xterm.c' --- src/xterm.c 2011-05-11 23:16:52 +0000 +++ src/xterm.c 2011-05-12 17:01:31 +0000 @@ -342,7 +342,7 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, - unsigned long *); + Time *); static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); static void x_check_fullscreen (struct frame *); static void x_check_expected_move (struct frame *, int, int); @@ -3799,7 +3799,7 @@ static void XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - long unsigned int *timestamp) + Time *timestamp) { FRAME_PTR f1; @@ -5534,7 +5534,7 @@ static void x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, - Lisp_Object *y, long unsigned int *timestamp) + Lisp_Object *y, Time *timestamp) { struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); Window w = bar->x_window; From debbugs-submit-bounces@debbugs.gnu.org Fri May 13 04:54:47 2011 Received: (at 8664) by debbugs.gnu.org; 13 May 2011 08:54:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKo91-00053h-E3 for submit@debbugs.gnu.org; Fri, 13 May 2011 04:54:47 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKo8x-00053R-R8 for 8664@debbugs.gnu.org; Fri, 13 May 2011 04:54:45 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LL400C00M0JSP00@a-mtaout22.012.net.il> for 8664@debbugs.gnu.org; Fri, 13 May 2011 11:54:07 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.126.91.65]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LL400C8TM24SG10@a-mtaout22.012.net.il>; Fri, 13 May 2011 11:54:07 +0300 (IDT) Date: Fri, 13 May 2011 11:53:37 +0300 From: Eli Zaretskii Subject: Re: bug#8664: Being more-systematic about user-interface timestamps In-reply-to: <4DCC425E.2070608@cs.ucla.edu> X-012-Sender: halo1@inter.net.il To: Paul Eggert Message-id: <831v03gewe.fsf@gnu.org> References: <4DCC3BD6.3000200@cs.ucla.edu> <4DCC425E.2070608@cs.ucla.edu> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > Date: Thu, 12 May 2011 13:26:06 -0700 > From: Paul Eggert > > --- src/systime.h 2011-03-11 20:24:09 +0000 > +++ src/systime.h 2011-05-12 17:07:49 +0000 > @@ -30,6 +30,12 @@ > #endif > #endif > > +#ifdef HAVE_X_WINDOWS > +# include > +#else > +typedef unsigned long Time; > +#endif Wouldn't this clash with the typedef in w32gui.h? > --- src/menu.c 2011-05-12 06:48:32 +0000 > +++ src/menu.c 2011-05-12 16:55:07 +0000 > @@ -1147,13 +1147,13 @@ > #else /* not HAVE_X_WINDOWS */ > Lisp_Object bar_window; > enum scroll_bar_part part; > - unsigned long time; > + Time time; > void (*mouse_position_hook) (struct frame **, int, > Lisp_Object *, > enum scroll_bar_part *, > Lisp_Object *, > Lisp_Object *, > - unsigned long *) = > + Time *) = This needs a corresponding change in all the functions used as mouse_position_hook on different platforms. You made such a change only in 2 of them: term_mouse_position and XTmouse_position. From debbugs-submit-bounces@debbugs.gnu.org Sat May 14 05:10:36 2011 Received: (at 8664) by debbugs.gnu.org; 14 May 2011 09:10:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLArs-00069j-3o for submit@debbugs.gnu.org; Sat, 14 May 2011 05:10:36 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLArq-00069U-8L for 8664@debbugs.gnu.org; Sat, 14 May 2011 05:10:35 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 768F739E812A; Sat, 14 May 2011 02:10:28 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BTaO4LbwFM3Z; Sat, 14 May 2011 02:10:27 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 9A37B39E8113; Sat, 14 May 2011 02:10:27 -0700 (PDT) Message-ID: <4DCE4703.30703@cs.ucla.edu> Date: Sat, 14 May 2011 02:10:27 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: bug#8664: Being more-systematic about user-interface timestamps References: <4DCC3BD6.3000200@cs.ucla.edu> <4DCC425E.2070608@cs.ucla.edu> <831v03gewe.fsf@gnu.org> In-Reply-To: <831v03gewe.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 05/13/11 01:53, Eli Zaretskii wrote: >> +#ifdef HAVE_X_WINDOWS >> +# include >> +#else >> +typedef unsigned long Time; >> +#endif > > Wouldn't this clash with the typedef in w32gui.h? Yes, thanks, good catch. Proposed fix below. > This needs a corresponding change in all the functions used as > mouse_position_hook on different platforms. You made such a change > only in 2 of them: term_mouse_position and XTmouse_position. Thanks for that too. For NextStep a change is needed, also proposed below. No change should be needed for w32's hooks, since there's no actual change to the data type there. For documentation purposes it might be nice to run through the hooks and change 'unsigned long' to 'Time' where appropriate, but that's not essential. Normally I'm reluctant to mess with the w32 code as I can't easily test it. Fixups, following up to the user-interface timestamp change. * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time for UI timestamps, instead of unsigned long. * w32gui.h (Time): Define by including "systime.h" rather than by declaring it ourselves. (Bug#8664) === modified file 'src/nsterm.m' --- src/nsterm.m 2011-04-03 08:30:57 +0000 +++ src/nsterm.m 2011-05-14 08:56:08 +0000 @@ -158,7 +158,7 @@ /* display update */ NSPoint last_mouse_motion_position; static NSRect last_mouse_glyph; -static unsigned long last_mouse_movement_time = 0; +static Time last_mouse_movement_time = 0; static Lisp_Object last_mouse_motion_frame; static EmacsScroller *last_mouse_scroll_bar = nil; static struct frame *ns_updating_frame; @@ -1789,7 +1789,7 @@ static void ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) /* -------------------------------------------------------------------------- External (hook): inform emacs about mouse position and hit parts. If a scrollbar is being dragged, set bar_window, part, x, y, time. @@ -6531,5 +6531,3 @@ /* Tell emacs about this window system. */ Fprovide (intern ("ns"), Qnil); } - - === modified file 'src/w32gui.h' --- src/w32gui.h 2011-01-25 04:08:28 +0000 +++ src/w32gui.h 2011-05-14 09:01:32 +0000 @@ -20,6 +20,8 @@ #define EMACS_W32GUI_H #include +#include "systime.h" /* for Time */ + /* Local memory management for menus. */ #define local_heap (GetProcessHeap ()) #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) @@ -47,7 +49,6 @@ typedef XGCValues * GC; typedef COLORREF Color; -typedef DWORD Time; typedef HWND Window; typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ typedef HCURSOR Cursor; @@ -147,4 +148,3 @@ #endif /* EMACS_W32GUI_H */ - From debbugs-submit-bounces@debbugs.gnu.org Sat May 14 05:41:42 2011 Received: (at 8664) by debbugs.gnu.org; 14 May 2011 09:41:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLBLy-0006on-NF for submit@debbugs.gnu.org; Sat, 14 May 2011 05:41:42 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLBLv-0006oY-Nj for 8664@debbugs.gnu.org; Sat, 14 May 2011 05:41:41 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LL600600IQOBB00@a-mtaout20.012.net.il> for 8664@debbugs.gnu.org; Sat, 14 May 2011 12:41:26 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.124.10.122]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LL6005VCIX1TF80@a-mtaout20.012.net.il>; Sat, 14 May 2011 12:41:26 +0300 (IDT) Date: Sat, 14 May 2011 12:41:20 +0300 From: Eli Zaretskii Subject: Re: bug#8664: Being more-systematic about user-interface timestamps In-reply-to: <4DCE4703.30703@cs.ucla.edu> X-012-Sender: halo1@inter.net.il To: Paul Eggert Message-id: <83boz5fwlb.fsf@gnu.org> References: <4DCC3BD6.3000200@cs.ucla.edu> <4DCC425E.2070608@cs.ucla.edu> <831v03gewe.fsf@gnu.org> <4DCE4703.30703@cs.ucla.edu> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > Date: Sat, 14 May 2011 02:10:27 -0700 > From: Paul Eggert > CC: 8664@debbugs.gnu.org > > No change should be needed for w32's hooks, since there's no actual change > to the data type there. It will break if the typedef is ever changed to be incompatible. > For documentation purposes it might be nice to run through the hooks > and change 'unsigned long' to 'Time' where appropriate, but that's > not essential. Normally I'm reluctant to mess with the w32 code as > I can't easily test it. Changing a single declaration to an obviously correct one, and an equivalent one at that, can hardly be qualified as "messing". Besides, people will understand if you botch their build trying to keep it from breaking, but may not understand why you knowingly refrain from making a change that clearly is TRT. From debbugs-submit-bounces@debbugs.gnu.org Sat May 14 15:09:40 2011 Received: (at 8664) by debbugs.gnu.org; 14 May 2011 19:09:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLKDb-0003Bf-V9 for submit@debbugs.gnu.org; Sat, 14 May 2011 15:09:40 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLKDY-0003BS-Jc for 8664@debbugs.gnu.org; Sat, 14 May 2011 15:09:37 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 048BF39E812E; Sat, 14 May 2011 12:09:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RGPn7cy0IKTT; Sat, 14 May 2011 12:09:30 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 713B239E811C; Sat, 14 May 2011 12:09:30 -0700 (PDT) Message-ID: <4DCED369.8010103@cs.ucla.edu> Date: Sat, 14 May 2011 12:09:29 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Eli Zaretskii Subject: Re: bug#8664: Being more-systematic about user-interface timestamps References: <4DCC3BD6.3000200@cs.ucla.edu> <4DCC425E.2070608@cs.ucla.edu> <831v03gewe.fsf@gnu.org> <4DCE4703.30703@cs.ucla.edu> <83boz5fwlb.fsf@gnu.org> In-Reply-To: <83boz5fwlb.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 05/14/11 02:41, Eli Zaretskii wrote: > people will understand if you botch their build trying to > keep it from breaking Sure, but in this case the change cannot possibly fix anything, and might break the build, which is why I omitted it. But since you're saying it's OK I'll fold the following change in when I merge. * msdos.c (mouse_get_pos): Likewise. * w32inevt.c (movement_time, w32_console_mouse_position): Likewise. === modified file 'src/msdos.c' --- src/msdos.c 2011-04-24 12:48:30 +0000 +++ src/msdos.c 2011-05-14 19:00:49 +0000 @@ -287,7 +287,7 @@ void mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) { int ix, iy; Lisp_Object frame, tail; === modified file 'src/w32inevt.c' --- src/w32inevt.c 2011-03-25 15:39:59 +0000 +++ src/w32inevt.c 2011-05-14 19:01:44 +0000 @@ -45,7 +45,7 @@ /* Info for last mouse motion */ static COORD movement_pos; -static DWORD movement_time; +static Time movement_time; /* from w32fns.c */ extern unsigned int map_keypad_keys (unsigned int, unsigned int); @@ -544,7 +544,7 @@ enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, - unsigned long *time) + Time *time) { BLOCK_INPUT; @@ -756,4 +756,3 @@ UNBLOCK_INPUT; return ret; } - From debbugs-submit-bounces@debbugs.gnu.org Sat May 14 16:47:30 2011 Received: (at 8664) by debbugs.gnu.org; 14 May 2011 20:47:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLLkH-00067k-TG for submit@debbugs.gnu.org; Sat, 14 May 2011 16:47:30 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLLkF-00067X-MM for 8664@debbugs.gnu.org; Sat, 14 May 2011 16:47:28 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LL700C00DQ1B500@a-mtaout20.012.net.il> for 8664@debbugs.gnu.org; Sat, 14 May 2011 23:47:20 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.124.10.122]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LL700BLNDQUX050@a-mtaout20.012.net.il>; Sat, 14 May 2011 23:47:20 +0300 (IDT) Date: Sat, 14 May 2011 23:47:14 +0300 From: Eli Zaretskii Subject: Re: bug#8664: Being more-systematic about user-interface timestamps In-reply-to: <4DCED369.8010103@cs.ucla.edu> X-012-Sender: halo1@inter.net.il To: Paul Eggert Message-id: <8339khf1rh.fsf@gnu.org> References: <4DCC3BD6.3000200@cs.ucla.edu> <4DCC425E.2070608@cs.ucla.edu> <831v03gewe.fsf@gnu.org> <4DCE4703.30703@cs.ucla.edu> <83boz5fwlb.fsf@gnu.org> <4DCED369.8010103@cs.ucla.edu> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > Date: Sat, 14 May 2011 12:09:29 -0700 > From: Paul Eggert > CC: 8664@debbugs.gnu.org > > On 05/14/11 02:41, Eli Zaretskii wrote: > > people will understand if you botch their build trying to > > keep it from breaking > > Sure, but in this case the change cannot possibly fix anything, > and might break the build, which is why I omitted it. But since > you're saying it's OK I'll fold the following change in when > I merge. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue May 17 21:33:36 2011 Received: (at 8664-done) by debbugs.gnu.org; 18 May 2011 01:33:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMVdm-0007iu-Eh for submit@debbugs.gnu.org; Tue, 17 May 2011 21:33:34 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMVdk-0007if-5G; Tue, 17 May 2011 21:33:33 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1840039E816B; Tue, 17 May 2011 18:33:26 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3HONdNdJcLcZ; Tue, 17 May 2011 18:33:25 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id BC8CE39E8106; Tue, 17 May 2011 18:33:25 -0700 (PDT) Message-ID: <4DD321E5.2020202@cs.ucla.edu> Date: Tue, 17 May 2011 18:33:25 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: 8675-done@debbugs.gnu.org, 8664-done@debbugs.gnu.org Subject: committed fix into trunk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 8664-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) Bzr 104265,which I just committed into the trunk, should contain the fix discussed above, so I'm marking this as "done". As requested I separated the gnulib merge into a separate commit, bzr 104264. From debbugs-submit-bounces@debbugs.gnu.org Wed May 18 02:54:42 2011 Received: (at 8664) by debbugs.gnu.org; 18 May 2011 06:54:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMaeY-0006wi-0Z for submit@debbugs.gnu.org; Wed, 18 May 2011 02:54:42 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMaeW-0006wX-DY for 8664@debbugs.gnu.org; Wed, 18 May 2011 02:54:40 -0400 Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1QMaeQ-0001av-5D; Wed, 18 May 2011 02:54:34 -0400 Date: Wed, 18 May 2011 02:54:34 -0400 Message-Id: From: Eli Zaretskii To: Paul Eggert In-reply-to: <4DD321E5.2020202@cs.ucla.edu> (message from Paul Eggert on Tue, 17 May 2011 18:33:25 -0700) Subject: Re: bug#8664: committed fix into trunk References: <4DCC3BD6.3000200@cs.ucla.edu> <4DD321E5.2020202@cs.ucla.edu> X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: 8664 Cc: 8664@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) > Date: Tue, 17 May 2011 18:33:25 -0700 > From: Paul Eggert > > As requested I separated the gnulib merge into a separate commit, > bzr 104264. Thanks. You forgot ChangeLog entries for the files imported from gnulib. I fixed that. From unknown Wed Jun 18 23:16:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 15 Jun 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator