From 256be2ddd5b687eb196b31b313d927dcc976438b Mon Sep 17 00:00:00 2001 From: "Carlos J. Torres" Date: Thu, 21 Feb 2013 09:59:07 -0500 Subject: [PATCH] disable scrollbars scrollbars-b * add variable to config.def.h * add flag to main * add flag to usage * add flag to surf.1 manual * add hard setting to newclient(); * remove old setting in newclient(); Enjoy :) --- config.def.h | 1 + surf.1 | 3 +++ surf.c | 19 +++++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h index bbfb1ed..540bd88 100644 --- a/config.def.h +++ b/config.def.h @@ -10,6 +10,7 @@ static char *cafile = "/etc/ssl/certs/ca-certificates.crt"; static char *strictssl = FALSE; /* Refuse untrusted SSL connections */ /* Webkit default features */ +static Bool enablescrollbars = TRUE; static Bool enablespatialbrowsing = TRUE; static Bool enableplugins = TRUE; static Bool enablescripts = TRUE; diff --git a/surf.1 b/surf.1 index 1bad494..5bc02e4 100644 --- a/surf.1 +++ b/surf.1 @@ -35,6 +35,9 @@ Disable the Web Inspector (Developer Tools). .B \-p Disable Plugins .TP +.B \-b +Disable Scrollbars +.TP .B \-r scriptfile Specify the user .I scriptfile. diff --git a/surf.c b/surf.c index ba00e5b..aae3761 100644 --- a/surf.c +++ b/surf.c @@ -656,11 +656,19 @@ newclient(void) { /* Scrolled Window */ c->scroll = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); /* Webview */ c->view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(c->view)); + + if(!enablescrollbars) { + g_signal_connect(G_OBJECT(frame), "scrollbars-policy-changed", + G_CALLBACK(gtk_true), NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll), + GTK_POLICY_NEVER, GTK_POLICY_NEVER); + } + g_signal_connect(G_OBJECT(c->view), "title-changed", G_CALLBACK(titlechange), c); @@ -718,8 +726,8 @@ newclient(void) { gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c); webkit_web_view_set_full_content_zoom(c->view, TRUE); - frame = webkit_web_view_get_main_frame(c->view); runscript(frame); + settings = webkit_web_view_get_settings(c->view); if(!(ua = getenv("SURF_USERAGENT"))) ua = useragent; @@ -1128,7 +1136,7 @@ updatewinid(Client *c) { static void usage(void) { - die("usage: %s [-inpsvx] [-c cookiefile] [-e xid] [-r scriptfile]" + die("usage: %s [-ibnpsvx] [-c cookiefile] [-e xid] [-r scriptfile]" " [-t stylefile] [-u useragent] [uri]\n", basename(argv0)); } @@ -1171,6 +1179,9 @@ main(int argc, char *argv[]) { case 'i': loadimages = 0; break; + case 'b': + enablescrollbars = 0; + break; case 'n': enableinspector = 0; break; -- 1.7.12.1