aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Simon Lipp <sloonz@gmail.com>2010-01-02 00:32:19 +0100
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2010-01-18 22:09:52 +0100
commitc8fb24d1069aa776bccdf3141adb9d3c3f6e8101 (patch)
tree9cc8bdeea61e45185e5534079d6de24aa95722e2
parentd84b07fd743b1460c0acede3889020165d193dfb (diff)
add a scrollbars_visible option
-rw-r--r--README1
-rw-r--r--src/callbacks.c13
-rw-r--r--src/callbacks.h3
-rw-r--r--src/uzbl-core.c1
-rw-r--r--src/uzbl-core.h1
5 files changed, 19 insertions, 0 deletions
diff --git a/README b/README
index 217e6bf..45a3465 100644
--- a/README
+++ b/README
@@ -235,6 +235,7 @@ Besides the builtin variables you can also define your own ones and use them in
- `fantasy_font_family` = "Pterra"
- `serif_font_family` = serif (example "DejaVu Serif")
- `sans_serif_font_family` = sans (example "DejaVu Sans")
+ - `scrollbars_visible`: set to 1 to have GTK scrollbars if the document doesn't fit into the window (defaults to 0)
* Constants (not dumpable or writeable):
diff --git a/src/callbacks.c b/src/callbacks.c
index dab92c1..9130f5f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -270,6 +270,19 @@ cmd_useragent() {
}
}
+void
+cmd_scrollbars_visibility() {
+ if(uzbl.gui.scrollbars_visible) {
+ uzbl.gui.bar_h = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win));
+ uzbl.gui.bar_v = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win));
+ }
+ else {
+ uzbl.gui.bar_v = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_v));
+ uzbl.gui.bar_h = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_h));
+ }
+ gtk_widget_set_scroll_adjustments (GTK_WIDGET (uzbl.gui.web_view), uzbl.gui.bar_h, uzbl.gui.bar_v);
+}
+
/* requires webkit >=1.1.14 */
void
cmd_view_source() {
diff --git a/src/callbacks.h b/src/callbacks.h
index 3f318f2..882ffa4 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -113,6 +113,9 @@ void
cmd_view_source();
void
+cmd_scrollbars_visibility();
+
+void
cmd_load_start();
WebKitWebSettings*
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 0acd0c5..ce1c77d 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -138,6 +138,7 @@ const struct var_name_to_ptr_t {
{ "default_encoding", PTR_V_STR(uzbl.behave.default_encoding, 1, cmd_default_encoding)},
{ "enforce_96_dpi", PTR_V_INT(uzbl.behave.enforce_96dpi, 1, cmd_enforce_96dpi)},
{ "caret_browsing", PTR_V_INT(uzbl.behave.caret_browsing, 1, cmd_caret_browsing)},
+ { "scrollbars_visible", PTR_V_INT(uzbl.gui.scrollbars_visible, 1, cmd_scrollbars_visibility)},
/* constants (not dumpable or writeable) */
{ "WEBKIT_MAJOR", PTR_C_INT(uzbl.info.webkit_major, NULL)},
diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index df9eb1a..70a383c 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -54,6 +54,7 @@ typedef struct {
GtkScrollbar* scbar_h; // (These are still hidden)
GtkAdjustment* bar_v; // Information about document length
GtkAdjustment* bar_h; // and scrolling position
+ int scrollbars_visible;
WebKitWebView* web_view;
gchar* main_title;
gchar* icon;