diff options
author | Xan Lopez <xan@igalia.com> | 2012-01-01 07:09:35 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-01-02 00:30:53 +0800 |
commit | d5b4f4ba1d31e368e23ddd77774e285a13908622 (patch) | |
tree | 4940ca63c17dc4b5d3d8707c0294e2ee0023a72e /src/ephy-navigation-history-action.c | |
parent | 10c1b6a7194f8dfc7c7cca278cfb6444255caed2 (diff) | |
download | gsoc2013-epiphany-d5b4f4ba1d31e368e23ddd77774e285a13908622.tar.gz gsoc2013-epiphany-d5b4f4ba1d31e368e23ddd77774e285a13908622.tar.zst gsoc2013-epiphany-d5b4f4ba1d31e368e23ddd77774e285a13908622.zip |
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
Diffstat (limited to 'src/ephy-navigation-history-action.c')
-rw-r--r-- | src/ephy-navigation-history-action.c | 10 |
1 files changed, 8 insertions, 2 deletions
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; |