diff options
| author | Chong Yidong | 2010-03-30 19:26:38 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-03-30 19:26:38 -0400 |
| commit | a6d676d9f41be8ad0c436c6d04cfedc1ce68adc8 (patch) | |
| tree | 368f24d8d4134416c9f1d7ddaadbc6326520704f /src/menu.c | |
| parent | b42da3879c85f7083bd9adc1bcb1f48b4472ac30 (diff) | |
| download | emacs-a6d676d9f41be8ad0c436c6d04cfedc1ce68adc8.tar.gz emacs-a6d676d9f41be8ad0c436c6d04cfedc1ce68adc8.zip | |
* menu.c (Fx_popup_menu): Use last_event_timestamp (Bug#4930).
Diffstat (limited to 'src/menu.c')
| -rw-r--r-- | src/menu.c | 18 |
1 files changed, 12 insertions, 6 deletions
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. */ | ||
| 66 | extern unsigned long last_event_timestamp; | ||
| 67 | |||
| 64 | extern Lisp_Object QCtoggle, QCradio; | 68 | extern Lisp_Object QCtoggle, QCradio; |
| 65 | 69 | ||
| 66 | Lisp_Object menu_items; | 70 | Lisp_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; |