aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorPaul Eggert2011-05-12 13:23:33 -0700
committerPaul Eggert2011-05-12 13:23:33 -0700
commit08dc5ae68e9c699410256ca9052bd09f336ac87f (patch)
tree6572186aea70cb9f3f736743271c4d0b500650b6 /src/xmenu.c
parent86db42d22397effbb6e9edc5ae11d806847f0d3e (diff)
downloademacs-08dc5ae68e9c699410256ca9052bd09f336ac87f.tar.gz
emacs-08dc5ae68e9c699410256ca9052bd09f336ac87f.zip
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 <X11/X.h> 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.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index ccb60d2dcbb..7d7515a8f25 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -240,7 +240,7 @@ for instance using the window manager, then this produces a quit and
240 FRAME_PTR new_f = SELECTED_FRAME (); 240 FRAME_PTR new_f = SELECTED_FRAME ();
241 Lisp_Object bar_window; 241 Lisp_Object bar_window;
242 enum scroll_bar_part part; 242 enum scroll_bar_part part;
243 unsigned long time; 243 Time time;
244 Lisp_Object x, y; 244 Lisp_Object x, y;
245 245
246 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); 246 (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time);
@@ -1420,7 +1420,8 @@ pop_down_menu (Lisp_Object arg)
1420 menu pops down. 1420 menu pops down.
1421 menu_item_selection will be set to the selection. */ 1421 menu_item_selection will be set to the selection. */
1422static void 1422static void
1423create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) 1423create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1424 int for_click, Time timestamp)
1424{ 1425{
1425 int i; 1426 int i;
1426 GtkWidget *menu; 1427 GtkWidget *menu;
@@ -1464,7 +1465,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i
1464 gtk_widget_show_all (menu); 1465 gtk_widget_show_all (menu);
1465 1466
1466 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 1467 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1467 timestamp > 0 ? timestamp : gtk_get_current_event_time()); 1468 timestamp ? timestamp : gtk_get_current_event_time ());
1468 1469
1469 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1470 record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
1470 1471
@@ -1524,7 +1525,7 @@ pop_down_menu (Lisp_Object arg)
1524 menu_item_selection will be set to the selection. */ 1525 menu_item_selection will be set to the selection. */
1525static void 1526static void
1526create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, 1527create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1527 int x, int y, int for_click, EMACS_UINT timestamp) 1528 int x, int y, int for_click, Time timestamp)
1528{ 1529{
1529 int i; 1530 int i;
1530 Arg av[2]; 1531 Arg av[2];
@@ -1598,7 +1599,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1598 1599
1599Lisp_Object 1600Lisp_Object
1600xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1601xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1601 Lisp_Object title, const char **error_name, EMACS_UINT timestamp) 1602 Lisp_Object title, const char **error_name, Time timestamp)
1602{ 1603{
1603 int i; 1604 int i;
1604 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1605 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -2241,7 +2242,7 @@ pop_down_menu (Lisp_Object arg)
2241 2242
2242Lisp_Object 2243Lisp_Object
2243xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 2244xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2244 Lisp_Object title, const char **error_name, EMACS_UINT timestamp) 2245 Lisp_Object title, const char **error_name, Time timestamp)
2245{ 2246{
2246 Window root; 2247 Window root;
2247 XMenu *menu; 2248 XMenu *menu;