Toolbar popup context menu unexpectedly opens over menubar sub menus
Bug #1184708 reported by
André Auzi
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Midori Web Browser |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When I clic with button 3 on menu entries of a sub menu of the menu bar
I expect a popup context menu related to the context of the sub menu
(eg. bookmark popup context menu in bookmarks menu tree)
whatever the sub menu is, I get the toolbar popup context menu.
Related branches
lp:~aauzi/midori/fix-1184716
- Cris Dywan: Approve
-
Diff: 581 lines (+194/-144)3 files modifiedkatze/katze-arrayaction.c (+131/-83)
midori/marshal.list (+1/-1)
midori/midori-browser.c (+62/-60)
Changed in midori: | |
status: | New → In Progress |
Changed in midori: | |
milestone: | none → 0.5.7 |
Changed in midori: | |
milestone: | 0.5.7 → 0.5.8 |
Changed in midori: | |
status: | In Progress → Fix Committed |
Changed in midori: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I traced the issue down to the function: midori_ browser_ menu_button_ press_event_ cb
It implements a code that relay the 'button- press-event' if the 'button- press-event' is handled by the menubar handler.
/* GtkMenuBar catches button events on children with submenus,
midori_ browser_ toolbar_ popup_context_ menu_cb (
GTK_ IS_BIN (toolitem) && gtk_bin_get_child (GTK_BIN (toolitem)) ?
gtk_widget_ get_parent (toolitem) : toolitem,
event- >x, event->y, event->button, browser);
g_signal_ emit_by_ name (toolitem, "button- press-event" , event, &handled);
so we need to see if the actual widget is the menubar, and if
it is an item, we forward it to the actual widget. */
if ((GTK_IS_BOX (toolitem) || GTK_IS_MENU_BAR (toolitem)))
{
return TRUE;
}
else if (GTK_IS_MENU_ITEM (toolitem))
{
gboolean handled;
return handled;
}
This code does not work in my environment (See version description previously attached)
I managed to avoid this misbehaviour by checking the inclusion of the 'button- press-event' in the bounding box of the menubar widget.
like this:
/* GtkMenuBar catches button events on children with submenus, get_origin (toolitem->window, &x, &y); get_size (GDK_DRAWABLE (toolitem->window), &width, &height); menubar= %d," window= %d\n", )browser- >menubar, browser_ toolbar_ popup_context_ menu_cb (
so we need to see if the actual widget is the menubar, and if
it is an item, we forward it to the actual widget. */
if ((GTK_IS_BOX (toolitem) || GTK_IS_MENU_BAR (toolitem)))
{
! gboolean event_in_window = TRUE;
! gint ex, ey, x, y, width, height;
!
! gdk_window_
! gdk_drawable_
! ex = event->x_root; ey = event->y_root;;
!
! if ((ex < x) || (ey < y)
! || (ex > x+width) || (ey > y+height))
! event_in_window = FALSE;
!
! g_print (" evt: x=%d, y=%d\n", ex, ey);
! g_print (" wnd: x=%d, y=%d, w=%d, h=%d\n", x, y, width, height);
! g_print ("popup: is_box=%d, is_menu_bar=%d,"
! " is_menu_item=%d, is_browser_
! " event_in_
! GTK_IS_BOX (toolitem), GTK_IS_MENU_BAR (toolitem),
! GTK_IS_MENU_ITEM (toolitem),
! toolitem == (GtkWidget*
! event_in_window);
!
! if ((ex < x) || (ey < y)
! || (ex > x+width) || (ey > y+height))
! return FALSE;
!
! midori_