diff options
-rw-r--r-- | Makefile | 41 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | examples/config/config | 6 | ||||
-rw-r--r-- | examples/data/scripts/follow.js | 28 | ||||
-rwxr-xr-x | examples/data/scripts/follow.sh | 20 | ||||
-rw-r--r-- | src/callbacks.c | 62 | ||||
-rw-r--r-- | src/callbacks.h | 5 | ||||
-rw-r--r-- | src/cookie-jar.c | 2 | ||||
-rw-r--r-- | src/uzbl-core.c | 105 | ||||
-rw-r--r-- | src/uzbl-core.h | 3 |
10 files changed, 141 insertions, 134 deletions
@@ -1,5 +1,3 @@ -# first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html - # packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system # end-users who build from source: don't care about DESTDIR, update PREFIX if you want to # RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX @@ -8,31 +6,30 @@ INSTALLDIR?=$(DESTDIR)$(PREFIX) DOCDIR?=$(INSTALLDIR)/share/uzbl/docs RUN_PREFIX?=$(PREFIX) -# gtk2 -REQ_PKGS += gtk+-2.0 webkit-1.0 -CPPFLAGS = +# use GTK3-based webkit when it is available +USE_GTK3 = $(shell pkg-config --exists gtk+-3.0 webkitgtk-3.0 && echo 1) -# gtk3 -#REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED +ifeq ($(USE_GTK3),1) + REQ_PKGS += gtk+-3.0 webkitgtk-3.0 + CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED +else + REQ_PKGS += gtk+-2.0 webkit-1.0 + CPPFLAGS = +endif # --- configuration ends here --- REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 ARCH:=$(shell uname -m) -ARCH!=echo `uname -m` COMMIT_HASH:=$(shell ./misc/hash.sh) -COMMIT_HASH!=echo `./misc/hash.sh` CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) -PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -LDLIBS!=echo pkg-config --libs $(REQ_PKGS) x11 CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -pthread @@ -79,7 +76,6 @@ test-uzbl-core-sandbox: uzbl-core rm -rf ./sandbox/usr test-uzbl-browser-sandbox: uzbl-browser - make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data cp -np ./misc/env.sh ./sandbox/env.sh @@ -90,7 +86,6 @@ test-uzbl-browser-sandbox: uzbl-browser rm -rf ./sandbox/usr test-uzbl-tabbed-sandbox: uzbl-browser - make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-tabbed make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data @@ -130,22 +125,24 @@ install-uzbl-core: all install-dirs install -m644 src/config.h $(DOCDIR)/ install -m644 README $(DOCDIR)/ install -m644 AUTHORS $(DOCDIR)/ - cp -r examples $(INSTALLDIR)/share/uzbl/ - chmod 755 $(INSTALLDIR)/share/uzbl/examples/data/scripts/* install -m755 uzbl-core $(INSTALLDIR)/bin/uzbl-core -install-uzbl-browser: install-dirs - install -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser +install-event-manager: install-dirs install -m755 bin/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager - mv $(INSTALLDIR)/bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser.bak - sed 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' < $(INSTALLDIR)/bin/uzbl-browser.bak > $(INSTALLDIR)/bin/uzbl-browser - chmod 755 $(INSTALLDIR)/bin/uzbl-browser - rm $(INSTALLDIR)/bin/uzbl-browser.bak mv $(INSTALLDIR)/bin/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager.bak sed "s#^PREFIX = .*#PREFIX = '$(RUN_PREFIX)'#" < $(INSTALLDIR)/bin/uzbl-event-manager.bak > $(INSTALLDIR)/bin/uzbl-event-manager chmod 755 $(INSTALLDIR)/bin/uzbl-event-manager rm $(INSTALLDIR)/bin/uzbl-event-manager.bak +install-uzbl-browser: install-dirs install-uzbl-core install-event-manager + install -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser + mv $(INSTALLDIR)/bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser.bak + sed 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' < $(INSTALLDIR)/bin/uzbl-browser.bak > $(INSTALLDIR)/bin/uzbl-browser + chmod 755 $(INSTALLDIR)/bin/uzbl-browser + rm $(INSTALLDIR)/bin/uzbl-browser.bak + cp -r examples $(INSTALLDIR)/share/uzbl/ + chmod 755 $(INSTALLDIR)/share/uzbl/examples/data/scripts/* + install-uzbl-tabbed: install-dirs install -m755 bin/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed @@ -319,7 +319,8 @@ file). * `socket_dir`: location to store sockets. * `http_debug`: HTTP debug mode (value 0-3). * `scrollbars_visible`: set to 1 to have GTK scrollbars if the document - doesn't fit into the window (defaults to 0) + doesn't fit into the window (defaults to 0). (Note: This option does nothing + on GTK3 due to <https://bugs.webkit.org/show_bug.cgi?id=59197>) * `javascript_windows`: Whether javascript can open windows automatically * `shell_cmd`: Alias which will be expanded to use shell commands (eg `sh -c`). * `print_events`: show events on stdout diff --git a/examples/config/config b/examples/config/config index 0336f1d..9507b95 100644 --- a/examples/config/config +++ b/examples/config/config @@ -343,8 +343,10 @@ set follow_hint_keys = 0123456789 #set follow_hint_keys = qwerty #set follow_hint_keys = asdfghjkl; #set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234 -@cbind fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 0) >\@ -@cbind Fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 1) >\@ +@cbind fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'click') >\@ +@cbind Fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'newwindow') >\@ +@cbind fL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ set +@cbind FL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard @cbind fi = spawn @scripts_dir/go_input.sh # Form filler binds diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index b7b0d82..2d65489 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -16,7 +16,16 @@ uzbldivid = 'uzbl_link_hints'; uzbl.follow = function() { // Export charset = arguments[0]; - newwindow = arguments[2]; + if (arguments[2] == 0 || arguments[2] == 'click') { + newwindow = false; + returnuri = false; + } else if (arguments[2] == 1 || arguments[2] == 'newwindow') { + newwindow = true; + returnuri = false; + } else if (arguments[2] == 'returnuri') { + newwindow = false; + returnuri = true; + } var keypress = arguments[1]; return arguments.callee.followLinks(keypress); @@ -169,9 +178,13 @@ uzbl.follow.reDrawHints = function(elems, chars) { elements.forEach(function(el, i) { var label = labels[i]; var pos = positions[i]; - var doc = uzbl.follow.getDocument(el); - var h = uzbl.follow.generateHint(doc, el, label, pos[0], pos[1]); - doc.hintdiv.appendChild(h); + try { + var doc = uzbl.follow.getDocument(el); + var h = uzbl.follow.generateHint(doc, el, label, pos[0], pos[1]); + doc.hintdiv.appendChild(h); + } catch (err) { + // Unable to attach label -> shrug it off and continue + } }); } @@ -222,7 +235,7 @@ uzbl.follow.followLinks = function(follow) { //var desc = '*[title], img[alt], applet[alt], area[alt], input[alt]'; //var image = 'img, input[type=image]'; - if(newwindow) + if(newwindow || returnuri) var res = this.query(uri); else var res = this.query(followable); @@ -237,6 +250,11 @@ uzbl.follow.followLinks = function(follow) { // clear all of our hints this.clearHints(); + if (returnuri) { + var uri = el.src || el.href; + return "XXXRETURNED_URIXXX" + uri + } + if (newwindow) { // we're opening a new window using the URL attached to this element var uri = el.src || el.href; diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index 0d0b256..3f61488 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -1,7 +1,13 @@ #!/bin/sh # This scripts acts on the return value of followLinks in follow.js -case "$1" in +result=$1 +shift + +uriaction=$1 +shift + +case "$result" in XXXEMIT_FORM_ACTIVEXXX) # a form element was selected printf 'event KEYCMD_CLEAR\n' > "$UZBL_FIFO" @@ -10,4 +16,16 @@ case "$1" in # a link was selected, reset uzbl's input mode printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" ;; + XXXRETURNED_URIXXX*) + uri=${result#XXXRETURNED_URIXXX} + + case "$uriaction" in + set) + printf 'uri '"$uri"'\n' > "$UZBL_FIFO" + ;; + clipboard) + printf "$uri" | xclip + ;; + esac + printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" esac diff --git a/src/callbacks.c b/src/callbacks.c index 3448a20..853edb2 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -12,21 +12,17 @@ void set_proxy_url() { - SoupURI *suri; + const gchar *url = uzbl.net.proxy_url; + SoupSession *session = uzbl.net.soup_session; + SoupURI *soup_uri = NULL; - if (uzbl.net.proxy_url == NULL || *uzbl.net.proxy_url == ' ') { - soup_session_remove_feature_by_type(uzbl.net.soup_session, - (GType) SOUP_SESSION_PROXY_URI); - } - else { - suri = soup_uri_new(uzbl.net.proxy_url); - g_object_set(G_OBJECT(uzbl.net.soup_session), - SOUP_SESSION_PROXY_URI, - suri, NULL); - soup_uri_free(suri); - } + if (url != NULL || *url != 0 || *url != ' ') + soup_uri = soup_uri_new(url); - return; + g_object_set(G_OBJECT(session), SOUP_SESSION_PROXY_URI, soup_uri, NULL); + + if(soup_uri) + soup_uri_free(soup_uri); } @@ -348,16 +344,9 @@ cmd_javascript_windows() { 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)); - } + GtkPolicyType policy = uzbl.gui.scrollbars_visible ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER; - set_webview_scroll_adjustments(); + gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW (uzbl.gui.scrolled_win), policy, policy ); } /* requires webkit >=1.1.14 */ @@ -478,7 +467,7 @@ load_status_change_cb (WebKitWebView* web_view, GParamSpec param_spec) { } } -void +gboolean load_error_cb (WebKitWebView* page, WebKitWebFrame* frame, gchar *uri, gpointer web_err, gpointer ud) { (void) page; (void) frame; (void) ud; GError *err = web_err; @@ -488,6 +477,8 @@ load_error_cb (WebKitWebView* page, WebKitWebFrame* frame, gchar *uri, gpointer TYPE_INT, err->code, TYPE_STR, err->message, NULL); + + return FALSE; } void @@ -750,10 +741,11 @@ request_starting_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitWebRes } void -create_web_view_js2_cb (WebKitWebView* web_view, GParamSpec param_spec) { +create_web_view_js_cb (WebKitWebView* web_view, GParamSpec param_spec) { (void) web_view; (void) param_spec; + webkit_web_view_stop_loading(web_view); const gchar* uri = webkit_web_view_get_uri(web_view); if (strncmp(uri, "javascript:", strlen("javascript:")) == 0) { @@ -764,18 +756,6 @@ create_web_view_js2_cb (WebKitWebView* web_view, GParamSpec param_spec) { send_event(NEW_WINDOW, NULL, TYPE_STR, uri, NULL); } - -gboolean -create_web_view_js_cb (WebKitWebView* web_view, gpointer user_data) { - (void) web_view; - (void) user_data; - - g_object_connect (web_view, "signal::notify::uri", - G_CALLBACK(create_web_view_js2_cb), NULL, NULL); - return TRUE; -} - - /*@null@*/ WebKitWebView* create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data) { (void) web_view; @@ -787,8 +767,8 @@ create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer us WebKitWebView* new_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); - g_signal_connect (new_view, "web-view-ready", - G_CALLBACK(create_web_view_js_cb), NULL); + g_object_connect (new_view, "signal::notify::uri", + G_CALLBACK(create_web_view_js_cb), NULL, NULL); return new_view; } @@ -1062,6 +1042,12 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) { } } +gboolean +scrollbars_policy_cb(WebKitWebView *view) { + (void) view; + return TRUE; +} + void window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame, JSGlobalContextRef *context, JSObjectRef *object) { diff --git a/src/callbacks.h b/src/callbacks.h index 9ad754a..79d7910 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -157,7 +157,7 @@ progress_change_cb (WebKitWebView* web_view, GParamSpec param_spec); void load_status_change_cb (WebKitWebView* web_view, GParamSpec param_spec); -void +gboolean load_error_cb (WebKitWebView* page, WebKitWebFrame* frame, gchar *uri, gpointer web_err, gpointer ud); void @@ -223,6 +223,9 @@ scroll_vert_cb(GtkAdjustment *adjust, void *w); gboolean scroll_horiz_cb(GtkAdjustment *adjust, void *w); +gboolean +scrollbars_policy_cb(WebKitWebView *view); + void window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame, JSGlobalContextRef *context, JSObjectRef *object); diff --git a/src/cookie-jar.c b/src/cookie-jar.c index bc7d022..c2ccd62 100644 --- a/src/cookie-jar.c +++ b/src/cookie-jar.c @@ -43,7 +43,7 @@ changed(SoupCookieJar *jar, SoupCookie *old_cookie, SoupCookie *new_cookie) { gchar *expires = NULL; if(cookie->expires) - expires = g_strdup_printf ("%d", soup_date_to_time_t (cookie->expires)); + expires = g_strdup_printf ("%ld", (long)soup_date_to_time_t (cookie->expires)); send_event (new_cookie ? ADD_COOKIE : DELETE_COOKIE, NULL, TYPE_STR, cookie->domain, diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 118c6da..eeae2ec 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -137,7 +137,10 @@ const struct var_name_to_ptr_t { { "current_encoding", PTR_V_STR(uzbl.behave.current_encoding, 1, set_current_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)}, + +#if !GTK_CHECK_VERSION(3,0,0) { "scrollbars_visible", PTR_V_INT(uzbl.gui.scrollbars_visible, 1, cmd_scrollbars_visibility)}, +#endif /* constants (not dumpable or writeable) */ { "WEBKIT_MAJOR", PTR_C_INT(uzbl.info.webkit_major, NULL)}, @@ -467,30 +470,25 @@ scroll_cmd(WebKitWebView* page, GArray *argv, GString *result) { (void) page; (void) result; gchar *direction = g_array_index(argv, gchar*, 0); gchar *argv1 = g_array_index(argv, gchar*, 1); + GtkAdjustment *bar = NULL; if (g_strcmp0(direction, "horizontal") == 0) - { - if (g_strcmp0(argv1, "begin") == 0) - gtk_adjustment_set_value(uzbl.gui.bar_h, gtk_adjustment_get_lower(uzbl.gui.bar_h)); - else if (g_strcmp0(argv1, "end") == 0) - gtk_adjustment_set_value (uzbl.gui.bar_h, gtk_adjustment_get_upper(uzbl.gui.bar_h) - - gtk_adjustment_get_page_size(uzbl.gui.bar_h)); - else - scroll(uzbl.gui.bar_h, argv1); - } + bar = uzbl.gui.bar_h; else if (g_strcmp0(direction, "vertical") == 0) - { - if (g_strcmp0(argv1, "begin") == 0) - gtk_adjustment_set_value(uzbl.gui.bar_v, gtk_adjustment_get_lower(uzbl.gui.bar_v)); - else if (g_strcmp0(argv1, "end") == 0) - gtk_adjustment_set_value (uzbl.gui.bar_v, gtk_adjustment_get_upper(uzbl.gui.bar_v) - - gtk_adjustment_get_page_size(uzbl.gui.bar_v)); - else - scroll(uzbl.gui.bar_v, argv1); + bar = uzbl.gui.bar_v; + else { + if(uzbl.state.verbose) + puts("Unrecognized scroll format"); + return; } + + if (g_strcmp0(argv1, "begin") == 0) + gtk_adjustment_set_value(bar, gtk_adjustment_get_lower(bar)); + else if (g_strcmp0(argv1, "end") == 0) + gtk_adjustment_set_value (bar, gtk_adjustment_get_upper(bar) - + gtk_adjustment_get_page_size(bar)); else - if(uzbl.state.verbose) - puts("Unrecognized scroll format"); + scroll(bar, argv1); } @@ -756,7 +754,7 @@ download(WebKitWebView *web_view, GArray *argv, GString *result) { WebKitNetworkRequest *req = webkit_network_request_new(uri); WebKitDownload *download = webkit_download_new(req); - download_cb(web_view, download, destination); + download_cb(web_view, download, (gpointer)destination); if(webkit_download_get_destination_uri(download)) webkit_download_start(download); @@ -1259,8 +1257,7 @@ parse_command(const char *cmd, const char *params, GString *result) { void move_statusbar() { - if (!uzbl.gui.scrolled_win && - !uzbl.gui.mainbar) + if (!uzbl.gui.scrolled_win && !uzbl.gui.mainbar) return; g_object_ref(uzbl.gui.scrolled_win); @@ -1445,12 +1442,13 @@ create_scrolled_win() { g->web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); g->scrolled_win = gtk_scrolled_window_new(NULL, NULL); + WebKitWebFrame *wf = webkit_web_view_get_main_frame (g->web_view); - gtk_scrolled_window_set_policy( - GTK_SCROLLED_WINDOW(g->scrolled_win), - GTK_POLICY_NEVER, - GTK_POLICY_NEVER - ); +#if !GTK_CHECK_VERSION(3,0,0) + /* hide the scrollbars by default */ + uzbl.gui.scrollbars_visible = 0; + cmd_scrollbars_visibility(); +#endif gtk_container_add( GTK_CONTAINER(g->scrolled_win), @@ -1481,6 +1479,10 @@ create_scrolled_win() { "signal::focus-out-event", (GCallback)focus_cb, NULL, "signal::window-object-cleared", (GCallback)window_object_cleared_cb,NULL, NULL); + + g_object_connect (G_OBJECT (wf), + "signal::scrollbars-policy-changed", (GCallback)scrollbars_policy_cb, NULL, + NULL); } @@ -1525,14 +1527,13 @@ create_window() { gtk_window_set_title(GTK_WINDOW(window), "Uzbl browser"); #if GTK_CHECK_VERSION(3,0,0) - gtk_window_set_has_resize_grip (window, FALSE); + gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE); #endif - /* if the window has been made small, it shouldn't try to resize itself due - * to a long statusbar. */ + /* the window should never make itself bigger. */ GdkGeometry hints; - hints.min_height = -1; - hints.min_width = 1; + hints.min_height = 1; + hints.min_width = 1; gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &hints, GDK_HINT_MIN_SIZE); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL); @@ -1695,28 +1696,6 @@ retrieve_geometry() { uzbl.gui.geometry = g_string_free(buf, FALSE); } -void -set_webview_scroll_adjustments() { -#if GTK_CHECK_VERSION(2,91,0) - gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); - gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); -#else - gtk_widget_set_scroll_adjustments (GTK_WIDGET (uzbl.gui.web_view), - uzbl.gui.bar_h, uzbl.gui.bar_v); -#endif - - g_object_connect((GObject*)uzbl.gui.bar_v, - "signal::value-changed", (GCallback)scroll_vert_cb, NULL, - "signal::changed", (GCallback)scroll_vert_cb, NULL, - NULL); - - g_object_connect((GObject*)uzbl.gui.bar_h, - "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, - "signal::changed", (GCallback)scroll_horiz_cb, NULL, - NULL); -} - - /* Set up gtk, gobject, variable defaults and other things that tests and other * external applications need to do anyhow */ void @@ -1862,12 +1841,18 @@ main (int argc, char* argv[]) { } /* Scrolling */ - uzbl.gui.scbar_v = (GtkScrollbar*) gtk_vscrollbar_new (NULL); - uzbl.gui.bar_v = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_v); - uzbl.gui.scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); - uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h); + 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)); - set_webview_scroll_adjustments(); + g_object_connect(G_OBJECT (uzbl.gui.bar_v), + "signal::value-changed", (GCallback)scroll_vert_cb, NULL, + "signal::changed", (GCallback)scroll_vert_cb, NULL, + NULL); + + g_object_connect(G_OBJECT (uzbl.gui.bar_h), + "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, + "signal::changed", (GCallback)scroll_horiz_cb, NULL, + NULL); gchar *xwin = g_strdup_printf("%d", (int)uzbl.xwin); g_setenv("UZBL_XID", xwin, TRUE); @@ -1927,7 +1912,7 @@ main (int argc, char* argv[]) { if (uzbl.state.verbose) { printf("Uzbl start location: %s\n", argv[0]); if (uzbl.state.socket_id) - printf("plug_id %i\n", gtk_plug_get_id(uzbl.gui.plug)); + printf("plug_id %i\n", (int)gtk_plug_get_id(uzbl.gui.plug)); else printf("window_id %i\n",(int) uzbl.xwin); printf("pid %i\n", getpid ()); diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 07b6f99..3fde5dc 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -67,8 +67,6 @@ typedef struct { GtkWidget* mainbar_label_right; /* Scrolling */ - GtkScrollbar* scbar_v; /* Horizontal and Vertical Scrollbar */ - GtkScrollbar* scbar_h; /* (These are still hidden) */ GtkAdjustment* bar_v; /* Information about document length */ GtkAdjustment* bar_h; /* and scrolling position */ int scrollbars_visible; @@ -314,7 +312,6 @@ void dump_config(); void dump_config_as_events(); void retrieve_geometry(); -void set_webview_scroll_adjustments(); void event(WebKitWebView *page, GArray *argv, GString *result); void init_connect_socket(); gboolean remove_socket_from_array(GIOChannel *chan); |