Commit 499322ce authored by Jan D's avatar Jan D
Browse files

* gtkutil.c (xg_event_is_for_menubar): Also check that event window

is related to the menu bar (Bug#6499).
parent f253ef6a
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-14 Jan Djärv <jan.h.d@swipnet.se>
* xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
......
......@@ -2994,6 +2994,13 @@ int
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;
......@@ -3004,14 +3011,24 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
&& 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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment