[epiphany/gnome-3-36] Revert "Fix mouse back/forward gesture"
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-36] Revert "Fix mouse back/forward gesture"
- Date: Mon, 8 Jun 2020 14:38:41 +0000 (UTC)
commit 23e8b56411fafb3a298d00cc933085f7bbb237b8
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Jun 8 14:38:34 2020 +0000
Revert "Fix mouse back/forward gesture"
This reverts commit 229581b03186a2ec596c42ed54865a9f46adb4e6
src/ephy-action-bar-start.c | 64 ++++++++++++-----------------------
src/ephy-link.c | 2 +-
src/resources/gtk/action-bar-start.ui | 2 ++
src/window-commands.c | 6 ++++
4 files changed, 31 insertions(+), 43 deletions(-)
---
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 71642ea30..eb0821e09 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -27,7 +27,6 @@
#include "ephy-embed-prefs.h"
#include "ephy-embed-utils.h"
#include "ephy-favicon-helpers.h"
-#include "ephy-gui.h"
#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-window.h"
@@ -308,13 +307,13 @@ navigation_button_press_event_cb (GtkButton *button,
{
EphyActionBarStart *action_bar_start = EPHY_ACTION_BAR_START (user_data);
EphyNavigationHistoryDirection direction;
+ const gchar *action_name;
PopupData *data;
- gboolean is_back = FALSE;
- is_back = (GTK_WIDGET (button) == action_bar_start->navigation_back);
+ action_name = gtk_actionable_get_action_name (GTK_ACTIONABLE (button));
- direction = is_back ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK
- : EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD;
+ direction = strstr (action_name, "back") ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK
+ : EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD;
switch (((GdkEventButton *)event)->button) {
case GDK_BUTTON_SECONDARY:
@@ -355,49 +354,30 @@ navigation_button_release_event_cb (GtkButton *button,
GActionGroup *action_group;
GAction *action;
EphyNavigationHistoryDirection direction;
- gboolean is_back = FALSE;
- gboolean open_in_new_tab = FALSE;
- gboolean open_in_current_tab = FALSE;
- GdkEventType type = GDK_NOTHING;
- guint state = 0, button_val = (guint) - 1, keyval = (guint) - 1;
-
- ephy_gui_get_current_event (&type, &state, &button_val, &keyval);
- is_back = (GTK_WIDGET (button) == action_bar_start->navigation_back);
+ const gchar *action_name;
g_clear_handle_id (&action_bar_start->navigation_buttons_menu_timeout, g_source_remove);
+ action_name = gtk_actionable_get_action_name (GTK_ACTIONABLE (button));
action_group = gtk_widget_get_action_group (gtk_widget_get_ancestor (GTK_WIDGET (action_bar_start),
EPHY_TYPE_WINDOW), "toolbar");
- direction = is_back ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK
- : EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD;
-
- open_in_new_tab = (((GdkEventButton *)event)->button == GDK_BUTTON_MIDDLE) || (state == GDK_CONTROL_MASK);
- open_in_current_tab = ((GdkEventButton *)event)->button == GDK_BUTTON_PRIMARY;
+ direction = strcmp (action_name, "toolbar.navigation-back") == 0 ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK
+ :
EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD;
- if (open_in_new_tab) {
- if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
- "navigation-back-new-tab");
- g_action_activate (action, NULL);
- } else if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) {
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
- "navigation-forward-new-tab");
- g_action_activate (action, NULL);
- }
- return GDK_EVENT_STOP;
- }
-
- if (open_in_current_tab) {
- if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
- "navigation-back");
- g_action_activate (action, NULL);
- } else if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) {
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
- "navigation-forward");
- g_action_activate (action, NULL);
- }
- return GDK_EVENT_STOP;
+ switch (((GdkEventButton *)event)->button) {
+ case GDK_BUTTON_MIDDLE:
+ if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
+ "navigation-back-new-tab");
+ g_action_activate (action, NULL);
+ } else if (direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) {
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
+ "navigation-forward-new-tab");
+ g_action_activate (action, NULL);
+ }
+ return GDK_EVENT_STOP;
+ default:
+ break;
}
return GDK_EVENT_PROPAGATE;
diff --git a/src/ephy-link.c b/src/ephy-link.c
index cc7f69386..9f7191f5f 100644
--- a/src/ephy-link.c
+++ b/src/ephy-link.c
@@ -103,7 +103,7 @@ ephy_link_flags_from_current_event (void)
ephy_gui_get_current_event (&type, &state, &button, &keyval);
- if (button == GDK_BUTTON_MIDDLE && (type == GDK_BUTTON_PRESS || type == GDK_BUTTON_RELEASE)) {
+ if (button == 2 && (type == GDK_BUTTON_PRESS || type == GDK_BUTTON_RELEASE)) {
if (state == GDK_SHIFT_MASK) {
flags = EPHY_LINK_NEW_WINDOW;
} else if (state == 0 || state == GDK_CONTROL_MASK) {
diff --git a/src/resources/gtk/action-bar-start.ui b/src/resources/gtk/action-bar-start.ui
index b42daa334..2c56ffa58 100644
--- a/src/resources/gtk/action-bar-start.ui
+++ b/src/resources/gtk/action-bar-start.ui
@@ -14,6 +14,7 @@
<child>
<object class="GtkButton" id="navigation_back">
<property name="visible">True</property>
+ <property name="action-name">toolbar.navigation-back</property>
<property name="valign">center</property>
<!-- Translators: tooltip for the back button -->
<property name="tooltip_text" translatable="yes">Go back to the previous page</property>
@@ -32,6 +33,7 @@
<child>
<object class="GtkButton" id="navigation_forward">
<property name="visible">True</property>
+ <property name="action-name">toolbar.navigation-forward</property>
<property name="valign">center</property>
<!-- Translators: tooltip for the forward button -->
<property name="tooltip_text" translatable="yes">Go forward to the next page</property>
diff --git a/src/window-commands.c b/src/window-commands.c
index b89062744..15abec58e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -723,6 +723,12 @@ window_cmd_navigation (GSimpleAction *action,
EphyWindow *window = EPHY_WINDOW (user_data);
EphyEmbed *embed;
WebKitWebView *web_view;
+ EphyLinkFlags flags = ephy_link_flags_from_current_event ();
+
+ if (flags & EPHY_LINK_NEW_TAB) {
+ window_cmd_navigation_new_tab (action, parameter, user_data);
+ return;
+ }
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_assert (embed != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]