summaryrefslogtreecommitdiff
path: root/src/gui_gtk.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-07-08 22:25:33 +0000
committerBram Moolenaar <Bram@vim.org>2005-07-08 22:25:33 +0000
commit045e82deef5c2eed3039e24f879a8169e4170a5f (patch)
tree306de7ed7831dd7c5b0cc6f471dfa4227c5a7940 /src/gui_gtk.c
parent63b80986ace0e057922329ff6c31d37343529245 (diff)
downloadvim-git-045e82deef5c2eed3039e24f879a8169e4170a5f.tar.gz
updated for version 7.0105
Diffstat (limited to 'src/gui_gtk.c')
-rw-r--r--src/gui_gtk.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index cd7d6bbc5..5bde7913c 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -2411,6 +2411,10 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
3U, (guint32)GDK_CURRENT_TIME);
}
+/* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to
+ * popup_menu_position_func(). */
+static int popup_mouse_pos;
+
/*
* Menu position callback; used by gui_make_popup() to place the menu
* at the current text cursor position.
@@ -2427,10 +2431,18 @@ popup_menu_position_func(GtkMenu *menu,
# endif
gpointer user_data)
{
- if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL)
+ gdk_window_get_origin(gui.drawarea->window, x, y);
+
+ if (popup_mouse_pos)
{
- gdk_window_get_origin(gui.drawarea->window, x, y);
+ int mx, my;
+ gui_mch_getmouse(&mx, &my);
+ *x += mx;
+ *y += my;
+ }
+ else if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL)
+ {
/* Find the cursor position in the current window */
*x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1;
*y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1;
@@ -2438,10 +2450,12 @@ popup_menu_position_func(GtkMenu *menu,
}
void
-gui_make_popup(char_u *path_name)
+gui_make_popup(char_u *path_name, int mouse_pos)
{
vimmenu_T *menu;
+ popup_mouse_pos = mouse_pos;
+
menu = gui_find_menu(path_name);
if (menu != NULL && menu->submenu_id != NULL)