diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | uzbl.c | 20 |
3 files changed, 19 insertions, 6 deletions
@@ -29,6 +29,7 @@ Contributors: (kmeaw) - fix for multibyte utf8 characters segfault (evocallaghan) - tiny patches Aaron Griffin (phrakture) - Makefile patches to build on OSX + Mason Larobina - os.environ.keys() & os.path.join fix in cookies.py Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c Which is copyrighted: @@ -1,5 +1,5 @@ -CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) -LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4) -pthread $(LDFLAGS) +CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) +LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) all: uzbl uzblctrl PREFIX?=$(DESTDIR)/usr @@ -445,12 +445,24 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { /* scroll a bar in a given direction */ static void scroll (GtkAdjustment* bar, GArray *argv) { - gdouble amount; gchar *end; + gdouble max_value; - amount = g_ascii_strtod(g_array_index(argv, gchar*, 0), &end); - if (*end == '%') amount = gtk_adjustment_get_page_size(bar) * amount * 0.01; - gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+amount); + gdouble page_size = gtk_adjustment_get_page_size(bar); + gdouble value = gtk_adjustment_get_value(bar); + gdouble amount = g_ascii_strtod(g_array_index(argv, gchar*, 0), &end); + + if (*end == '%') + value += page_size * amount * 0.01; + else + value += amount; + + max_value = gtk_adjustment_get_upper(bar) - page_size; + + if (value > max_value) + value = max_value; /* don't scroll past the end of the page */ + + gtk_adjustment_set_value (bar, value); } static void |