Mercurial > emacs
diff src/gtkutil.c @ 109445:051595eb9b58
Merge changes from emacs-23 branch.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 16 Jul 2010 11:42:15 -0400 |
parents | 89a16701cde1 60266cf487b0 |
children | a93344738bc8 |
line wrap: on
line diff
--- a/src/gtkutil.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/gtkutil.c Fri Jul 16 11:42:15 2010 -0400 @@ -2856,6 +2856,38 @@ } } +int +xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) +{ + struct x_output *x = f->output_data.x; + + if (! x->menubar_widget) return 0; + + if (! (event->xbutton.x >= 0 + && event->xbutton.x < FRAME_PIXEL_WIDTH (f) + && event->xbutton.y >= 0 + && event->xbutton.y < f->output_data.x->menubar_height + && event->xbutton.same_screen)) + return 0; + + GList *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); + if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL)) + break; + } + g_list_free (list); + return iter == 0 ? 0 : 1; +} + /***********************************************************************