Removing the insert mode. It will only confuse users. The stop() function is

kept like the eval() function because it could be used in config.h
This commit is contained in:
Christoph Lohmann 2012-11-16 10:13:23 +01:00
parent c12b6499fe
commit 6d9d3ca4e1
3 changed files with 5 additions and 48 deletions

View file

@ -43,10 +43,8 @@ static Key keys[] = {
{ MODKEY, GDK_k, scroll_v, { .i = -1 } }, { MODKEY, GDK_k, scroll_v, { .i = -1 } },
{ MODKEY, GDK_b, scroll_v, { .i = -10000 } }, { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
{ MODKEY, GDK_space, scroll_v, { .i = +10000 } }, { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
{ 0, GDK_i, insert, { 0 } },
{ MODKEY, GDK_i, scroll_h, { .i = +1 } }, { MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_u, scroll_h, { .i = -1 } }, { MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ 0, GDK_Escape, stop, { 0 } },
{ MODKEY, GDK_o, source, { 0 } }, { MODKEY, GDK_o, source, { 0 } },
{ MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") }, { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
{ MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },

7
surf.1
View file

@ -88,13 +88,6 @@ Zooms page out
.B Ctrl\-Shift\-i .B Ctrl\-Shift\-i
Resets Zoom Resets Zoom
.TP .TP
.B i
Enter insert mode. There all keybindings have effect with and without
pressing the modkey.
.TP
.B ESC
Leave the insert mode.
.TP
.B Ctrl\-h .B Ctrl\-h
Navigate back one step in history. Navigate back one step in history.
.TP .TP

40
surf.c
View file

@ -79,8 +79,7 @@ static GdkNativeWindow embed = 0;
static gboolean showxid = FALSE; static gboolean showxid = FALSE;
static char winid[64]; static char winid[64];
static gboolean loadimage = 1, plugin = 1, script = 1, using_proxy = 0; static gboolean loadimage = 1, plugin = 1, script = 1, using_proxy = 0;
static char togglestat[6]; static char togglestat[5];
static gboolean insertmode = FALSE;
static char *buildpath(const char *path); static char *buildpath(const char *path);
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList *gl); static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList *gl);
@ -103,7 +102,6 @@ static void find(Client *c, const Arg *arg);
static const char *getatom(Client *c, int a); static const char *getatom(Client *c, int a);
static char *geturi(Client *c); static char *geturi(Client *c);
static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c); static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c);
static void insert(Client *c, const Arg *arg);
static gboolean keypress(GtkWidget *w, GdkEventKey *ev, Client *c); static gboolean keypress(GtkWidget *w, GdkEventKey *ev, Client *c);
static void linkhover(WebKitWebView *v, const char* t, const char* l, Client *c); static void linkhover(WebKitWebView *v, const char* t, const char* l, Client *c);
static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c); static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
@ -437,49 +435,20 @@ initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) {
return FALSE; return FALSE;
} }
void
insert(Client *c, const Arg *arg) {
insertmode = TRUE;
update(clients);
}
gboolean gboolean
keypress(GtkWidget* w, GdkEventKey *ev, Client *c) { keypress(GtkWidget* w, GdkEventKey *ev, Client *c) {
guint i, state; guint i;
gboolean processed = FALSE; gboolean processed = FALSE;
/* turn off insert mode */
if(insertmode && (ev->keyval == GDK_Escape)) {
insertmode = FALSE;
update(c);
return TRUE;
}
if(insertmode && (((ev->state & MODKEY) != MODKEY) || !MODKEY)) {
return FALSE;
}
if(ev->keyval == GDK_Escape) {
webkit_web_view_set_highlight_text_matches(c->view, FALSE);
return TRUE;
}
updatewinid(c); updatewinid(c);
for(i = 0; i < LENGTH(keys); i++) { for(i = 0; i < LENGTH(keys); i++) {
if(!insertmode && (MODKEY & keys[i].mod)) {
state = ev->state | MODKEY;
} else {
state = ev->state;
}
if(gdk_keyval_to_lower(ev->keyval) == keys[i].keyval if(gdk_keyval_to_lower(ev->keyval) == keys[i].keyval
&& (ev->state & keys[i].mod) == keys[i].mod
&& keys[i].func) { && keys[i].func) {
if(state == keys[i].mod) {
keys[i].func(c, &(keys[i].arg)); keys[i].func(c, &(keys[i].arg));
processed = TRUE; processed = TRUE;
} }
} }
}
return processed; return processed;
} }
@ -953,9 +922,6 @@ gettogglestat(Client *c){
g_object_get(G_OBJECT(settings), "enable-caret-browsing", g_object_get(G_OBJECT(settings), "enable-caret-browsing",
&value, NULL); &value, NULL);
togglestat[3] = value?'C':'c'; togglestat[3] = value?'C':'c';
togglestat[4] = insertmode? '+' : '-';
togglestat[5] = '\0';
} }