aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--examples/configs/sampleconfig3
-rw-r--r--examples/configs/sampleconfig-dev2
-rw-r--r--uzbl.c143
-rw-r--r--uzbl.h14
5 files changed, 88 insertions, 78 deletions
diff --git a/Makefile b/Makefile
index fa20b6c..40b395c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CPPFLAGS:=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS)
-LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0) $(LDFLAGS)
+CPPFLAGS=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -pedantic -std=gnu99 -W -DARCH="\"$(shell uname -m)\"" -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\""
+LDFLAGS=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)
all: uzbl uzblctrl
PREFIX?=$(DESTDIR)/usr
diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig
index 621d438..ce36fa6 100644
--- a/examples/configs/sampleconfig
+++ b/examples/configs/sampleconfig
@@ -11,7 +11,7 @@
# You can use any command in place of spawn
set history_handler = spawn /usr/share/uzbl/examples/scripts/history.sh
set download_handler = spawn /usr/share/uzbl/examples/scripts/download.sh
-set cookie_handler = spawn /usr/share/uzbl/examples/scripts/cookies.sh
+#set cookie_handler = spawn /usr/share/uzbl/examples/scripts/cookies.sh
set minimum_font_size = 6
set font_size = 11
@@ -69,6 +69,7 @@ bind r = reload
bind R = reload_ign_cache
bind + = zoom_in
bind - = zoom_out
+bind = = sh "echo set zoom_level = 1.0 > $4"
bind t = toggle_status
# Hilight matches. Notice the * after the slash - it makes the command incremental, i.e. gets called
# on every character you type. You can do `bind /_ = search %s' if you want it less interactive.
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev
index c1c2e1d..939fa7e 100644
--- a/examples/configs/sampleconfig-dev
+++ b/examples/configs/sampleconfig-dev
@@ -11,7 +11,7 @@
# Usually you want to spawn a script to handle things, but any command (such as sh) can be used
set history_handler = spawn ./examples/scripts/history.sh
set download_handler = spawn ./examples/scripts/download.sh
-set cookie_handler = spawn ./examples/scripts/cookies.sh
+#set cookie_handler = spawn ./examples/scripts/cookies.sh
set minimum_font_size = 6
set font_size = 11
diff --git a/uzbl.c b/uzbl.c
index bb11fcf..94369b0 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 4; -*- */
-// Original code taken from the example webkit-gtk+ application. see notice below.
-// Modified code is licensed under the GPL 3. See LICENSE file.
+/* Original code taken from the example webkit-gtk+ application. see notice below. */
+/* Modified code is licensed under the GPL 3. See LICENSE file. */
/*
@@ -36,23 +36,23 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
+
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/un.h>
#include <sys/utsname.h>
#include <sys/time.h>
+#include <sys/un.h>
+
#include <webkit/webkit.h>
+#include <libsoup/soup.h>
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
-#include <string.h>
#include <fcntl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <libsoup/soup.h>
#include <signal.h>
#include "uzbl.h"
#include "config.h"
@@ -85,7 +85,7 @@ typedef const struct {
void (*func)(void);
} uzbl_cmdprop;
-enum {TYPE_INT, TYPE_STR};
+enum {TYPE_INT, TYPE_STR, TYPE_FLOAT};
/* an abbreviation to help keep the table's width humane */
#define PTR(var, t, d, fun) { .ptr = (void*)&(var), .type = TYPE_##t, .dump = d, .func = fun }
@@ -96,61 +96,59 @@ const struct {
} var_name_to_ptr[] = {
/* variable name pointer to variable in code type dump callback function */
/* --------------------------------------------------------------------------------------- */
- { "uri", PTR(uzbl.state.uri, STR, 1, cmd_load_uri)},
- { "verbose", PTR(uzbl.state.verbose, INT, 1, NULL)},
- { "mode", PTR(uzbl.behave.mode, INT, 0, NULL)},
- { "inject_html", PTR(uzbl.behave.inject_html, STR, 0, cmd_inject_html)},
- { "base_url", PTR(uzbl.behave.base_url, STR, 1, NULL)},
- { "html_endmarker", PTR(uzbl.behave.html_endmarker, STR, 1, NULL)},
- { "html_mode_timeout", PTR(uzbl.behave.html_timeout, INT, 1, NULL)},
- { "status_message", PTR(uzbl.gui.sbar.msg, STR, 1, update_title)},
- { "show_status", PTR(uzbl.behave.show_status, INT, 1, cmd_set_status)},
- { "status_top", PTR(uzbl.behave.status_top, INT, 1, move_statusbar)},
- { "status_format", PTR(uzbl.behave.status_format, STR, 1, update_title)},
- { "status_pbar_done", PTR(uzbl.gui.sbar.progress_s, STR, 1, update_title)},
- { "status_pbar_pending", PTR(uzbl.gui.sbar.progress_u, STR, 1, update_title)},
- { "status_pbar_width", PTR(uzbl.gui.sbar.progress_w, INT, 1, update_title)},
- { "status_background", PTR(uzbl.behave.status_background, STR, 1, update_title)},
- { "insert_indicator", PTR(uzbl.behave.insert_indicator, STR, 1, update_title)},
- { "command_indicator", PTR(uzbl.behave.cmd_indicator, STR, 1, update_title)},
- { "title_format_long", PTR(uzbl.behave.title_format_long, STR, 1, update_title)},
- { "title_format_short", PTR(uzbl.behave.title_format_short, STR, 1, update_title)},
- { "insert_mode", PTR(uzbl.behave.insert_mode, INT, 1, NULL)},
- { "always_insert_mode", PTR(uzbl.behave.always_insert_mode, INT, 1, cmd_always_insert_mode)},
- { "reset_command_mode", PTR(uzbl.behave.reset_command_mode, INT, 1, NULL)},
- { "modkey", PTR(uzbl.behave.modkey, STR, 1, cmd_modkey)},
- { "load_finish_handler", PTR(uzbl.behave.load_finish_handler, STR, 1, NULL)},
- { "load_start_handler", PTR(uzbl.behave.load_start_handler, STR, 1, NULL)},
- { "load_commit_handler", PTR(uzbl.behave.load_commit_handler, STR, 1, NULL)},
- { "history_handler", PTR(uzbl.behave.history_handler, STR, 1, NULL)},
- { "download_handler", PTR(uzbl.behave.download_handler, STR, 1, NULL)},
- { "cookie_handler", PTR(uzbl.behave.cookie_handler, STR, 1, cmd_cookie_handler)},
- { "fifo_dir", PTR(uzbl.behave.fifo_dir, STR, 1, cmd_fifo_dir)},
- { "socket_dir", PTR(uzbl.behave.socket_dir, STR, 1, cmd_socket_dir)},
- { "http_debug", PTR(uzbl.behave.http_debug, INT, 1, cmd_http_debug)},
- { "shell_cmd", PTR(uzbl.behave.shell_cmd, STR, 1, NULL)},
- { "proxy_url", PTR(uzbl.net.proxy_url, STR, 1, set_proxy_url)},
- { "max_conns", PTR(uzbl.net.max_conns, INT, 1, cmd_max_conns)},
- { "max_conns_host", PTR(uzbl.net.max_conns_host, INT, 1, cmd_max_conns_host)},
- { "useragent", PTR(uzbl.net.useragent, STR, 1, cmd_useragent)},
- /* exported WebKitWebSettings properties*/
- { "font_size", PTR(uzbl.behave.font_size, INT, 1, cmd_font_size)},
- { "monospace_size", PTR(uzbl.behave.monospace_size, INT, 1, cmd_font_size)},
- { "minimum_font_size", PTR(uzbl.behave.minimum_font_size, INT, 1, cmd_minimum_font_size)},
- { "disable_plugins", PTR(uzbl.behave.disable_plugins, INT, 1, cmd_disable_plugins)},
- { "disable_scripts", PTR(uzbl.behave.disable_scripts, INT, 1, cmd_disable_scripts)},
- { "autoload_images", PTR(uzbl.behave.autoload_img, INT, 1, cmd_autoload_img)},
- { "autoshrink_images", PTR(uzbl.behave.autoshrink_img, INT, 1, cmd_autoshrink_img)},
- { "enable_spellcheck", PTR(uzbl.behave.enable_spellcheck, INT, 1, cmd_enable_spellcheck)},
- { "enable_private", PTR(uzbl.behave.enable_private, INT, 1, cmd_enable_private)},
- { "print_backgrounds", PTR(uzbl.behave.print_bg, INT, 1, cmd_print_bg)},
- { "stylesheet_uri", PTR(uzbl.behave.style_uri, STR, 1, cmd_style_uri)},
- { "resizable_text_areas",PTR(uzbl.behave.resizable_txt, INT, 1, cmd_resizable_txt)},
- { "default_encoding", PTR(uzbl.behave.default_encoding, STR, 1, cmd_default_encoding)},
- { "enforce_96_dpi", PTR(uzbl.behave.enforce_96dpi, INT, 1, cmd_enforce_96dpi)},
- { "caret_browsing", PTR(uzbl.behave.caret_browsing, INT, 1, cmd_caret_browsing)},
-
- { NULL, {.ptr = NULL, .type = TYPE_INT, .dump = 0, .func = NULL}}
+ { "uri", PTR(uzbl.state.uri, STR, cmd_load_uri)},
+ { "mode", PTR(uzbl.behave.mode, INT, NULL)},
+ { "inject_html", PTR(uzbl.behave.inject_html, STR, cmd_inject_html)},
+ { "base_url", PTR(uzbl.behave.base_url, STR, NULL)},
+ { "html_endmarker", PTR(uzbl.behave.html_endmarker, STR, NULL)},
+ { "html_mode_timeout", PTR(uzbl.behave.html_timeout, INT, NULL)},
+ { "status_message", PTR(uzbl.gui.sbar.msg, STR, update_title)},
+ { "show_status", PTR(uzbl.behave.show_status, INT, cmd_set_status)},
+ { "status_top", PTR(uzbl.behave.status_top, INT, move_statusbar)},
+ { "status_format", PTR(uzbl.behave.status_format, STR, update_title)},
+ { "status_pbar_done", PTR(uzbl.gui.sbar.progress_s, STR, update_title)},
+ { "status_pbar_pending", PTR(uzbl.gui.sbar.progress_u, STR, update_title)},
+ { "status_pbar_width", PTR(uzbl.gui.sbar.progress_w, INT, update_title)},
+ { "status_background", PTR(uzbl.behave.status_background, STR, update_title)},
+ { "title_format_long", PTR(uzbl.behave.title_format_long, STR, update_title)},
+ { "title_format_short", PTR(uzbl.behave.title_format_short, STR, update_title)},
+ { "insert_mode", PTR(uzbl.behave.insert_mode, INT, NULL)},
+ { "always_insert_mode", PTR(uzbl.behave.always_insert_mode, INT, cmd_always_insert_mode)},
+ { "reset_command_mode", PTR(uzbl.behave.reset_command_mode, INT, NULL)},
+ { "modkey", PTR(uzbl.behave.modkey, STR, cmd_modkey)},
+ { "load_finish_handler", PTR(uzbl.behave.load_finish_handler, STR, NULL)},
+ { "load_start_handler", PTR(uzbl.behave.load_start_handler, STR, NULL)},
+ { "load_commit_handler", PTR(uzbl.behave.load_commit_handler, STR, NULL)},
+ { "history_handler", PTR(uzbl.behave.history_handler, STR, NULL)},
+ { "download_handler", PTR(uzbl.behave.download_handler, STR, NULL)},
+ { "cookie_handler", PTR(uzbl.behave.cookie_handler, STR, cmd_cookie_handler)},
+ { "fifo_dir", PTR(uzbl.behave.fifo_dir, STR, cmd_fifo_dir)},
+ { "socket_dir", PTR(uzbl.behave.socket_dir, STR, cmd_socket_dir)},
+ { "http_debug", PTR(uzbl.behave.http_debug, INT, cmd_http_debug)},
+ { "shell_cmd", PTR(uzbl.behave.shell_cmd, STR, NULL)},
+ { "proxy_url", PTR(uzbl.net.proxy_url, STR, set_proxy_url)},
+ { "max_conns", PTR(uzbl.net.max_conns, INT, cmd_max_conns)},
+ { "max_conns_host", PTR(uzbl.net.max_conns_host, INT, cmd_max_conns_host)},
+ { "useragent", PTR(uzbl.net.useragent, STR, cmd_useragent)},
+ /* exported WebKitWebSettings properties */
+ { "font_size", PTR(uzbl.behave.font_size, INT, cmd_font_size)},
+ { "monospace_size", PTR(uzbl.behave.monospace_size, INT, cmd_font_size)},
+ { "minimum_font_size", PTR(uzbl.behave.minimum_font_size, INT, cmd_minimum_font_size)},
+ { "zoom_level", PTR(uzbl.behave.zoom_level, FLOAT, cmd_zoom_level)},
+ { "disable_plugins", PTR(uzbl.behave.disable_plugins, INT, cmd_disable_plugins)},
+ { "disable_scripts", PTR(uzbl.behave.disable_scripts, INT, cmd_disable_scripts)},
+ { "autoload_images", PTR(uzbl.behave.autoload_img, INT, cmd_autoload_img)},
+ { "autoshrink_images", PTR(uzbl.behave.autoshrink_img, INT, cmd_autoshrink_img)},
+ { "enable_spellcheck", PTR(uzbl.behave.enable_spellcheck, INT, cmd_enable_spellcheck)},
+ { "enable_private", PTR(uzbl.behave.enable_private, INT, cmd_enable_private)},
+ { "print_backgrounds", PTR(uzbl.behave.print_bg, INT, cmd_print_bg)},
+ { "stylesheet_uri", PTR(uzbl.behave.style_uri, STR, cmd_style_uri)},
+ { "resizable_text_areas",PTR(uzbl.behave.resizable_txt, INT, cmd_resizable_txt)},
+ { "default_encoding", PTR(uzbl.behave.default_encoding, STR, cmd_default_encoding)},
+ { "enforce_96_dpi", PTR(uzbl.behave.enforce_96dpi, INT, cmd_enforce_96dpi)},
+ { "caret_browsing", PTR(uzbl.behave.caret_browsing, INT, cmd_caret_browsing)},
+
+ { NULL, {.ptr = NULL, .type = TYPE_INT, .func = NULL}}
}, *n2v_p = var_name_to_ptr;
const struct {
@@ -582,7 +580,6 @@ VIEWFUNC(go_forward)
#undef VIEWFUNC
/* -- command to callback/function map for things we cannot attach to any signals */
-// TODO: reload
static struct {char *name; Command command[2];} cmdlist[] =
{ /* key function no_split */
{ "back", {view_go_back, 0} },
@@ -1351,6 +1348,11 @@ cmd_font_size() {
}
static void
+cmd_zoom_level() {
+ webkit_web_view_set_zoom_level (uzbl.gui.web_view, uzbl.behave.zoom_level);
+}
+
+static void
cmd_disable_plugins() {
g_object_set (G_OBJECT(view_settings()), "enable-plugins",
!uzbl.behave.disable_plugins, NULL);
@@ -1524,12 +1526,13 @@ set_var_value(gchar *name, gchar *val) {
if (c->type == TYPE_STR) {
buf = expand_vars(val);
g_free(*c->ptr);
- *c->ptr = buf;
- } else if(c->type == TYPE_INT) {
+ *c->ptr = g_strdup(val);
+ } else if (c->type == TYPE_INT) {
int *ip = (int *)c->ptr;
- buf = expand_vars(val);
- *ip = (int)strtoul(buf, &endp, 10);
- g_free(buf);
+ *ip = (int)strtoul(val, &endp, 10);
+ } else if (c->type == TYPE_FLOAT) {
+ float *fp = (float *)c->ptr;
+ *fp = strtof(val, &endp);
}
/* invoke a command specific function */
diff --git a/uzbl.h b/uzbl.h
index 846dad6..1dbc552 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -71,10 +71,10 @@ typedef struct {
GtkWidget* vbox;
GtkWidget* mainbar;
GtkWidget* mainbar_label;
- 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
+ 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 */
WebKitWebView* web_view;
gchar* main_title;
@@ -149,6 +149,7 @@ typedef struct {
guint font_size;
guint monospace_size;
guint minimum_font_size;
+ gfloat zoom_level;
guint disable_plugins;
guint disable_scripts;
guint autoload_img;
@@ -474,10 +475,15 @@ cmd_max_conns();
static void
cmd_max_conns_host();
+/* exported WebKitWebSettings properties */
+
static void
cmd_font_size();
static void
+cmd_zoom_level();
+
+static void
cmd_disable_plugins();
static void