From efed998a1aca58fc79f2cf82ce78c9dda7911201 Mon Sep 17 00:00:00 2001 From: uranther Date: Fri, 29 May 2009 15:11:23 -0400 Subject: Some cleaning of code, and stricter compiling options (with warnings I don't know how to fix) --- uzbl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'uzbl.h') diff --git a/uzbl.h b/uzbl.h index cd5e3ef..4c4c4ea 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; -- cgit v1.2.3 From 89916092aef4b603c3fb5a711f0475d49aa7868e Mon Sep 17 00:00:00 2001 From: uranther Date: Fri, 29 May 2009 15:47:55 -0400 Subject: Added reset_zoom_level() to reset zoom to 100%, and added keybinding in sampleconfig --- examples/configs/sampleconfig | 1 + uzbl.c | 7 +++++++ uzbl.h | 3 +++ 3 files changed, 11 insertions(+) (limited to 'uzbl.h') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index a541854..881173c 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 = = reset_zoom 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 1758638..acae3cf 100644 --- a/uzbl.c +++ b/uzbl.c @@ -544,6 +544,7 @@ static struct {char *name; Command command[2];} cmdlist[] = { "stop", {view_stop_loading, 0}, }, { "zoom_in", {view_zoom_in, 0}, }, //Can crash (when max zoom reached?). { "zoom_out", {view_zoom_out, 0}, }, + { "reset_zoom", {reset_zoom_level, 0}, }, { "uri", {load_uri, NOSPLIT} }, { "js", {run_js, NOSPLIT} }, { "script", {run_external_js, 0} }, @@ -706,6 +707,12 @@ search_reverse_text (WebKitWebView *page, GArray *argv) { search_text(page, argv, FALSE); } +static void +reset_zoom_level (WebKitWebView *page, GArray *argv) { + (void) argv; + webkit_web_view_set_zoom_level (page, 1.0); +} + static void dehilight (WebKitWebView *page, GArray *argv) { (void) argv; diff --git a/uzbl.h b/uzbl.h index 4c4c4ea..51a788c 100644 --- a/uzbl.h +++ b/uzbl.h @@ -397,6 +397,9 @@ search_forward_text (WebKitWebView *page, GArray *argv); static void search_reverse_text (WebKitWebView *page, GArray *argv); +static void +reset_zoom_level (WebKitWebView *page, GArray *argv); + static void dehilight (WebKitWebView *page, GArray *argv); -- cgit v1.2.3 From 79bc5894756cf9ea267ec80938e7c9fe4881d1b4 Mon Sep 17 00:00:00 2001 From: uranther Date: Fri, 29 May 2009 16:51:05 -0400 Subject: Replaced reset_zoom with zoom_level; added floats to commands --- README | 1 - examples/configs/sampleconfig | 2 +- uzbl.c | 22 ++++++++++++---------- uzbl.h | 9 ++++++--- 4 files changed, 19 insertions(+), 15 deletions(-) (limited to 'uzbl.h') diff --git a/README b/README index 4d537a4..71cdcfa 100644 --- a/README +++ b/README @@ -153,7 +153,6 @@ actions follows: * `stop` * `zoom_in` * `zoom_out` -* `reset_zoom` * `uri
` * `js ` - execute the javascript in `` diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 881173c..603ee0f 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -69,7 +69,7 @@ bind r = reload bind R = reload_ign_cache bind + = zoom_in bind - = zoom_out -bind = = reset_zoom +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/uzbl.c b/uzbl.c index acae3cf..4f12637 100644 --- a/uzbl.c +++ b/uzbl.c @@ -84,7 +84,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, fun) { .ptr = (void*)&(var), .type = TYPE_##t, .func = fun } @@ -129,10 +129,11 @@ const struct { { "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*/ + /* 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)}, @@ -544,7 +545,6 @@ static struct {char *name; Command command[2];} cmdlist[] = { "stop", {view_stop_loading, 0}, }, { "zoom_in", {view_zoom_in, 0}, }, //Can crash (when max zoom reached?). { "zoom_out", {view_zoom_out, 0}, }, - { "reset_zoom", {reset_zoom_level, 0}, }, { "uri", {load_uri, NOSPLIT} }, { "js", {run_js, NOSPLIT} }, { "script", {run_external_js, 0} }, @@ -707,12 +707,6 @@ search_reverse_text (WebKitWebView *page, GArray *argv) { search_text(page, argv, FALSE); } -static void -reset_zoom_level (WebKitWebView *page, GArray *argv) { - (void) argv; - webkit_web_view_set_zoom_level (page, 1.0); -} - static void dehilight (WebKitWebView *page, GArray *argv) { (void) argv; @@ -1257,6 +1251,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", @@ -1429,9 +1428,12 @@ set_var_value(gchar *name, gchar *val) { if (c->type == TYPE_STR) { g_free(*c->ptr); *c->ptr = g_strdup(val); - } else if(c->type == TYPE_INT) { + } else if (c->type == TYPE_INT) { int *ip = (int *)c->ptr; *ip = (int)strtoul(val, &endp, 10); + } else if (c->type == TYPE_FLOAT) { + float *fp = (float *)c->ptr; + *fp = (float)strtof(val, &endp); } /* invoke a command specific function */ diff --git a/uzbl.h b/uzbl.h index 51a788c..91421bd 100644 --- a/uzbl.h +++ b/uzbl.h @@ -155,6 +155,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; @@ -397,9 +398,6 @@ search_forward_text (WebKitWebView *page, GArray *argv); static void search_reverse_text (WebKitWebView *page, GArray *argv); -static void -reset_zoom_level (WebKitWebView *page, GArray *argv); - static void dehilight (WebKitWebView *page, GArray *argv); @@ -454,9 +452,14 @@ 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(); -- cgit v1.2.3