aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-08-02 08:17:20 +0000
committerRichard M. Stallman1995-08-02 08:17:20 +0000
commitffcb5a51277228aaab4fedcf587be15224ef245b (patch)
treec1dee7dda1d245fd0b56205d5ce987c3c34b5480 /src
parent86c42dbd6d11ef3bee9444d8bb6f7f6efbbfe796 (diff)
downloademacs-ffcb5a51277228aaab4fedcf587be15224ef245b.tar.gz
emacs-ffcb5a51277228aaab4fedcf587be15224ef245b.zip
[USE_X_TOOLKIT] (xmenu_show): Compute root-based
coordinates. Make a dummy event to pass them to lw_popup_menu. (single_submenu): Only ignore 1st char of pane name if that is an @.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index d7360a72415..993ae91e744 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1421,7 +1421,9 @@ single_submenu (item_key, item_name, maps)
1421 else 1421 else
1422 first_wv->contents = wv; 1422 first_wv->contents = wv;
1423 wv->name = pane_string; 1423 wv->name = pane_string;
1424 if (!NILP (prefix)) 1424 /* Ignore the @ that means "separate pane".
1425 This is a kludge, but this isn't worth more time. */
1426 if (!NILP (prefix) && wv->name[0] == '@')
1425 wv->name++; 1427 wv->name++;
1426 wv->value = 0; 1428 wv->value = 0;
1427 wv->enabled = 1; 1429 wv->enabled = 1;
@@ -1839,7 +1841,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
1839 int i; 1841 int i;
1840 LWLIB_ID menu_id; 1842 LWLIB_ID menu_id;
1841 Widget menu; 1843 Widget menu;
1842 Arg av [2]; 1844 Arg av[2];
1843 int ac = 0; 1845 int ac = 0;
1844 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1846 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
1845 widget_value **submenu_stack 1847 widget_value **submenu_stack
@@ -1847,8 +1849,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
1847 Lisp_Object *subprefix_stack 1849 Lisp_Object *subprefix_stack
1848 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); 1850 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
1849 int submenu_depth = 0; 1851 int submenu_depth = 0;
1850 1852 XButtonPressedEvent dummy;
1851 Position root_x, root_y;
1852 1853
1853 int first_pane; 1854 int first_pane;
1854 int next_release_must_exit = 0; 1855 int next_release_must_exit = 0;
@@ -1993,6 +1994,51 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
1993 popup_selection_callback, 1994 popup_selection_callback,
1994 popup_deactivate_callback); 1995 popup_deactivate_callback);
1995 1996
1997 /* Adjust coordinates to relative to the outer (window manager) window. */
1998 {
1999 Window child;
2000 int win_x = 0, win_y = 0;
2001
2002 /* Find the position of the outside upper-left corner of
2003 the inner window, with respect to the outer window. */
2004 if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
2005 {
2006 BLOCK_INPUT;
2007 XTranslateCoordinates (FRAME_X_DISPLAY (f),
2008
2009 /* From-window, to-window. */
2010 f->output_data.x->window_desc,
2011 f->output_data.x->parent_desc,
2012
2013 /* From-position, to-position. */
2014 0, 0, &win_x, &win_y,
2015
2016 /* Child of window. */
2017 &child);
2018 UNBLOCK_INPUT;
2019 x += win_x;
2020 y += win_y;
2021 }
2022 }
2023
2024 /* Adjust coordinates to be root-window-relative. */
2025 x += f->output_data.x->left_pos;
2026 y += f->output_data.x->top_pos;
2027
2028 dummy.type = ButtonPress;
2029 dummy.serial = 0;
2030 dummy.send_event = 0;
2031 dummy.display = FRAME_X_DISPLAY (f);
2032 dummy.time = CurrentTime;
2033 dummy.button = 0;
2034 dummy.root = FRAME_X_DISPLAY_INFO (f)->root_window;
2035 dummy.window = dummy.root;
2036 dummy.subwindow = dummy.root;
2037 dummy.x_root = x;
2038 dummy.y_root = y;
2039 dummy.x = x;
2040 dummy.y = y;
2041
1996 /* Don't allow any geometry request from the user. */ 2042 /* Don't allow any geometry request from the user. */
1997 XtSetArg (av[ac], XtNgeometry, 0); ac++; 2043 XtSetArg (av[ac], XtNgeometry, 0); ac++;
1998 XtSetValues (menu, av, ac); 2044 XtSetValues (menu, av, ac);
@@ -2004,7 +2050,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
2004 menu_item_selection = 0; 2050 menu_item_selection = 0;
2005 2051
2006 /* Display the menu. */ 2052 /* Display the menu. */
2007 lw_popup_menu (menu); 2053 lw_popup_menu (menu, &dummy);
2008 popup_activated_flag = 1; 2054 popup_activated_flag = 1;
2009 2055
2010 /* Process events that apply to the menu. */ 2056 /* Process events that apply to the menu. */