From d5b4f4ba1d31e368e23ddd77774e285a13908622 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sun, 1 Jan 2012 00:09:35 +0100 Subject: Fake middle clicks without gtk_button_{press,release}, which are deprecated Factor the logic that fakes clicks from a middle click in EphyMiddleClick(Tool)Button by forwarding a left click to GTK+ when we receive a middle click. Since ephy_gui_is_middle_click stops working in this case, add the minimal logic in EphyLinkAction to make it work again (basically, cache the button that activated the action inside the action itself). The EphyMiddleClickable(Tool)Button classes were written by Alexandre Mazari. https://bugzilla.gnome.org/show_bug.cgi?id=628364 --- src/ephy-navigation-history-action.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ephy-navigation-history-action.c') diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c index daf98ad5e..7c8d9f3d7 100644 --- a/src/ephy-navigation-history-action.c +++ b/src/ephy-navigation-history-action.c @@ -87,8 +87,13 @@ action_activate (GtkAction *action) web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + /* We use ephy_link_action_get_button on top of + * ephy_gui_is_middle_click because of the hacks we have to do to + * fake middle clicks on tool buttons. Read the documentation of + * ephy_link_action_get_button for more details. */ if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) { - if (ephy_gui_is_middle_click ()) { + if (ephy_gui_is_middle_click () || + ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) { embed = ephy_shell_new_tab (ephy_shell_get_default (), EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), embed, @@ -98,7 +103,8 @@ action_activate (GtkAction *action) } webkit_web_view_go_back (web_view); } else if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) { - if (ephy_gui_is_middle_click ()) { + if (ephy_gui_is_middle_click () || + ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) { const char *forward_uri; WebKitWebHistoryItem *forward_item; WebKitWebBackForwardList *history; -- cgit v1.2.3