aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--examples/configs/sampleconfig1
-rw-r--r--examples/configs/sampleconfig-dev1
-rw-r--r--uzbl.c22
-rw-r--r--uzbl.h6
5 files changed, 24 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 4ee7f0c..8a55a32 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,6 +19,7 @@ Contributors:
(mxf) - uzblcat
Mark Nevill - misc patches
Uli Schlachter (psychon) - basic mime_policy_cb & Makefile patch
+ (uranther) - zoom level
Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c
Which is copyrighted:
diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig
index 621d438..9bb0025 100644
--- a/examples/configs/sampleconfig
+++ b/examples/configs/sampleconfig
@@ -69,6 +69,7 @@ bind r = reload
bind R = reload_ign_cache
bind + = zoom_in
bind - = zoom_out
+bind 0 = 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..c8eddd0 100644
--- a/examples/configs/sampleconfig-dev
+++ b/examples/configs/sampleconfig-dev
@@ -104,6 +104,7 @@ bind r = reload
bind R = reload_ign_cache
bind + = zoom_in
bind - = zoom_out
+bind 0 = 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/uzbl.c b/uzbl.c
index b444c97..ba5a98a 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -43,16 +43,14 @@
#include <sys/utsname.h>
#include <sys/time.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 +83,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 }
@@ -133,7 +131,8 @@ const struct {
{ "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*/
+ /* exported WebKitWebSettings properties */
+ { "zoom_level", PTR(uzbl.behave.zoom_level, FLOAT,1, cmd_zoom_level)},
{ "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)},
@@ -599,7 +598,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} },
@@ -1368,6 +1366,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);
@@ -1547,6 +1550,11 @@ set_var_value(gchar *name, gchar *val) {
buf = expand_vars(val);
*ip = (int)strtoul(buf, &endp, 10);
g_free(buf);
+ } else if (c->type == TYPE_FLOAT) {
+ float *fp = (float *)c->ptr;
+ buf = expand_vars(val);
+ *fp = strtof(buf, &endp);
+ g_free(buf);
}
/* invoke a command specific function */
diff --git a/uzbl.h b/uzbl.h
index 1a22513..ab45bae 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -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;
@@ -477,10 +478,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