Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'dev/update-webkit-options' into experimental

Conflicts:
	Makefile
  • Loading branch information...
commit 39ab47645415140e5af552c983dc3b3fd88d4d8a 2 parents 5c3edb7 + a21a900
@bct bct authored
View
54 Makefile
@@ -1,21 +1,13 @@
# 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
-PREFIX?=/usr/local
-INSTALLDIR?=$(DESTDIR)$(PREFIX)
-DOCDIR?=$(INSTALLDIR)/share/uzbl/docs
-RUN_PREFIX?=$(PREFIX)
+PREFIX ?= /usr/local
+INSTALLDIR ?= $(DESTDIR)$(PREFIX)
+DOCDIR ?= $(INSTALLDIR)/share/uzbl/docs
+RUN_PREFIX ?= $(PREFIX)
-# use GTK3-based webkit when it is available
-USE_GTK3 = $(shell pkg-config --exists gtk+-3.0 webkitgtk-3.0 && echo 1)
-
-ifeq ($(USE_GTK3),1)
- REQ_PKGS += gtk+-3.0 webkitgtk-3.0 javascriptcoregtk-3.0
- CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
-else
- REQ_PKGS += gtk+-2.0 webkit-1.0
- CPPFLAGS =
-endif
+ENABLE_WEBKIT2 ?= auto
+ENABLE_GTK3 ?= auto
PYTHON=python3
PYTHONV=$(shell $(PYTHON) --version | sed -n /[0-9].[0-9]/p)
@@ -23,13 +15,41 @@ COVERAGE=$(shell which coverage)
# --- configuration ends here ---
-REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0
+ifeq ($(ENABLE_WEBKIT2),auto)
+ENABLE_WEBKIT2 := $(shell pkg-config --exists webkit2gtk-3.0 && echo yes)
+# WebKit2 requires GTK3
+ENABLE_GTK3 := yes
+endif
+
+ifeq ($(ENABLE_GTK3),auto)
+ENABLE_GTK3 := $(shell pkg-config --exists gtk+-3.0 && echo yes)
+endif
+
+ifeq ($(ENABLE_WEBKIT2),yes)
+REQ_PKGS += 'webkit2gtk-3.0 >= 1.2.4' javascriptcoregtk-3.0
+CPPFLAGS += -DUSE_WEBKIT2
+else
+ifeq ($(ENABLE_GTK3),yes)
+REQ_PKGS += 'webkitgtk-3.0 >= 1.2.4' javascriptcoregtk-3.0
+else
+REQ_PKGS += 'webkit-1.0 >= 1.2.4' javascriptcoregtk-1.0
+endif
+endif
+
+ifeq ($(ENABLE_GTK3),yes)
+REQ_PKGS += gtk+-3.0
+CPPFLAGS += -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
+else
+REQ_PKGS += gtk+-2.0
+endif
+
+REQ_PKGS += 'libsoup-2.4 >= 2.30' gthread-2.0 glib-2.0
ARCH:=$(shell uname -m)
COMMIT_HASH:=$(shell ./misc/hash.sh)
-CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\"
+CPPFLAGS += -D_BSD_SOURCE -D_POSIX_SOURCE -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\"
PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS))
@@ -37,7 +57,7 @@ LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11)
CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -pthread
-SRC = $(wildcard src/*.c)
+SRC = $(wildcard src/*.c)
HEAD = $(wildcard src/*.h)
OBJ = $(foreach obj, $(SRC:.c=.o), $(notdir $(obj)))
LOBJ = $(foreach obj, $(SRC:.c=.lo), $(notdir $(obj)))
View
66 README
@@ -258,7 +258,7 @@ The following commands are recognized:
- Adds a new cookie to the cookie jar
* `delete_cookie <domain> <path> <name> <value> [<scheme> <expires>]`
- Deletes a matching cookie from the cookie jar. scheme and expire time
- is currently not considered when matching.
+ is currently not considered when matching.
* `clear_cookies`
- Clears all cookies from the cookie jar
* `download <uri> [<destination path>]`
@@ -337,7 +337,8 @@ file).
to their original size. Setting this will resize the currently displayed page.
* `zoom_type`: Whether to use "full-content" zoom (defaults to true). With
full-content zoom on, all page content, not just text, is zoomed. When
- full-content zoom is off, only the text of a page is zoomed.
+ full-content zoom is off, only the text of a page is zoomed. This is
+ unavailable with webkit2gtk. Use `zoom_text_only` instead.
* `font_size`: The default font size.
* `default_font_family`: The default font family used to display text.
* `monospace_font_family`: The default font family used to display monospace
@@ -349,7 +350,6 @@ file).
* `fantasy_font_family`: The default Fantasy font family used to display text.
* `monospace_size`: The default size of monospaced font (default 1).
* `minimum_font_size`: The minimum font size used to display text (default 1).
-* `enable_pagecache`: Enable the webkit pagecache (it caches rendered pages for a speedup when you go back or forward in history) (default 0).
* `enable_plugins`: Disable embedded plugin objects (default 0).
* `enable_scripts`: Disable embedded scripting languages (default 0).
* `autoload_images`: Automatically load images (default 1).
@@ -360,6 +360,8 @@ file).
`en_CA` or `pt_BR`) to be used for spell checking, separated by commas.
Defaults to the value returned by `gtk_get_default_language`.
* `enable_private`: Whether to enable private browsing mode (default 0).
+* `cookie_policy`: If set to 0, all cookies are accepted, if set to 1, all
+ cookies are rejected, and 2 rejects third party cookies (default 0).
* `print_backgrounds`: Print background images? (default 0).
* `stylesheet_uri`: Use this to override the pagelayout with a custom
stylesheet.
@@ -372,13 +374,62 @@ file).
* `enable_cross_file_access`: Whether a page loaded from a `file://` URI can
access the contents of other `file://` URIs. (default 0).
* `follow_hint_keys`: keys for keyboard-based navigation and link
- highlighting
+ highlighting
* `handle_multi_click`: If set to 1, event handlers attached to `2Button*`
- and `3Button*` bindings will only be used instead of the default actions in
- WebKit (default 0).
+ and `3Button*` bindings will only be used instead of the default actions in
+ WebKit (default 0).
* `ssl_ca_file`: File that contains CA certificates.
* `ssl_verify`: If set to 1, uzbl won't connect to "https" url unless it can
- validate certificate presented by remote server against `ssl_ca_file`.
+ validate certificate presented by remote server against `ssl_ca_file`.
+* `enable_java_applet`: If set to 1, support for Java <applet> tags will be
+ enabled (default 1).
+* `enable_database`: If set to 1, support for HTML5 client-side SQL databases
+ will be enabled (default 1).
+* `enable_local_storage`: If set to 1, websites will be able to store data
+ locally (default 1).
+* `enable_pagecache`: If set to 1, uzbl will store previously visited pages for
+ faster access (the cache is local to each uzbl instance) (default 0).
+* `enable_offline_app_cache`: If set to 1, web applications may be cached locally
+ for offline use (default 1).
+* `enable_universal_file_access`: If set to 1, allow `file://` URIs to access
+ all pages (default 0).
+* `enable_hyperlink_auditing`: If set to 1, the `ping` attribute on anchors will
+ be supported (default 0).
+* `zoom_step`: The change in the zoon level when zooming (default 0.1).
+* `auto_resize_window`: If set to 1, allow web pages to change window dimensions
+ (default 0).
+* `enable_spatial_navigation`: If set to 1, the arrow keys in `Ins` mode will
+ navigate between form elements (default 0).
+* `editing_behavior`: When set to 0, emulate Mac behavior in text fields, 1
+ for Windows behavior, and 2 for *nix behavior (the default).
+* `enable_tab_cycle`: If set to 1, the `Tab` key cycles between elements on
+ the page (default 1).
+* `default_context_menu`: If set to 0, do not cause context menus to appear when
+ right clicking (default 1).
+* `enable_site_workarounds`: If set to 1, enable filters to help unbreak
+ certain websites (default 0).
+* `javascript_clipboard`: If set to 1, JavaScript may access the clipboard
+ (default 0). Requires webkitgtk >= 1.3.0.
+* `javascript_dom_paste`: If set to 1, JavaScript will able to paste from the
+ clipboard (default 0).
+* `enable_frame_flattening`: If set to 1, flatten all frames into a single
+ page to become one scrollable page (default 0). Requires webkitgtk >= 1.3.5.
+* `enable_fullscreen`: If set to 1, Mozilla-style fullscreening will be
+ available (default 0). Requires webkitgtk >= 1.3.8
+* `enable_dns_prefetch`: If set to 1, domain names will be prefetched
+ (default 1). Private browsing does *not* affect this value. Requires
+ webkitgtk >= 1.3.13.
+* `enable_webgl`: If set to 1, WebGL support will be enabled (default 0).
+ Requires webkitgtk >= 1.3.14.
+* `local_storage_path`: Where to store local databases (default
+ $XDG_DATA_HOME/webkit/databases/). Requires webkit >= 1.5.2.
+* `enable_webaudio`: If set to 1, allows JavaScript to generate audio
+ directly (default 0). Requires webkit >= 1.7.5.
+* `enable_3d_acceleration`: If set to 1, the GPU will be used to render
+ animations and 3D CSS transformations. Requires webkitgtk >= 1.7.90.
+* `zoom_text_only`: If set to 1, only text will be zoomed. Requires webkit2gtk
+ >= 1.7.91.
+
#### Constants (not dumpable or writeable)
@@ -514,6 +565,7 @@ access to the following environment variables:
* `$UZBL_SOCKET`: The filename of the Unix socket being used, if any.
* `$UZBL_URI`: The URI of the current page.
* `$UZBL_TITLE`: The current page title.
+* `$UZBL_PRIVATE`: Set if uzbl is in "private browsing mode", unset otherwise.
Handler scripts (`download_handler`, `cookie_handler`, `scheme_handler`,
`request_handler`, and `authentication_handler`) are called with special
View
16 examples/config/config
@@ -8,6 +8,7 @@ set prefix = @(echo $PREFIX)@
set data_home = @(echo $XDG_DATA_HOME)@
set cache_home = @(echo $XDG_CACHE_HOME)@
set config_home = @(echo $XDG_CONFIG_HOME)@
+set local_storage_path = @data_home/uzbl/databases/
# Interface paths.
set fifo_dir = /tmp
@@ -138,6 +139,8 @@ set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname
# === Configure cookie blacklist ========================================================
+set cookie_policy = 0
+
# Accept 'session cookies' from uzbl.org (when you have a whitelist all other cookies are dropped)
#request WHITELIST_COOKIE domain 'uzbl.org$' expires '^$'
@@ -192,6 +195,8 @@ set ebind = @mode_bind global,-insert
@on_event ESCAPE @set_mode
@on_event ESCAPE event KEYCMD_CLEAR
@on_event ESCAPE js uzbl.follow.clearHints()
+@on_event ESCAPE search_clear
+@on_event ESCAPE js window.getSelection().removeAllRanges()
@bind <Escape> = event ESCAPE
@bind <Ctrl>[ = event ESCAPE
@@ -323,6 +328,7 @@ set ebind = @mode_bind global,-insert
@cbind yu = sh 'echo -n "$UZBL_URI" | xclip'
@cbind yU = sh 'echo -n "$1" | xclip' '\@SELECTED_URI'
@cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip'
+@cbind ys = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard
# Clone current window
@cbind c = event REQ_NEW_WINDOW \@uri
@@ -360,6 +366,16 @@ set follow_hint_keys = 0123456789
@cbind FL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard
@cbind fi = spawn @scripts_dir/go_input.sh
+@cbind fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ set
+@cbind fS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('click') >\@
+@cbind Fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('newwindow') >\@
+@cbind FS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard
+
+@cbind ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ set
+@cbind fT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@
+@cbind Ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'newwindow') >\@
+@cbind FT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ clipboard
+
@cbind '* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@
# Form filler binds
View
16 examples/data/scripts/follow.js
@@ -326,3 +326,19 @@ uzbl.follow.followLinks = function(str) {
this.reDrawHints(leftover, len);
}
}
+
+uzbl.follow.followSelection = function(mode) {
+ var selection = window.getSelection()
+ if (!selection)
+ return
+
+ var node = selection.anchorNode
+ if (!node)
+ return
+
+ var el = node.parentElement
+ if (!el)
+ return
+
+ this.elementSelected(el)
+}
View
9 examples/data/scripts/follow.sh
@@ -14,12 +14,18 @@ case "$result" in
printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO"
;;
XXXNEW_WINDOWXXX*)
- printf "set mode=\nevent KEYCMD_CLEAR\nevent NEW_WINDOW $@\n" > "$UZBL_FIFO"
+ echo "set mode=
+event KEYCMD_CLEAR
+event NEW_WINDOW $@" > "$UZBL_FIFO"
;;
XXXRETURNED_URIXXX*)
uriaction=$1
uri=${result#XXXRETURNED_URIXXX}
+ printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO"
+
+ [ -z "$uri" ] && exit
+
case "$uriaction" in
set)
printf 'uri '"$uri"'\n' | sed -e 's/@/\\@/' > "$UZBL_FIFO"
@@ -28,5 +34,4 @@ case "$result" in
printf "$uri" | xclip
;;
esac
- printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO"
esac
View
2  examples/data/scripts/history.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+[ -n "${UZBL_PRIVATE-1}" ] && exit 0
+
. "$UZBL_UTIL_DIR/uzbl-dir.sh"
>> "$UZBL_HISTORY_FILE" || exit 1
View
30 src/callbacks.c
@@ -10,6 +10,8 @@
#include "type.h"
#include "variables.h"
+#include <gdk/gdk.h>
+
void
link_hover_cb (WebKitWebView *page, const gchar *title, const gchar *link, gpointer data) {
(void) page; (void) title; (void) data;
@@ -248,7 +250,9 @@ motion_notify_cb(GtkWidget* window, GdkEventMotion* event, gpointer user_data) {
}
gboolean
-navigation_decision_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) {
+navigation_decision_cb (WebKitWebView *web_view, WebKitWebFrame *frame,
+ WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action,
+ WebKitWebPolicyDecision *policy_decision, gpointer user_data) {
(void) web_view;
(void) frame;
(void) navigation_action;
@@ -320,7 +324,9 @@ new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame,
}
gboolean
-mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data) {
+mime_policy_cb (WebKitWebView *web_view, WebKitWebFrame *frame,
+ WebKitNetworkRequest *request, gchar *mime_type,
+ WebKitWebPolicyDecision *policy_decision, gpointer user_data) {
(void) frame;
(void) request;
(void) user_data;
@@ -345,11 +351,17 @@ request_starting_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitWebRes
(void) response;
(void) user_data;
- const gchar* uri = webkit_network_request_get_uri (request);
+ const gchar *uri = webkit_network_request_get_uri (request);
+ SoupMessage *message = webkit_network_request_get_message (request);
+
+ if (message) {
+ SoupURI *soup_uri = soup_uri_new (uri);
+ soup_message_set_first_party (message, soup_uri);
+ }
if (uzbl.state.verbose)
printf("Request starting -> %s\n", uri);
- send_event (REQUEST_STARTING, NULL, TYPE_STR, webkit_network_request_get_uri(request), NULL);
+ send_event (REQUEST_STARTING, NULL, TYPE_STR, uri, NULL);
if (uzbl.behave.request_handler) {
GString *result = g_string_new ("");
@@ -621,7 +633,15 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) {
if (mi->context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE) {
GdkEventButton ev;
gint x, y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_device_position (gtk_widget_get_window(GTK_WIDGET(v)),
+ gdk_device_manager_get_client_pointer (
+ gdk_display_get_device_manager (
+ gtk_widget_get_display (GTK_WIDGET (v)))),
+ &x, &y, NULL);
+#else
gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(v)), &x, &y, NULL);
+#endif
ev.x = x;
ev.y = y;
mi->hittest = webkit_web_view_get_hit_test_result(v, &ev);
@@ -665,7 +685,7 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) {
void
window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame,
- JSGlobalContextRef *context, JSObjectRef *object) {
+ JSGlobalContextRef *context, JSObjectRef *object) {
(void) frame; (void) context; (void) object;
#if WEBKIT_CHECK_VERSION (1, 3, 13)
// Take this opportunity to set some callbacks on the DOM
View
2  src/callbacks.h
@@ -77,7 +77,7 @@ scroll_horiz_cb(GtkAdjustment *adjust, void *w);
void
window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame,
- JSGlobalContextRef *context, JSObjectRef *object);
+ JSGlobalContextRef *context, JSObjectRef *object);
#if WEBKIT_CHECK_VERSION (1, 3, 13)
void
View
4 src/commands.h
@@ -4,7 +4,11 @@
#ifndef __COMMANDS__
#define __COMMANDS__
+#ifdef USE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
View
20 src/cookie-jar.c
@@ -41,21 +41,21 @@ changed(SoupCookieJar *jar, SoupCookie *old_cookie, SoupCookie *new_cookie) {
* propagated to other uzbl instances using add/delete_cookie. */
if(!uzbl_jar->in_manual_add) {
gchar *scheme = cookie->secure
- ? cookie->http_only ? "httpsOnly" : "https"
- : cookie->http_only ? "httpOnly" : "http";
+ ? cookie->http_only ? "httpsOnly" : "https"
+ : cookie->http_only ? "httpOnly" : "http";
gchar *expires = NULL;
if(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,
- TYPE_STR, cookie->path,
- TYPE_STR, cookie->name,
- TYPE_STR, cookie->value,
- TYPE_STR, scheme,
- TYPE_STR, expires ? expires : "",
- NULL);
+ send_event (new_cookie ? ADD_COOKIE : DELETE_COOKIE, NULL,
+ TYPE_STR, cookie->domain,
+ TYPE_STR, cookie->path,
+ TYPE_STR, cookie->name,
+ TYPE_STR, cookie->value,
+ TYPE_STR, scheme,
+ TYPE_STR, expires ? expires : "",
+ NULL);
if(expires)
g_free(expires);
View
12 src/events.c
@@ -284,10 +284,10 @@ get_modifier_mask(guint state) {
g_string_append(modifiers, "Ctrl|");
if(state & GDK_MOD1_MASK)
g_string_append(modifiers,"Mod1|");
- /* Mod2 is usually Num_Luck. Ignore it as it messes up keybindings.
+ /* Mod2 is usually Num_Luck. Ignore it as it messes up keybindings.
if(state & GDK_MOD2_MASK)
g_string_append(modifiers,"Mod2|");
- */
+ */
if(state & GDK_MOD3_MASK)
g_string_append(modifiers,"Mod3|");
if(state & GDK_MOD4_MASK)
@@ -349,10 +349,10 @@ guint key_to_modifier(guint keyval) {
}
}
-guint button_to_modifier(guint buttonval) {
- if(buttonval <= 5)
- return 1 << (7 + buttonval);
- return 0;
+guint button_to_modifier (guint buttonval) {
+ if(buttonval <= 5)
+ return 1 << (7 + buttonval);
+ return 0;
}
/* Transform gdk key events to our own events */
View
16 src/inspector.c
@@ -8,14 +8,14 @@
#include "callbacks.h"
#include "type.h"
-void
+static void
hide_window_cb(GtkWidget *widget, gpointer data) {
(void) data;
gtk_widget_hide(widget);
}
-WebKitWebView*
+static WebKitWebView *
create_inspector_cb (WebKitWebInspector* web_inspector, WebKitWebView* page, gpointer data){
(void) data;
(void) page;
@@ -44,7 +44,7 @@ create_inspector_cb (WebKitWebInspector* web_inspector, WebKitWebView* page, gpo
return WEBKIT_WEB_VIEW(new_web_view);
}
-gboolean
+static gboolean
inspector_show_window_cb (WebKitWebInspector* inspector){
(void) inspector;
gtk_widget_show(uzbl.gui.inspector_window);
@@ -54,32 +54,32 @@ inspector_show_window_cb (WebKitWebInspector* inspector){
}
/* TODO: Add variables and code to make use of these functions */
-gboolean
+static gboolean
inspector_close_window_cb (WebKitWebInspector* inspector){
(void) inspector;
send_event(WEBINSPECTOR, NULL, TYPE_NAME, "close", NULL);
return TRUE;
}
-gboolean
+static gboolean
inspector_attach_window_cb (WebKitWebInspector* inspector){
(void) inspector;
return FALSE;
}
-gboolean
+static gboolean
inspector_detach_window_cb (WebKitWebInspector* inspector){
(void) inspector;
return FALSE;
}
-gboolean
+static gboolean
inspector_uri_changed_cb (WebKitWebInspector* inspector){
(void) inspector;
return FALSE;
}
-gboolean
+static gboolean
inspector_inspector_destroyed_cb (WebKitWebInspector* inspector){
(void) inspector;
return FALSE;
View
6 src/io.c
@@ -1,5 +1,3 @@
-#define _POSIX_SOURCE
-
#include <stdio.h>
#include "events.h"
@@ -49,7 +47,7 @@ control_fifo(GIOChannel *gio, GIOCondition condition) {
}
-gboolean
+static gboolean
attach_fifo(gchar *path) {
GError *error = NULL;
/* we don't really need to write to the file, but if we open the
@@ -261,7 +259,7 @@ control_client_socket(GIOChannel *clientchan) {
}
-gboolean
+static gboolean
attach_socket(gchar *path, struct sockaddr_un *local) {
GIOChannel *chan = NULL;
int sock = socket (AF_UNIX, SOCK_STREAM, 0);
View
6 src/menu.c
@@ -2,7 +2,7 @@
#include "util.h"
#include "uzbl-core.h"
-void
+static void
add_to_menu(GArray *argv, guint context) {
GUI *g = &uzbl.gui;
MenuItem *m;
@@ -68,7 +68,7 @@ menu_add_edit(WebKitWebView *page, GArray *argv, GString *result) {
}
-void
+static void
add_separator_to_menu(GArray *argv, guint context) {
GUI *g = &uzbl.gui;
MenuItem *m;
@@ -127,7 +127,7 @@ menu_add_separator_edit(WebKitWebView *page, GArray *argv, GString *result) {
}
-void
+static void
remove_from_menu(GArray *argv, guint context) {
GUI *g = &uzbl.gui;
MenuItem *mi;
View
4 src/menu.h
@@ -1,7 +1,11 @@
#ifndef __MENU__
#define __MENU__
+#ifdef USE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
typedef struct {
gchar* name;
View
2  src/status-bar.h
@@ -10,7 +10,7 @@
#define UZBL_IS_STATUS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UZBL_TYPE_STATUS_BAR))
#define UZBL_STATUS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UZBL_TYPE_STATUS_BAR, UzblStatusBarClass))
-typedef struct _UzblStatusBar UzblStatusBar;
+typedef struct _UzblStatusBar UzblStatusBar;
typedef struct _UzblStatusBarClass UzblStatusBarClass;
struct _UzblStatusBar {
View
47 src/util.c
@@ -1,5 +1,3 @@
-#define _POSIX_SOURCE
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -8,6 +6,11 @@
gchar* find_existing_file2(gchar *, const gchar *);
+typedef struct {
+ const gchar* environmental;
+ const gchar* default_value;
+} XDG_Var;
+
const XDG_Var XDG[] = {
{ "XDG_CONFIG_HOME", "~/.config" },
{ "XDG_DATA_HOME", "~/.local/share" },
@@ -17,7 +20,9 @@ const XDG_Var XDG[] = {
};
/*@null@*/ gchar*
-get_xdg_var (XDG_Var xdg) {
+get_xdg_var (enum xdg_type type) {
+ XDG_Var xdg = XDG[type];
+
const gchar *actual_value = getenv(xdg.environmental);
const gchar *home = getenv("HOME");
@@ -30,25 +35,37 @@ get_xdg_var (XDG_Var xdg) {
return str_replace("~", home, actual_value);
}
-/*@null@*/ gchar*
-find_xdg_file (int xdg_type, const char* basename) {
- /* xdg_type = 0 => config
- xdg_type = 1 => data
- xdg_type = 2 => cache */
+void
+ensure_xdg_vars (void) {
+ int i;
+
+ for (i = 0; i <= 2; ++i) {
+ gchar* xdg = get_xdg_var(i);
+
+ if (!xdg)
+ continue;
- gchar *xdgv = get_xdg_var(XDG[xdg_type]);
- gchar *path = g_strconcat (xdgv, basename, NULL);
- g_free (xdgv);
+ setenv(XDG[i].environmental, xdg, 0);
+
+ g_free(xdg);
+ }
+}
+
+/*@null@*/ gchar*
+find_xdg_file (enum xdg_type type, const char* basename) {
+ gchar *dirs = get_xdg_var(type);
+ gchar *path = g_strconcat (dirs, basename, NULL);
+ g_free (dirs);
if (file_exists(path))
- return path;
+ return path; /* we found the file */
- if (xdg_type == 2)
- return NULL;
+ if (type == XDG_CACHE)
+ return NULL; /* there's no system cache directory */
/* the file doesn't exist in the expected directory.
* check if it exists in one of the system-wide directories. */
- char *system_dirs = get_xdg_var(XDG[3 + xdg_type]);
+ char *system_dirs = get_xdg_var(3 + type);
path = find_existing_file2(system_dirs, basename);
g_free(system_dirs);
View
11 src/util.h
@@ -1,13 +1,12 @@
#include <glib.h>
#include <stdio.h>
-typedef struct {
- gchar* environmental;
- gchar* default_value;
-} XDG_Var;
+enum xdg_type {
+ XDG_CONFIG, XDG_DATA, XDG_CACHE
+};
-gchar* get_xdg_var(XDG_Var xdg);
-gchar* find_xdg_file(int xdg_type, const char* filename);
+void ensure_xdg_vars(void);
+gchar* find_xdg_file(enum xdg_type type, const char* filename);
gboolean file_exists(const char* filename);
char* str_replace(const char* search, const char* replace, const char* string);
gboolean for_each_line_in_file(const gchar *path, void (*callback)(const gchar *l, void *c), void *user_data);
View
30 src/uzbl-core.c
@@ -290,7 +290,7 @@ get_click_context() {
ht = webkit_web_view_get_hit_test_result (g->web_view, uzbl.state.last_button);
g_object_get (ht, "context", &context, NULL);
- g_object_unref (ht);
+ g_object_unref (ht);
return (gint)context;
}
@@ -310,7 +310,7 @@ setup_signal(int signr, sigfunc *shandler) {
return NULL;
}
-void
+static void
empty_event_buffer(int s) {
(void) s;
if(uzbl.state.event_buffer) {
@@ -356,12 +356,12 @@ parse_cmd_line_cb(const char *line, void *user_data) {
}
void
-run_command_file(const gchar *path) {
- if(!for_each_line_in_file(path, parse_cmd_line_cb, NULL)) {
- gchar *tmp = g_strdup_printf("File %s can not be read.", path);
- send_event(COMMAND_ERROR, NULL, TYPE_STR, tmp, NULL);
- g_free(tmp);
- }
+run_command_file (const gchar *path) {
+ if(!for_each_line_in_file(path, parse_cmd_line_cb, NULL)) {
+ gchar *tmp = g_strdup_printf("File %s can not be read.", path);
+ send_event(COMMAND_ERROR, NULL, TYPE_STR, tmp, NULL);
+ g_free(tmp);
+ }
}
/* Javascript*/
@@ -463,7 +463,7 @@ search_text (WebKitWebView *page, const gchar *key, const gboolean forward) {
}
}
-void
+static void
sharg_append(GArray *a, const gchar *str) {
const gchar *s = (str ? str : "");
g_array_append_val(a, s);
@@ -517,7 +517,7 @@ run_command (const gchar *command, const gchar **args, const gboolean sync,
return result;
}
-/*@null@*/ gchar**
+/*@null@*/ static gchar**
split_quoted(const gchar* src, const gboolean unquote) {
/* split on unquoted space or tab, return array of strings;
remove a layer of quotes and backslashes if unquote */
@@ -841,7 +841,7 @@ settings_init () {
/* Load config file, if any */
if (s->config_file) {
- run_command_file(s->config_file);
+ run_command_file(s->config_file);
g_setenv("UZBL_CONFIG", s->config_file, TRUE);
} else if (uzbl.state.verbose)
printf ("No configuration file loaded.\n");
@@ -922,6 +922,11 @@ initialize(int argc, char** argv) {
uzbl.info.webkit_major = webkit_major_version();
uzbl.info.webkit_minor = webkit_minor_version();
uzbl.info.webkit_micro = webkit_micro_version();
+#ifdef USE_WEBKIT2
+ uzbl.info.webkit2 = 1;
+#else
+ uzbl.info.webkit2 = 0;
+#endif
uzbl.info.arch = ARCH;
uzbl.info.commit = COMMIT;
@@ -964,6 +969,9 @@ initialize(int argc, char** argv) {
commands_hash();
variables_hash();
+ /* XDG */
+ ensure_xdg_vars();
+
/* GUI */
gtk_init(&argc, &argv);
View
7 src/uzbl-core.h
@@ -13,8 +13,6 @@
#ifndef __UZBL_CORE__
#define __UZBL_CORE__
-#define _POSIX_SOURCE
-
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
@@ -25,7 +23,11 @@
#include <sys/un.h>
#include <sys/utsname.h>
#include <sys/time.h>
+#ifdef USE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
#include <libsoup/soup.h>
#include <JavaScriptCore/JavaScript.h>
@@ -178,6 +180,7 @@ typedef struct {
int webkit_major;
int webkit_minor;
int webkit_micro;
+ int webkit2;
gchar* arch;
gchar* commit;
View
317 src/variables.c
@@ -5,6 +5,8 @@
#include "io.h"
#include "util.h"
+#include <stdlib.h>
+
uzbl_cmdprop *
get_var_c(const gchar *name) {
return g_hash_table_lookup(uzbl.behave.proto_var, name);
@@ -202,7 +204,7 @@ get_var_value_float(const gchar *name) {
return get_var_value_float_c(c);
}
-void
+static void
dump_var_hash(gpointer k, gpointer v, gpointer ud) {
(void) ud;
uzbl_cmdprop *c = v;
@@ -225,7 +227,7 @@ dump_config() {
g_hash_table_foreach(uzbl.behave.proto_var, dump_var_hash, NULL);
}
-void
+static void
dump_var_hash_as_event(gpointer k, gpointer v, gpointer ud) {
(void) ud;
uzbl_cmdprop *c = v;
@@ -240,18 +242,23 @@ dump_config_as_events() {
}
/* is the given string made up entirely of decimal digits? */
-gboolean
+static gboolean
string_is_integer(const char *s) {
return (strspn(s, "0123456789") == strlen(s));
}
-GObject*
+static GObject *
+cookie_jar() {
+ return G_OBJECT(uzbl.net.soup_cookie_jar);
+}
+
+static GObject *
view_settings() {
return G_OBJECT(webkit_web_view_get_settings(uzbl.gui.web_view));
}
-void
+static void
set_window_property(const gchar* prop, const gchar* value) {
if(GTK_IS_WIDGET(uzbl.gui.main_window)) {
gdk_property_change(
@@ -276,7 +283,7 @@ uri_change_cb (WebKitWebView *web_view, GParamSpec param_spec) {
set_window_property("UZBL_URI", uzbl.state.uri);
}
-gchar *
+static gchar *
make_uri_from_user_input(const gchar *uri) {
gchar *result = NULL;
@@ -312,7 +319,7 @@ make_uri_from_user_input(const gchar *uri) {
return g_strconcat("http://", uri, NULL);
}
-void
+static void
set_uri(const gchar *uri) {
/* Strip leading whitespace */
while (*uri && isspace(*uri))
@@ -340,7 +347,7 @@ set_uri(const gchar *uri) {
g_free (newuri);
}
-void
+static void
set_max_conns(int max_conns) {
uzbl.net.max_conns = max_conns;
@@ -348,7 +355,7 @@ set_max_conns(int max_conns) {
SOUP_SESSION_MAX_CONNS, uzbl.net.max_conns, NULL);
}
-void
+static void
set_max_conns_host(int max_conns_host) {
uzbl.net.max_conns_host = max_conns_host;
@@ -356,7 +363,7 @@ set_max_conns_host(int max_conns_host) {
SOUP_SESSION_MAX_CONNS_PER_HOST, uzbl.net.max_conns_host, NULL);
}
-void
+static void
set_http_debug(int debug) {
uzbl.behave.http_debug = debug;
@@ -371,77 +378,171 @@ set_http_debug(int debug) {
SOUP_SESSION_FEATURE(uzbl.net.soup_logger));
}
-void
+static void
set_ca_file(gchar *path) {
g_object_set (uzbl.net.soup_session, "ssl-ca-file", path, NULL);
}
-gchar *
+static gchar *
get_ca_file() {
gchar *path;
g_object_get (uzbl.net.soup_session, "ssl-ca-file", &path, NULL);
return path;
}
-void
+static void
set_verify_cert(int strict) {
g_object_set (uzbl.net.soup_session, "ssl-strict", strict, NULL);
}
-int
+static int
get_verify_cert() {
int strict;
g_object_get (uzbl.net.soup_session, "ssl-strict", &strict, NULL);
return strict;
}
+#define EXPOSE_SOUP_COOKIE_JAR_SETTINGS(SYM, PROPERTY, TYPE) \
+static void set_##SYM(TYPE val) { \
+ g_object_set(cookie_jar(), (PROPERTY), val, NULL); \
+} \
+static TYPE get_##SYM() { \
+ TYPE val; \
+ g_object_get(cookie_jar(), (PROPERTY), &val, NULL); \
+ return val; \
+}
+
+EXPOSE_SOUP_COOKIE_JAR_SETTINGS(cookie_policy, "accept-policy", int)
+
+#undef EXPOSE_SOUP_COOKIE_JAR_SETTINGS
+
+
#define EXPOSE_WEBKIT_VIEW_SETTINGS(SYM, PROPERTY, TYPE) \
-void set_##SYM(TYPE val) { \
+static void set_##SYM(TYPE val) { \
g_object_set(view_settings(), (PROPERTY), val, NULL); \
} \
-TYPE get_##SYM() { \
+static TYPE get_##SYM() { \
TYPE val; \
g_object_get(view_settings(), (PROPERTY), &val, NULL); \
return val; \
}
-EXPOSE_WEBKIT_VIEW_SETTINGS(default_font_family, "default-font-family", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(monospace_font_family, "monospace-font-family", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(sans_serif_font_family, "sans_serif-font-family", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(serif_font_family, "serif-font-family", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(cursive_font_family, "cursive-font-family", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(fantasy_font_family, "fantasy-font-family", gchar *)
+/* Font settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(default_font_family, "default-font-family", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(monospace_font_family, "monospace-font-family", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(sans_serif_font_family, "sans_serif-font-family", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(serif_font_family, "serif-font-family", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(cursive_font_family, "cursive-font-family", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(fantasy_font_family, "fantasy-font-family", gchar *)
+
+/* Font size settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(minimum_font_size, "minimum-font-size", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(font_size, "default-font-size", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(monospace_size, "default-monospace-font-size", int)
+
+/* Text settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(default_encoding, "default-encoding", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enforce_96_dpi, "enforce-96-dpi", int)
+
+/* Feature settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_plugins, "enable-plugins", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_java_applet, "enable-java-applet", int)
+#if WEBKIT_CHECK_VERSION (1, 3, 14)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_webgl, "enable-webgl", int)
+#endif
+#if WEBKIT_CHECK_VERSION (1, 7, 5)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_webaudio, "enable-webaudio", int)
+#endif
+#if WEBKIT_CHECK_VERSION (1, 7, 90) // Documentation says 1.7.5, but it's not there.
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_3d_acceleration, "enable-accelerated-compositing", int)
+#endif
+
+/* HTML5 Database settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_database, "enable-html5-database", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_local_storage, "enable-html5-local-storage", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_pagecache, "enable-page-cache", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_offline_app_cache, "enable-offline-web-application-cache", int)
+#if WEBKIT_CHECK_VERSION (1, 5, 2)
+EXPOSE_WEBKIT_VIEW_SETTINGS(local_storage_path, "html5-local-storage-database-path", gchar *)
+#endif
-EXPOSE_WEBKIT_VIEW_SETTINGS(minimum_font_size, "minimum-font-size", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(font_size, "default-font-size", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(monospace_size, "default-monospace-font-size", int)
+/* Security settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_private_webkit, "enable-private-browsing", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_universal_file_access, "enable-universal-access-from-file-uris", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_cross_file_access, "enable-file-access-from-file-uris", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_hyperlink_auditing, "enable-hyperlink-auditing", int)
+#if WEBKIT_CHECK_VERSION (1, 3, 13)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_dns_prefetch, "enable-dns-prefetching", int)
+#endif
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_plugins, "enable-plugins", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_scripts, "enable-scripts", int)
+/* Display settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(zoom_step, "zoom-step", float)
+EXPOSE_WEBKIT_VIEW_SETTINGS(caret_browsing, "enable-caret-browsing", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(auto_resize_window, "auto-resize-window", int)
+#if WEBKIT_CHECK_VERSION (1, 3, 5)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_frame_flattening, "enable-frame-flattening", int)
+#endif
+#if WEBKIT_CHECK_VERSION (1, 3, 8)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_fullscreen, "enable-fullscreen", int)
+#endif
+#ifdef USE_WEBKIT2
+#if WEBKIT_CHECK_VERSION (1, 7, 91)
+EXPOSE_WEBKIT_VIEW_SETTINGS(zoom_text_only, "zoom-text-only", int)
+#endif
+#endif
-EXPOSE_WEBKIT_VIEW_SETTINGS(javascript_windows, "javascript-can-open-windows-automatically", int)
+/* Javascript settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_scripts, "enable-scripts", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(javascript_windows, "javascript-can-open-windows-automatically", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(javascript_dom_paste, "enable-dom-paste", int)
+#if WEBKIT_CHECK_VERSION (1, 3, 0)
+EXPOSE_WEBKIT_VIEW_SETTINGS(javascript_clipboard, "javascript-can-access-clipboard", int)
+#endif
-EXPOSE_WEBKIT_VIEW_SETTINGS(autoload_images, "auto-load-images", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(autoshrink_images, "auto-shrink-images", int)
+/* Image settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(autoload_images, "auto-load-images", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(autoshrink_images, "auto-shrink-images", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_pagecache, "enable-page-cache", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_private, "enable-private-browsing", int)
+/* Spell checking settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_spellcheck, "enable-spell-checking", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(spellcheck_languages, "spell-checking-languages", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_spellcheck, "enable-spell-checking", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(spellcheck_languages, "spell-checking-languages", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(resizable_text_areas, "resizable-text-areas", int)
+/* Form settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(resizable_text_areas, "resizable-text-areas", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_spatial_navigation, "enable-spatial-navigation", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(editing_behavior, "editing-behavior", int)
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_tab_cycle, "tab-key-cycles-through-elements", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(stylesheet_uri, "user-stylesheet-uri", gchar *)
-EXPOSE_WEBKIT_VIEW_SETTINGS(print_bg, "print-backgrounds", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enforce_96_dpi, "enforce-96-dpi", int)
+/* Customization */
+EXPOSE_WEBKIT_VIEW_SETTINGS(stylesheet_uri, "user-stylesheet-uri", gchar *)
+EXPOSE_WEBKIT_VIEW_SETTINGS(default_context_menu, "enable-default-context-menu", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(caret_browsing, "enable-caret-browsing", int)
+/* Hacks */
+EXPOSE_WEBKIT_VIEW_SETTINGS(enable_site_workarounds, "enable-site-specific-quirks", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(enable_cross_file_access, "enable-file-access-from-file-uris", int)
+/* Printing settings */
+EXPOSE_WEBKIT_VIEW_SETTINGS(print_bg, "print-backgrounds", int)
-EXPOSE_WEBKIT_VIEW_SETTINGS(default_encoding, "default-encoding", gchar *)
+#undef EXPOSE_WEBKIT_VIEW_SETTINGS
-void
+static void
+set_enable_private (int private) {
+ const char *priv_envvar = "UZBL_PRIVATE";
+
+ if (private)
+ setenv (priv_envvar, "true", 1);
+ else
+ unsetenv (priv_envvar);
+
+ set_enable_private_webkit (private);
+}
+
+static int
+get_enable_private () {
+ return get_enable_private_webkit ();
+}
+
+static void
set_proxy_url(const gchar *proxy_url) {
g_free(uzbl.net.proxy_url);
uzbl.net.proxy_url = g_strdup(proxy_url);
@@ -459,7 +560,7 @@ set_proxy_url(const gchar *proxy_url) {
soup_uri_free(soup_uri);
}
-void
+static void
set_authentication_handler(const gchar *handler) {
/* Check if WEBKIT_TYPE_SOUP_AUTH_DIALOG feature is set */
GSList *flist = soup_session_get_features (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
@@ -480,7 +581,7 @@ set_authentication_handler(const gchar *handler) {
}
}
-void
+static void
set_status_background(const gchar *background) {
/* labels and hboxes do not draw their own background. applying this
* on the vbox/main_window is ok as the statusbar is the only affected
@@ -501,7 +602,7 @@ set_status_background(const gchar *background) {
#endif
}
-void
+static void
set_icon(const gchar *icon) {
if(file_exists(icon) && uzbl.gui.main_window) {
g_free(uzbl.gui.icon);
@@ -513,7 +614,7 @@ set_icon(const gchar *icon) {
}
}
-void
+static void
set_window_role(const gchar *role) {
if (!uzbl.gui.main_window)
return;
@@ -521,7 +622,7 @@ set_window_role(const gchar *role) {
gtk_window_set_role(GTK_WINDOW (uzbl.gui.main_window), role);
}
-gchar *
+static gchar *
get_window_role() {
if (!uzbl.gui.main_window)
return NULL;
@@ -585,7 +686,7 @@ get_show_status() {
return gtk_widget_get_visible(uzbl.gui.status_bar);
}
-void
+static void
set_status_top(int status_top) {
if (!uzbl.gui.scrolled_win && !uzbl.gui.status_bar)
return;
@@ -612,7 +713,7 @@ set_status_top(int status_top) {
gtk_widget_grab_focus (GTK_WIDGET (uzbl.gui.web_view));
}
-void
+static void
set_current_encoding(const gchar *encoding) {
if(strlen(encoding) == 0)
encoding = NULL;
@@ -620,13 +721,13 @@ set_current_encoding(const gchar *encoding) {
webkit_web_view_set_custom_encoding(uzbl.gui.web_view, encoding);
}
-gchar *
+static gchar *
get_current_encoding() {
const gchar *encoding = webkit_web_view_get_custom_encoding(uzbl.gui.web_view);
return g_strdup(encoding);
}
-void
+static void
set_fifo_dir(const gchar *fifo_dir) {
g_free(uzbl.behave.fifo_dir);
@@ -636,7 +737,7 @@ set_fifo_dir(const gchar *fifo_dir) {
uzbl.behave.fifo_dir = NULL;
}
-void
+static void
set_socket_dir(const gchar *socket_dir) {
g_free(uzbl.behave.socket_dir);
@@ -646,26 +747,27 @@ set_socket_dir(const gchar *socket_dir) {
uzbl.behave.socket_dir = NULL;
}
-void
+static void
set_inject_html(const gchar *html) {
webkit_web_view_load_html_string (uzbl.gui.web_view, html, NULL);
}
-void
+static void
set_useragent(const gchar *useragent) {
g_free(uzbl.net.useragent);
- if (*useragent == ' ') {
+ if (!useragent || !*useragent) {
uzbl.net.useragent = NULL;
} else {
uzbl.net.useragent = g_strdup(useragent);
g_object_set(G_OBJECT(uzbl.net.soup_session), SOUP_SESSION_USER_AGENT,
uzbl.net.useragent, NULL);
+ g_object_set(view_settings(), "user-agent", uzbl.net.useragent, NULL);
}
}
-void
+static void
set_accept_languages(const gchar *accept_languages) {
g_free(uzbl.net.accept_languages);
@@ -679,8 +781,7 @@ set_accept_languages(const gchar *accept_languages) {
}
}
-/* requires webkit >=1.1.14 */
-void
+static void
set_view_source(int view_source) {
uzbl.behave.view_source = view_source;
@@ -688,6 +789,7 @@ set_view_source(int view_source) {
(gboolean) uzbl.behave.view_source);
}
+#ifndef USE_WEBKIT2
void
set_zoom_type (int type) {
webkit_web_view_set_full_content_zoom (uzbl.gui.web_view, type);
@@ -697,13 +799,14 @@ int
get_zoom_type () {
return webkit_web_view_get_full_content_zoom (uzbl.gui.web_view);
}
+#endif
-void
+static void
set_zoom_level(float zoom_level) {
webkit_web_view_set_zoom_level (uzbl.gui.web_view, zoom_level);
}
-float
+static float
get_zoom_level() {
return webkit_web_view_get_zoom_level (uzbl.gui.web_view);
}
@@ -774,37 +877,94 @@ const struct var_name_to_ptr_t {
{ "ssl_verify", PTR_V_INT_GETSET(verify_cert)},
/* exported WebKitWebSettings properties */
- { "javascript_windows", PTR_V_INT_GETSET(javascript_windows)},
- { "zoom_level", PTR_V_FLOAT_GETSET(zoom_level)},
- { "zoom_type", PTR_V_INT_GETSET(zoom_type)},
-
+ /* Font settings */
{ "default_font_family", PTR_V_STR_GETSET(default_font_family)},
{ "monospace_font_family", PTR_V_STR_GETSET(monospace_font_family)},
- { "cursive_font_family", PTR_V_STR_GETSET(cursive_font_family)},
{ "sans_serif_font_family", PTR_V_STR_GETSET(sans_serif_font_family)},
{ "serif_font_family", PTR_V_STR_GETSET(serif_font_family)},
+ { "cursive_font_family", PTR_V_STR_GETSET(cursive_font_family)},
{ "fantasy_font_family", PTR_V_STR_GETSET(fantasy_font_family)},
-
- { "monospace_size", PTR_V_INT_GETSET(monospace_size)},
- { "font_size", PTR_V_INT_GETSET(font_size)},
+ /* Font size settings */
{ "minimum_font_size", PTR_V_INT_GETSET(minimum_font_size)},
-
- { "enable_pagecache", PTR_V_INT_GETSET(enable_pagecache)},
+ { "font_size", PTR_V_INT_GETSET(font_size)},
+ { "monospace_size", PTR_V_INT_GETSET(monospace_size)},
+ /* Text settings */
+ { "default_encoding", PTR_V_STR_GETSET(default_encoding)},
+ { "current_encoding", PTR_V_STR_GETSET(current_encoding)},
+ { "enforce_96_dpi", PTR_V_INT_GETSET(enforce_96_dpi)},
+ /* Feature settings */
{ "enable_plugins", PTR_V_INT_GETSET(enable_plugins)},
+ { "enable_java_applet", PTR_V_INT_GETSET(enable_java_applet)},
+#if WEBKIT_CHECK_VERSION (1, 3, 14)
+ { "enable_webgl", PTR_V_INT_GETSET(enable_webgl)},
+#endif
+#if WEBKIT_CHECK_VERSION (1, 7, 5)
+ { "enable_webaudio", PTR_V_INT_GETSET(enable_webaudio)},
+#endif
+#if WEBKIT_CHECK_VERSION (1, 7, 90) // Documentation says 1.7.5, but it's not there.
+ { "enable_3d_acceleration", PTR_V_INT_GETSET(enable_3d_acceleration)},
+#endif
+ /* HTML5 Database settings */
+ { "enable_database", PTR_V_INT_GETSET(enable_database)},
+ { "enable_local_storage", PTR_V_INT_GETSET(enable_local_storage)},
+ { "enable_pagecache", PTR_V_INT_GETSET(enable_pagecache)},
+ { "enable_offline_app_cache", PTR_V_INT_GETSET(enable_offline_app_cache)},
+#if WEBKIT_CHECK_VERSION (1, 5, 2)
+ { "local_storage_path", PTR_V_STR_GETSET(local_storage_path)},
+#endif
+ /* Security settings */
+ { "enable_private", PTR_V_INT_GETSET(enable_private)},
+ { "enable_universal_file_access", PTR_V_INT_GETSET(enable_universal_file_access)},
+ { "enable_cross_file_access", PTR_V_INT_GETSET(enable_cross_file_access)},
+ { "enable_hyperlink_auditing", PTR_V_INT_GETSET(enable_hyperlink_auditing)},
+ { "cookie_policy", PTR_V_INT_GETSET(cookie_policy)},
+#if WEBKIT_CHECK_VERSION (1, 3, 13)
+ { "enable_dns_prefetch", PTR_V_INT_GETSET(enable_dns_prefetch)},
+#endif
+ /* Display settings */
+ { "zoom_level", PTR_V_FLOAT_GETSET(zoom_level)},
+ { "zoom_step", PTR_V_FLOAT_GETSET(zoom_step)},
+#ifndef USE_WEBKIT2
+ { "zoom_type", PTR_V_INT_GETSET(zoom_type)},
+#endif
+ { "caret_browsing", PTR_V_INT_GETSET(caret_browsing)},
+ { "auto_resize_window", PTR_V_INT_GETSET(auto_resize_window)},
+#if WEBKIT_CHECK_VERSION (1, 3, 5)
+ { "enable_frame_flattening", PTR_V_INT_GETSET(enable_frame_flattening)},
+#endif
+#if WEBKIT_CHECK_VERSION (1, 3, 8)
+ { "enable_fullscreen", PTR_V_INT_GETSET(enable_fullscreen)},
+#endif
+#ifdef USE_WEBKIT2
+#if WEBKIT_CHECK_VERSION (1, 7, 91)
+ { "zoom_text_only", PTR_V_INT_GETSET(zoom_text_only)},
+#endif
+#endif
+ /* Javascript settings */
{ "enable_scripts", PTR_V_INT_GETSET(enable_scripts)},
+ { "javascript_windows", PTR_V_INT_GETSET(javascript_windows)},
+ { "javascript_dom_paste", PTR_V_INT_GETSET(javascript_dom_paste)},
+#if WEBKIT_CHECK_VERSION (1, 3, 0)
+ { "javascript_clipboard", PTR_V_INT_GETSET(javascript_clipboard)},
+#endif
+ /* Image settings */
{ "autoload_images", PTR_V_INT_GETSET(autoload_images)},
{ "autoshrink_images", PTR_V_INT_GETSET(autoshrink_images)},
+ /* Spell checking settings */
{ "enable_spellcheck", PTR_V_INT_GETSET(enable_spellcheck)},
{ "spellcheck_languages", PTR_V_STR_GETSET(spellcheck_languages)},
- { "enable_private", PTR_V_INT_GETSET(enable_private)},
- { "print_backgrounds", PTR_V_INT_GETSET(print_bg)},
- { "stylesheet_uri", PTR_V_STR_GETSET(stylesheet_uri)},
+ /* Form settings */
{ "resizable_text_areas", PTR_V_INT_GETSET(resizable_text_areas)},
- { "default_encoding", PTR_V_STR_GETSET(default_encoding)},
- { "current_encoding", PTR_V_STR_GETSET(current_encoding)},
- { "enforce_96_dpi", PTR_V_INT_GETSET(enforce_96_dpi)},
- { "caret_browsing", PTR_V_INT_GETSET(caret_browsing)},
- { "enable_cross_file_access", PTR_V_INT_GETSET(enable_cross_file_access)},
+ { "enable_spatial_navigation", PTR_V_INT_GETSET(enable_spatial_navigation)},
+ { "editing_behavior", PTR_V_INT_GETSET(editing_behavior)},
+ { "enable_tab_cycle", PTR_V_INT_GETSET(enable_tab_cycle)},
+ /* Customization */
+ { "stylesheet_uri", PTR_V_STR_GETSET(stylesheet_uri)},
+ { "default_context_menu", PTR_V_INT_GETSET(default_context_menu)},
+ /* Hacks */
+ { "enable_site_workarounds", PTR_V_INT_GETSET(enable_site_workarounds)},
+ /* Printing settings */
+ { "print_backgrounds", PTR_V_INT_GETSET(print_bg)},
{ "inject_html", { .type = TYPE_STR, .dump = 0, .writeable = 1, .getter = NULL, .setter = (uzbl_fp) set_inject_html }},
@@ -812,6 +972,7 @@ const struct var_name_to_ptr_t {
{ "WEBKIT_MAJOR", PTR_C_INT(uzbl.info.webkit_major)},
{ "WEBKIT_MINOR", PTR_C_INT(uzbl.info.webkit_minor)},
{ "WEBKIT_MICRO", PTR_C_INT(uzbl.info.webkit_micro)},
+ { "HAS_WEBKIT2", PTR_C_INT(uzbl.info.webkit2)},
{ "ARCH_UZBL", PTR_C_STR(uzbl.info.arch)},
{ "COMMIT", PTR_C_STR(uzbl.info.commit)},
{ "TITLE", PTR_C_STR(uzbl.gui.main_title)},
View
6 src/variables.h
@@ -6,7 +6,11 @@
#define __VARIABLES__
#include <glib.h>
+#ifdef USE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
#include "type.h"
@@ -34,8 +38,6 @@ void dump_config_as_events();
void uri_change_cb (WebKitWebView *web_view, GParamSpec param_spec);
-void set_show_status(int);
-
void set_zoom_type(int);
int get_zoom_type();
Please sign in to comment.
Something went wrong with that request. Please try again.