Scrolling is now handled through WebKit
authorQuentin Rameau <quinq@fifth.space>
Wed, 18 Nov 2015 14:23:42 +0000 (15:23 +0100)
committerQuentin Rameau <quinq@fifth.space>
Thu, 19 Nov 2015 23:23:59 +0000 (00:23 +0100)
We don't have access anymore to the scrolling process and have to rely
entirely on WebKit.
We could be able to manage scrolling and bars directly by manipulating
the DOM via a WebKitExtension. To be continued…

surf.c

diff --git a/surf.c b/surf.c
index b298030..30c3f85 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -53,7 +53,7 @@ union Arg {
 };
 
 typedef struct Client {
-       GtkWidget *win, *scroll, *vbox, *pane;
+       GtkWidget *win;
        Window xid;
        WebKitWebView *view;
        WebKitWebInspector *inspector;
@@ -778,7 +778,6 @@ newclient(void)
 {
        Client *c;
        WebKitWebSettings *settings;
-       WebKitWebFrame *frame;
        GdkGeometry hints = { 1, 1 };
        GdkScreen *screen;
        GdkWindow *gwin;
@@ -822,13 +821,6 @@ newclient(void)
        if (!kioskmode)
                addaccelgroup(c);
 
-       /* Pane */
-       c->pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
-
-       /* VBox */
-       c->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-       gtk_paned_pack1(GTK_PANED(c->pane), c->vbox, TRUE, TRUE);
-
        /* Webview */
        c->view = WEBKIT_WEB_VIEW(webkit_web_view_new());
 
@@ -875,35 +867,11 @@ newclient(void)
                         "should-show-delete-interface-for-element",
                         G_CALLBACK(deletion_interface), c);
 
-       /* Scrolled Window */
-       c->scroll = gtk_scrolled_window_new(NULL, NULL);
-
-       frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(c->view));
-       g_signal_connect(G_OBJECT(frame), "scrollbars-policy-changed",
-                        G_CALLBACK(gtk_true), NULL);
-
-       if (!enablescrollbars) {
-               gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll),
-                                              GTK_POLICY_NEVER,
-                                              GTK_POLICY_NEVER);
-       } else {
-               gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll),
-                                              GTK_POLICY_AUTOMATIC,
-                                              GTK_POLICY_AUTOMATIC);
-       }
-
        /* Arranging */
-       gtk_container_add(GTK_CONTAINER(c->scroll), GTK_WIDGET(c->view));
-       gtk_container_add(GTK_CONTAINER(c->win), c->pane);
-       gtk_container_add(GTK_CONTAINER(c->vbox), c->scroll);
+       gtk_container_add(GTK_CONTAINER(c->win), GTK_WIDGET(c->view));
 
        /* Setup */
-       gtk_box_set_child_packing(GTK_BOX(c->vbox), c->scroll, TRUE, TRUE, 0,
-                                 GTK_PACK_START);
        gtk_widget_grab_focus(GTK_WIDGET(c->view));
-       gtk_widget_show(c->pane);
-       gtk_widget_show(c->vbox);
-       gtk_widget_show(c->scroll);
        gtk_widget_show(GTK_WIDGET(c->view));
        gtk_widget_show(c->win);
        gwin = gtk_widget_get_window(GTK_WIDGET(c->win));