[Xfce4-commits] <midori:master> Space at the bottom of the page: Go to next page

Christian Dywan noreply at xfce.org
Thu Jul 28 22:02:01 CEST 2011


Updating branch refs/heads/master
         to abe60b164b285e8d4c2bfdd7cf46e65e8c489754 (commit)
       from 32286215d6a524e02e0a8e76adc23ac5008f6a65 (commit)

commit abe60b164b285e8d4c2bfdd7cf46e65e8c489754
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Jul 28 21:59:29 2011 +0200

    Space at the bottom of the page: Go to next page

 midori/midori-browser.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 63514e4..c42492b 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1609,6 +1609,7 @@ midori_browser_key_press_event (GtkWidget*   widget,
     MidoriBrowser* browser = MIDORI_BROWSER (widget);
     GtkWidgetClass* widget_class;
     guint clean_state;
+    GtkWidget* focus;
 
     /* Interpret Ctrl(+Shift)+Tab as tab switching for compatibility */
     if (midori_browser_get_nth_tab (browser, 1) != NULL
@@ -1639,8 +1640,31 @@ midori_browser_key_press_event (GtkWidget*   widget,
         return TRUE;
     }
 
-    if (gtk_window_get_focus (GTK_WINDOW (widget)) == NULL)
+    focus = gtk_window_get_focus (GTK_WINDOW (widget));
+    if (focus == NULL)
         gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
+    else if (G_OBJECT_TYPE (focus) == WEBKIT_TYPE_WEB_VIEW
+          && event->keyval == GDK_space
+          && !webkit_web_view_can_cut_clipboard (WEBKIT_WEB_VIEW (focus))
+          && !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus)))
+    {
+        /* Space at the bottom of the page: Go to next page */
+        GtkScrolledWindow* scrolled = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (focus));
+        MidoriView* view = MIDORI_VIEW (gtk_widget_get_parent (GTK_WIDGET (scrolled)));
+        GtkAdjustment* vadjust = gtk_scrolled_window_get_vadjustment (scrolled);
+        if (gtk_adjustment_get_value (vadjust)
+         == (gtk_adjustment_get_upper (vadjust) - gtk_adjustment_get_page_size (vadjust)))
+        {
+            /* Duplicate here because the URI pointer might change */
+            gchar* uri = g_strdup (midori_view_get_next_page (view));
+            if (uri != NULL)
+            {
+                midori_view_set_uri (view, uri);
+                g_free (uri);
+                return TRUE;
+            }
+        }
+    }
 
     if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
         if (sokoke_window_activate_key (window, event))


More information about the Xfce4-commits mailing list