From b9013fb779379c502b7707169eeac7dc15cfdd51 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 5 Sep 2009 19:22:30 +0200 Subject: move 'uzbl' to more specific 'uzbl-core' program, and add 'uzbl-browser' script which wraps around it to make the browser --- tests/Makefile | 4 ++-- tests/test-command.c | 4 ++-- tests/test-expand.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile index 9db398a..3f63adf 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -CFLAGS:=-std=c99 -I$(shell pwd)/../ -L$(shell pwd) -luzbl $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) +CFLAGS:=-std=c99 -I$(shell pwd)/../ -L$(shell pwd) -luzbl-core $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) @@ -14,4 +14,4 @@ all: $(TEST_PROGS) clean: rm -f $(TEST_PROGS) - rm -f libuzbl.so + rm -f libuzbl-core.so diff --git a/tests/test-command.c b/tests/test-command.c index aee4bf2..a752ca6 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -22,10 +22,10 @@ #include #include -#include +#include #include -extern Uzbl uzbl; +extern UzblCore uzbl; void test_keycmd (void) { diff --git a/tests/test-expand.c b/tests/test-expand.c index 2299227..0ced1f4 100644 --- a/tests/test-expand.c +++ b/tests/test-expand.c @@ -22,10 +22,10 @@ #include #include -#include +#include #include -extern Uzbl uzbl; +extern UzblCore uzbl; extern gchar* expand(char*, guint); extern void make_var_to_name_hash(void); -- cgit v1.2.3 From 86df99cf27a6e833f175060288eb8cef9d0cb593 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 19 Sep 2009 09:47:22 +0200 Subject: deprecate insert/command mode, always_insert_mode, mode indicators, in favor of soon to be implemented EM replacements. uzbl-core now only knows if it should forward_keys to the webkitview or not --- README | 13 ++++++----- tests/test-command.c | 4 ++-- tests/test-expand.c | 4 ++-- uzbl-core.c | 64 +++------------------------------------------------- uzbl-core.h | 22 +----------------- 5 files changed, 15 insertions(+), 92 deletions(-) (limited to 'tests') diff --git a/README b/README index e1e7682..a6305a4 100644 --- a/README +++ b/README @@ -147,7 +147,7 @@ The following commands are recognized: * `search ` * `search_reverse ` - search with no string will search for the next/previous occurrence of the string previously searched for -* `toggle_insert_mode ` +* `toggle_insert_mode ` TODO new plugin based syntax - if the optional state is 0, disable insert mode. If 1, enable insert mode. * `dump_config` - dumps your current config (which may have been changed at runtime) to stdout, in a format you can use to pipe into uzbl again (or use as config file) @@ -186,14 +186,15 @@ Besides the builtin variables you can also define your own ones and use them in - status_pbar_pending: character to denote pending % of pageload - status_pbar_width: width of progressbar - status_background: color which can be used to override Gtk theme. - - insert_indicator: string to denote insert mode - - command_indicator: string to denote command mode + - insert_indicator: string to denote insert mode TODO plugin variable + - command_indicator: string to denote command mode TODO plugin variable - title_format_long: titlebar string when no statusbar shown (will be expanded - title_format_short: titlebar string when statusbar shown (will be expanded) - icon: path to icon for Gtk - - insert_mode: whether insert mode is active - - always_insert_mode: set this to true if you don't like modal (vim-like) interfaces - - reset_command_mode: automatically revert to command mode on pageload (unless always_insert_mode is set) + - forward_keys: whether uzbl-core should send key events to the webkit view + - insert_mode: whether insert mode is active TODO explain plugin variable + - always_insert_mode: set this to true if you don't like modal (vim-like) interfaces TODO explain plugin variable + - reset_command_mode: automatically revert to command mode on pageload (unless always_insert_mode is set) TODO explain plugin variable - modkey: modkey which can be pressed to activate keybind from inside insert mode - load_finish_handler - load_start_handler diff --git a/tests/test-command.c b/tests/test-command.c index a752ca6..2a226b2 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -35,13 +35,13 @@ test_keycmd (void) { /* the 'keycmd' command */ parse_command("keycmd", "insert", NULL); - g_assert_cmpint(1, ==, uzbl.behave.insert_mode); + g_assert_cmpint(1, ==, uzbl.behave.forward_keys); g_assert_cmpstr("", ==, uzbl.state.keycmd); /* setting the keycmd variable directly, equivalent to the 'keycmd' comand */ set_var_value("keycmd", "command"); - g_assert_cmpint(0, ==, uzbl.behave.insert_mode); + g_assert_cmpint(0, ==, uzbl.behave.forward_keys); g_assert_cmpstr("", ==, uzbl.state.keycmd); } diff --git a/tests/test-expand.c b/tests/test-expand.c index 0ced1f4..f01e5c7 100644 --- a/tests/test-expand.c +++ b/tests/test-expand.c @@ -79,10 +79,10 @@ test_NAME (void) { void test_MODE (void) { - set_var_value("insert_mode", "0"); + set_var_value("forward_keys", "0"); g_assert_cmpstr(expand("@MODE", 0), ==, "C"); - set_var_value("insert_mode", "1"); + set_var_value("forward_keys", "1"); g_assert_cmpstr(expand("@MODE", 0), ==, "I"); } diff --git a/uzbl-core.c b/uzbl-core.c index e0af0e4..2ad11ac 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -126,14 +126,10 @@ const struct var_name_to_ptr_t { { "status_pbar_pending", PTR_V_STR(uzbl.gui.sbar.progress_u, 1, update_title)}, { "status_pbar_width", PTR_V_INT(uzbl.gui.sbar.progress_w, 1, update_title)}, { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, update_title)}, - { "insert_indicator", PTR_V_STR(uzbl.behave.insert_indicator, 1, update_indicator)}, - { "command_indicator", PTR_V_STR(uzbl.behave.cmd_indicator, 1, update_indicator)}, { "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, update_title)}, { "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, update_title)}, { "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)}, - { "insert_mode", PTR_V_INT(uzbl.behave.insert_mode, 1, set_mode_indicator)}, - { "always_insert_mode", PTR_V_INT(uzbl.behave.always_insert_mode, 1, cmd_always_insert_mode)}, - { "reset_command_mode", PTR_V_INT(uzbl.behave.reset_command_mode, 1, NULL)}, + { "forward_keys", PTR_V_INT(uzbl.behave.forward_keys, 1, NULL)}, { "load_finish_handler", PTR_V_STR(uzbl.behave.load_finish_handler, 1, NULL)}, { "load_start_handler", PTR_V_STR(uzbl.behave.load_start_handler, 1, NULL)}, { "load_commit_handler", PTR_V_STR(uzbl.behave.load_commit_handler, 1, NULL)}, @@ -186,7 +182,6 @@ const struct var_name_to_ptr_t { { "LOAD_PROGRESSBAR", PTR_C_STR(uzbl.gui.sbar.progress_bar, NULL)}, { "TITLE", PTR_C_STR(uzbl.gui.main_title, NULL)}, { "SELECTED_URI", PTR_C_STR(uzbl.state.selected_url, NULL)}, - { "MODE", PTR_C_STR(uzbl.gui.sbar.mode_indicator, NULL)}, { "NAME", PTR_C_STR(uzbl.state.instance_name, NULL)}, { "PID", PTR_C_STR(uzbl.info.pid_str, NULL)}, @@ -923,10 +918,7 @@ load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) { g_free (uzbl.state.uri); GString* newuri = g_string_new (webkit_web_frame_get_uri (frame)); uzbl.state.uri = g_string_free (newuri, FALSE); - if (uzbl.behave.reset_command_mode && uzbl.behave.insert_mode) { - set_insert_mode(uzbl.behave.always_insert_mode); - update_title(); - } + if (uzbl.behave.load_commit_handler) run_handler(uzbl.behave.load_commit_handler, uzbl.state.uri); @@ -981,7 +973,6 @@ struct {const char *key; CommandInfo value;} cmdlist[] = { "search", {search_forward_text, TRUE} }, { "search_reverse", {search_reverse_text, TRUE} }, { "dehilight", {dehilight, 0} }, - { "toggle_insert_mode", {toggle_insert_mode, 0} }, { "set", {set_var, TRUE} }, { "dump_config", {act_dump_config, 0} }, { "dump_config_as_events", {act_dump_config_as_events, 0} }, @@ -1087,42 +1078,6 @@ act_dump_config_as_events() { dump_config_as_events(); } -void -set_mode_indicator() { - uzbl.gui.sbar.mode_indicator = (uzbl.behave.insert_mode ? - uzbl.behave.insert_indicator : uzbl.behave.cmd_indicator); -} - -void -update_indicator() { - set_mode_indicator(); - update_title(); -} - -void -set_insert_mode(gboolean mode) { - uzbl.behave.insert_mode = mode; - send_event(VARIABLE_SET, uzbl.behave.insert_mode ? "insert_mode int 1" : "insert_mode int 0", NULL); - set_mode_indicator(); -} - -void -toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result) { - (void) page; (void) result; - - if (argv_idx(argv, 0)) { - if (strcmp (argv_idx(argv, 0), "0") == 0) { - set_insert_mode(FALSE); - } else { - set_insert_mode(TRUE); - } - } else { - set_insert_mode( !uzbl.behave.insert_mode ); - } - - update_title(); -} - void load_uri (WebKitWebView *web_view, GArray *argv, GString *result) { (void) result; @@ -1726,12 +1681,6 @@ cmd_load_uri() { g_array_free (a, TRUE); } -void -cmd_always_insert_mode() { - set_insert_mode(uzbl.behave.always_insert_mode); - update_title(); -} - void cmd_max_conns() { g_object_set(G_OBJECT(uzbl.net.soup_session), @@ -2374,7 +2323,7 @@ key_press_cb (GtkWidget* window, GdkEventKey* event) { if(event->type == GDK_KEY_PRESS) key_to_event(event->keyval, GDK_KEY_PRESS); - return uzbl.behave.insert_mode ? FALSE : TRUE; + return uzbl.behave.forward_keys ? FALSE : TRUE; } gboolean @@ -2889,10 +2838,6 @@ initialize(int argc, char *argv[]) { uzbl.gui.sbar.progress_u = g_strdup("ยท"); uzbl.gui.sbar.progress_w = 10; - /* default mode indicators */ - uzbl.behave.insert_indicator = g_strdup("I"); - uzbl.behave.cmd_indicator = g_strdup("C"); - uzbl.info.webkit_major = WEBKIT_MAJOR_VERSION; uzbl.info.webkit_minor = WEBKIT_MINOR_VERSION; uzbl.info.webkit_micro = WEBKIT_MICRO_VERSION; @@ -2982,9 +2927,6 @@ main (int argc, char* argv[]) { settings_init (); - if (!uzbl.behave.always_insert_mode) - set_insert_mode(FALSE); - if (!uzbl.behave.show_status) gtk_widget_hide(uzbl.gui.mainbar); else diff --git a/uzbl-core.h b/uzbl-core.h index b88dd7e..55f5eb1 100644 --- a/uzbl-core.h +++ b/uzbl-core.h @@ -18,7 +18,6 @@ typedef struct { gchar *progress_s, *progress_u; int progress_w; gchar *progress_bar; - gchar *mode_indicator; } StatusBar; @@ -107,11 +106,9 @@ typedef struct { gchar* fantasy_font_family; gchar* cursive_font_family; gchar* scheme_handler; - gboolean always_insert_mode; gboolean show_status; - gboolean insert_mode; + gboolean forward_keys; gboolean status_top; - gboolean reset_command_mode; guint modmask; guint http_debug; gchar* shell_cmd; @@ -136,8 +133,6 @@ typedef struct { guint caret_browsing; guint mode; gchar* base_url; - gchar* insert_indicator; - gchar* cmd_indicator; gboolean print_version; /* command list: (key)name -> (value)Command */ @@ -301,18 +296,6 @@ file_exists (const char * filename); void set_keycmd(); -void -set_mode_indicator(); - -void -update_indicator(); - -void -set_insert_mode(gboolean mode); - -void -toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result); - void load_uri (WebKitWebView * web_view, GArray *argv, GString *result); @@ -504,9 +487,6 @@ cmd_scheme_handler(); void move_statusbar(); -void -cmd_always_insert_mode(); - void cmd_http_debug(); -- cgit v1.2.3