Mercurial > emacs
changeset 109453:af9e12929a95
Merge latest fix to xg_event_is_for_menubar.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 17 Jul 2010 10:43:41 -0400 |
parents | d40dce517523 (current diff) a93344738bc8 (diff) |
children | 514fed5c0ded |
files | |
diffstat | 2 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Jul 17 13:38:31 2010 +0200 +++ b/src/ChangeLog Sat Jul 17 10:43:41 2010 -0400 @@ -1,3 +1,8 @@ +2010-07-17 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_event_is_for_menubar): Also check that event window + is related to the menu bar (Bug#6499). + 2010-07-16 Jan Djärv <jan.h.d@swipnet.se> * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
--- a/src/gtkutil.c Sat Jul 17 13:38:31 2010 +0200 +++ b/src/gtkutil.c Sat Jul 17 10:43:41 2010 -0400 @@ -2860,6 +2860,13 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) { struct x_output *x = f->output_data.x; + GList *iter; + GdkRectangle rec; + GList *list; + GdkDisplay *gdpy; + GdkWindow *gw; + GdkEvent gevent; + GtkWidget *gwdesc; if (! x->menubar_widget) return 0; @@ -2870,14 +2877,24 @@ && event->xbutton.same_screen)) return 0; - GList *list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget)); + gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); + gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); + if (! gw) return 0; + gevent.any.window = gw; + gwdesc = gtk_get_event_widget (&gevent); + if (! gwdesc) return 0; + if (! GTK_IS_MENU_BAR (gwdesc) + && ! GTK_IS_MENU_ITEM (gwdesc) + && ! gtk_widget_is_ancestor (x->menubar_widget, gwdesc)) + return 0; + + list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget)); if (! list) return 0; - GList *iter; - GdkRectangle rec; rec.x = event->xbutton.x; rec.y = event->xbutton.y; rec.width = 1; rec.height = 1; + for (iter = list ; iter; iter = g_list_next (iter)) { GtkWidget *w = GTK_WIDGET (iter->data);