diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-01-09 09:36:10 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-01-09 09:36:10 -0800 |
commit | 35cf62d95cdcd5323dcea4a5385942c342ff1d9c (patch) | |
tree | 90358cbb033a126c4d48793a80fd804b7baaca24 /src/xmenu.c | |
parent | 59815c02506eb39b61e672528ed03885749ba529 (diff) | |
parent | 7655cb66d86564e792b825f1a0e1a4de7d6e6db5 (diff) | |
download | emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.tar.gz emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.tar.bz2 emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.zip |
Merge from trunk.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r-- | src/xmenu.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index b766f142e2d..79ead5f598c 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1,6 +1,6 @@ /* X Communication module for terminals which understand the X protocol. -Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2011 +Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -102,6 +102,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef USE_GTK #include "gtkutil.h" +#ifdef HAVE_GTK3 +#include "xgselect.h" +#endif #endif #include "menu.h" @@ -408,7 +411,15 @@ x_menu_wait_for_event (void *data) else ntp = &next_time; +#ifdef HAVE_GTK3 + /* Gtk3 have arrows on menus when they don't fit. When the pointer is + over an arrow, a timeout scrolls it a bit. Use xg_select so that + timeout gets triggered. */ + + xg_select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp); +#else select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp); +#endif } } #endif /* ! MSDOS */ @@ -1435,6 +1446,13 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */ struct next_popup_x_y popup_x_y; ptrdiff_t specpdl_count = SPECPDL_INDEX (); + int use_pos_func = ! for_click; + +#ifdef HAVE_GTK3 + /* Always use position function for Gtk3. Otherwise menus may become + too small to show anything. */ + use_pos_func = 1; +#endif if (! FRAME_X_P (f)) abort (); @@ -1446,7 +1464,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, G_CALLBACK (menu_highlight_callback)); xg_crazy_callback_abort = 0; - if (! for_click) + if (use_pos_func) { /* Not invoked by a click. pop up at x/y. */ pos_func = menu_position_func; @@ -1461,7 +1479,8 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i = 0; /* gtk_menu_popup needs this to be 0 for a non-button popup. */ } - else + + if (for_click) { for (i = 0; i < 5; i++) if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) |