aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-03-30 19:26:38 -0400
committerChong Yidong2010-03-30 19:26:38 -0400
commita6d676d9f41be8ad0c436c6d04cfedc1ce68adc8 (patch)
tree368f24d8d4134416c9f1d7ddaadbc6326520704f
parentb42da3879c85f7083bd9adc1bcb1f48b4472ac30 (diff)
downloademacs-a6d676d9f41be8ad0c436c6d04cfedc1ce68adc8.tar.gz
emacs-a6d676d9f41be8ad0c436c6d04cfedc1ce68adc8.zip
* menu.c (Fx_popup_menu): Use last_event_timestamp (Bug#4930).
-rw-r--r--src/ChangeLog4
-rw-r--r--src/menu.c18
2 files changed, 16 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 25182378fd0..cb80f6f498d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12010-03-30 Bernhard Herzog <bh@intevation.de> (tiny change)
2
3 * menu.c (Fx_popup_menu): Use last_event_timestamp (Bug#4930).
4
12010-03-30 Jan Djärv <jan.h.d@swipnet.se> 52010-03-30 Jan Djärv <jan.h.d@swipnet.se>
2 6
3 * xdisp.c (note_mouse_highlight): Don't do highlight if pointer is 7 * xdisp.c (note_mouse_highlight): Don't do highlight if pointer is
diff --git a/src/menu.c b/src/menu.c
index ad6054d7192..bfe54a53328 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -61,6 +61,10 @@ extern HMENU current_popup_menu;
61#define HAVE_BOXES 1 61#define HAVE_BOXES 1
62#endif 62#endif
63 63
64/* The timestamp of the last input event Emacs received from the X server. */
65/* Defined in keyboard.c. */
66extern unsigned long last_event_timestamp;
67
64extern Lisp_Object QCtoggle, QCradio; 68extern Lisp_Object QCtoggle, QCradio;
65 69
66Lisp_Object menu_items; 70Lisp_Object menu_items;
@@ -1073,7 +1077,6 @@ no quit occurs and `x-popup-menu' returns nil. */)
1073 int keymaps = 0; 1077 int keymaps = 0;
1074 int for_click = 0; 1078 int for_click = 0;
1075 int specpdl_count = SPECPDL_INDEX (); 1079 int specpdl_count = SPECPDL_INDEX ();
1076 Lisp_Object timestamp = Qnil;
1077 struct gcpro gcpro1; 1080 struct gcpro gcpro1;
1078 1081
1079 if (NILP (position)) 1082 if (NILP (position))
@@ -1107,10 +1110,9 @@ no quit occurs and `x-popup-menu' returns nil. */)
1107 for_click = 1; 1110 for_click = 1;
1108 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ 1111 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */
1109 window = Fcar (tem); /* POSN_WINDOW (tem) */ 1112 window = Fcar (tem); /* POSN_WINDOW (tem) */
1110 tem = Fcdr (Fcdr (tem)); 1113 tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */
1111 x = Fcar (Fcar (tem)); 1114 x = Fcar (tem);
1112 y = Fcdr (Fcar (tem)); 1115 y = Fcdr (tem);
1113 timestamp = Fcar (Fcdr (tem));
1114 } 1116 }
1115 1117
1116 /* If a click happens in an external tool bar or a detached 1118 /* If a click happens in an external tool bar or a detached
@@ -1318,9 +1320,13 @@ no quit occurs and `x-popup-menu' returns nil. */)
1318 selection = ns_menu_show (f, xpos, ypos, for_click, 1320 selection = ns_menu_show (f, xpos, ypos, for_click,
1319 keymaps, title, &error_name); 1321 keymaps, title, &error_name);
1320#else /* MSDOS and X11 */ 1322#else /* MSDOS and X11 */
1323 /* Assume last_event_timestamp is the timestamp of the button event.
1324 Is this assumption ever violated? We can't use the timestamp
1325 stored within POSITION because there the top bits from the actual
1326 timestamp may be truncated away (Bug#4930). */
1321 selection = xmenu_show (f, xpos, ypos, for_click, 1327 selection = xmenu_show (f, xpos, ypos, for_click,
1322 keymaps, title, &error_name, 1328 keymaps, title, &error_name,
1323 INTEGERP (timestamp) ? XUINT (timestamp) : 0); 1329 last_event_timestamp);
1324#endif 1330#endif
1325 1331
1326 UNBLOCK_INPUT; 1332 UNBLOCK_INPUT;