aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2009-11-07 23:49:08 +0000
committerChong Yidong2009-11-07 23:49:08 +0000
commita20903d09e11de170b39fafbc3d6e8e9417fae67 (patch)
tree307bbc8571f83ea9e135a1fa4ed860b66f3ecda7 /src
parentae6c6274296c883e8b21888b3177ed49bc9e869d (diff)
downloademacs-a20903d09e11de170b39fafbc3d6e8e9417fae67.tar.gz
emacs-a20903d09e11de170b39fafbc3d6e8e9417fae67.zip
* xmenu.c (Fx_popup_menu): Extract event timestamp. Pass it to
xmenu_show. (xmenu_show): New arg. Pass it to create_and_show_popup_menu. (create_and_show_popup_menu): New arg. Pass it to gtk_menu_popup.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xmenu.c30
2 files changed, 26 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0bd5d838c58..bc209cb284f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12009-11-07 Chong Yidong <cyd@stupidchicken.com>
2
3 * xmenu.c (Fx_popup_menu): Extract event timestamp. Pass it to
4 xmenu_show.
5 (xmenu_show): New arg. Pass it to create_and_show_popup_menu.
6 (create_and_show_popup_menu): New arg. Pass it to gtk_menu_popup.
7
12009-11-06 Stefan Monnier <monnier@iro.umontreal.ca> 82009-11-06 Stefan Monnier <monnier@iro.umontreal.ca>
2 9
3 Let integers use up 2 tags to give them one extra bit and thus double 10 Let integers use up 2 tags to give them one extra bit and thus double
diff --git a/src/xmenu.c b/src/xmenu.c
index 836376646d9..0511ee2db51 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -139,7 +139,7 @@ static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, Lisp_Object,
139 139
140static int update_frame_menubar P_ ((struct frame *)); 140static int update_frame_menubar P_ ((struct frame *));
141static Lisp_Object xmenu_show P_ ((struct frame *, int, int, int, int, 141static Lisp_Object xmenu_show P_ ((struct frame *, int, int, int, int,
142 Lisp_Object, char **)); 142 Lisp_Object, char **, EMACS_UINT));
143 143
144/* Flag which when set indicates a dialog or menu has been posted by 144/* Flag which when set indicates a dialog or menu has been posted by
145 Xt on behalf of one of the widget sets. */ 145 Xt on behalf of one of the widget sets. */
@@ -296,6 +296,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
296 int keymaps = 0; 296 int keymaps = 0;
297 int for_click = 0; 297 int for_click = 0;
298 int specpdl_count = SPECPDL_INDEX (); 298 int specpdl_count = SPECPDL_INDEX ();
299 Lisp_Object timestamp = Qnil;
299 struct gcpro gcpro1; 300 struct gcpro gcpro1;
300 301
301#ifdef HAVE_MENUS 302#ifdef HAVE_MENUS
@@ -325,9 +326,10 @@ no quit occurs and `x-popup-menu' returns nil. */)
325 for_click = 1; 326 for_click = 1;
326 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ 327 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */
327 window = Fcar (tem); /* POSN_WINDOW (tem) */ 328 window = Fcar (tem); /* POSN_WINDOW (tem) */
328 tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ 329 tem = Fcdr (Fcdr (tem));
329 x = Fcar (tem); 330 x = Fcar (Fcar (tem));
330 y = Fcdr (tem); 331 y = Fcdr (Fcar (tem));
332 timestamp = Fcar (Fcdr (tem));
331 } 333 }
332 334
333 /* If a click happens in an external tool bar or a detached 335 /* If a click happens in an external tool bar or a detached
@@ -504,7 +506,8 @@ no quit occurs and `x-popup-menu' returns nil. */)
504 BLOCK_INPUT; 506 BLOCK_INPUT;
505 507
506 selection = xmenu_show (f, xpos, ypos, for_click, 508 selection = xmenu_show (f, xpos, ypos, for_click,
507 keymaps, title, &error_name); 509 keymaps, title, &error_name,
510 INTEGERP (timestamp) ? XUINT (timestamp) : 0);
508 UNBLOCK_INPUT; 511 UNBLOCK_INPUT;
509 512
510 discard_menu_items (); 513 discard_menu_items ();
@@ -1754,12 +1757,13 @@ pop_down_menu (arg)
1754 menu pops down. 1757 menu pops down.
1755 menu_item_selection will be set to the selection. */ 1758 menu_item_selection will be set to the selection. */
1756static void 1759static void
1757create_and_show_popup_menu (f, first_wv, x, y, for_click) 1760create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
1758 FRAME_PTR f; 1761 FRAME_PTR f;
1759 widget_value *first_wv; 1762 widget_value *first_wv;
1760 int x; 1763 int x;
1761 int y; 1764 int y;
1762 int for_click; 1765 int for_click;
1766 EMACS_UINT timestamp;
1763{ 1767{
1764 int i; 1768 int i;
1765 GtkWidget *menu; 1769 GtkWidget *menu;
@@ -1801,7 +1805,8 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
1801 1805
1802 /* Display the menu. */ 1806 /* Display the menu. */
1803 gtk_widget_show_all (menu); 1807 gtk_widget_show_all (menu);
1804 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); 1808 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1809 timestamp);
1805 1810
1806 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1811 record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
1807 1812
@@ -1864,12 +1869,13 @@ pop_down_menu (arg)
1864 menu pops down. 1869 menu pops down.
1865 menu_item_selection will be set to the selection. */ 1870 menu_item_selection will be set to the selection. */
1866static void 1871static void
1867create_and_show_popup_menu (f, first_wv, x, y, for_click) 1872create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
1868 FRAME_PTR f; 1873 FRAME_PTR f;
1869 widget_value *first_wv; 1874 widget_value *first_wv;
1870 int x; 1875 int x;
1871 int y; 1876 int y;
1872 int for_click; 1877 int for_click;
1878 EMACS_UINT timestamp;
1873{ 1879{
1874 int i; 1880 int i;
1875 Arg av[2]; 1881 Arg av[2];
@@ -1938,7 +1944,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
1938#endif /* not USE_GTK */ 1944#endif /* not USE_GTK */
1939 1945
1940static Lisp_Object 1946static Lisp_Object
1941xmenu_show (f, x, y, for_click, keymaps, title, error) 1947xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
1942 FRAME_PTR f; 1948 FRAME_PTR f;
1943 int x; 1949 int x;
1944 int y; 1950 int y;
@@ -1946,6 +1952,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
1946 int keymaps; 1952 int keymaps;
1947 Lisp_Object title; 1953 Lisp_Object title;
1948 char **error; 1954 char **error;
1955 EMACS_UINT timestamp;
1949{ 1956{
1950 int i; 1957 int i;
1951 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1958 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -2152,7 +2159,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
2152 menu_item_selection = 0; 2159 menu_item_selection = 0;
2153 2160
2154 /* Actually create and show the menu until popped down. */ 2161 /* Actually create and show the menu until popped down. */
2155 create_and_show_popup_menu (f, first_wv, x, y, for_click); 2162 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
2156 2163
2157 /* Free the widget_value objects we used to specify the contents. */ 2164 /* Free the widget_value objects we used to specify the contents. */
2158 free_menubar_widget_value_tree (first_wv); 2165 free_menubar_widget_value_tree (first_wv);
@@ -2598,13 +2605,14 @@ pop_down_menu (arg)
2598 2605
2599 2606
2600static Lisp_Object 2607static Lisp_Object
2601xmenu_show (f, x, y, for_click, keymaps, title, error) 2608xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
2602 FRAME_PTR f; 2609 FRAME_PTR f;
2603 int x, y; 2610 int x, y;
2604 int for_click; 2611 int for_click;
2605 int keymaps; 2612 int keymaps;
2606 Lisp_Object title; 2613 Lisp_Object title;
2607 char **error; 2614 char **error;
2615 EMACS_UINT timestamp;
2608{ 2616{
2609 Window root; 2617 Window root;
2610 XMenu *menu; 2618 XMenu *menu;