comparison src/gui_gtk.c @ 401:4a1ead01d30b

updated for version 7.0105
author vimboss
date Fri, 08 Jul 2005 22:25:33 +0000
parents 7033303ea0c0
children f713fc55bf7b
comparison
equal deleted inserted replaced
400:a4ba09cd859e 401:4a1ead01d30b
2409 NULL, NULL, 2409 NULL, NULL,
2410 (GtkMenuPositionFunc)NULL, NULL, 2410 (GtkMenuPositionFunc)NULL, NULL,
2411 3U, (guint32)GDK_CURRENT_TIME); 2411 3U, (guint32)GDK_CURRENT_TIME);
2412 } 2412 }
2413 2413
2414 /* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to
2415 * popup_menu_position_func(). */
2416 static int popup_mouse_pos;
2417
2414 /* 2418 /*
2415 * Menu position callback; used by gui_make_popup() to place the menu 2419 * Menu position callback; used by gui_make_popup() to place the menu
2416 * at the current text cursor position. 2420 * at the current text cursor position.
2417 * 2421 *
2418 * Note: The push_in output argument seems to affect scrolling of huge 2422 * Note: The push_in output argument seems to affect scrolling of huge
2425 # ifdef HAVE_GTK2 2429 # ifdef HAVE_GTK2
2426 gboolean *push_in, 2430 gboolean *push_in,
2427 # endif 2431 # endif
2428 gpointer user_data) 2432 gpointer user_data)
2429 { 2433 {
2430 if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL) 2434 gdk_window_get_origin(gui.drawarea->window, x, y);
2431 { 2435
2432 gdk_window_get_origin(gui.drawarea->window, x, y); 2436 if (popup_mouse_pos)
2433 2437 {
2438 int mx, my;
2439
2440 gui_mch_getmouse(&mx, &my);
2441 *x += mx;
2442 *y += my;
2443 }
2444 else if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL)
2445 {
2434 /* Find the cursor position in the current window */ 2446 /* Find the cursor position in the current window */
2435 *x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1; 2447 *x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1;
2436 *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; 2448 *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1;
2437 } 2449 }
2438 } 2450 }
2439 2451
2440 void 2452 void
2441 gui_make_popup(char_u *path_name) 2453 gui_make_popup(char_u *path_name, int mouse_pos)
2442 { 2454 {
2443 vimmenu_T *menu; 2455 vimmenu_T *menu;
2456
2457 popup_mouse_pos = mouse_pos;
2444 2458
2445 menu = gui_find_menu(path_name); 2459 menu = gui_find_menu(path_name);
2446 2460
2447 if (menu != NULL && menu->submenu_id != NULL) 2461 if (menu != NULL && menu->submenu_id != NULL)
2448 { 2462 {