[epiphany] Correctly handle shit+click only in ephy-window



commit 7795f72123d8aced9247c512a708583cef62b95a
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Wed Feb 24 10:26:28 2010 -0500

    Correctly handle shit+click only in ephy-window
    
    If we handle shift+click in EphyWebView default handler then we will be
    preventing WebKit from getting *any* shift+click event, this breaks shift+click
    for extending selection. Removing that however makes shift+click browse to
    links just as click would do. The solution is to prevent
    policy_decision_required_cb to browse to the clicked link when it includes the
    shift modifier.
    
    Bug #610844

 embed/ephy-web-view.c |    4 ----
 src/ephy-window.c     |    9 +++++++++
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ca32314..129ee3b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -526,10 +526,6 @@ ephy_web_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
   if (event->button == 3 && event->state == GDK_CONTROL_MASK)
     return FALSE;
 
-  /* We use this for downloading. */
-  if (event->button == 1 && event->state == GDK_SHIFT_MASK)
-    return FALSE;
-
   /* Let WebKitWebView handle this. */
   return GTK_WIDGET_CLASS (ephy_web_view_parent_class)->button_press_event (widget, event);
 }
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 91f9930..21ed758 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2521,6 +2521,15 @@ policy_decision_required_cb (WebKitWebView *web_view,
 		{
 			flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW;
 		}
+		/* Because we connect to button-press-event *after*
+		 * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
+		 * a link when you shift+click it. Otherwise when you
+		 * shift+click a link to download it you would also be taken to
+		 * the link destination. */
+		else if (button == 1 && state == GDK_SHIFT_MASK)
+		{
+			return TRUE;
+		}
 		/* Those were our special cases, we won't handle this */
 		else
 		{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]