From 6d228d4ff707158db60197592d7b231737f890c3 Mon Sep 17 00:00:00 2001 From: portix Date: Fri, 7 Dec 2012 00:44:45 +0100 Subject: Let focused view be starting point in find_webview --- src/scripts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/scripts.c b/src/scripts.c index 5ab7cfad..c19a0411 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -430,9 +430,13 @@ tabs_get_nth(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz static GList * find_webview(JSObjectRef o) { - GList *r = NULL; - for (r = dwb.state.views; r && VIEW(r)->script_wv != o; r=r->next); - return r; + for (GList *r = dwb.state.fview; r; r=r->next) + if (VIEW(r)->script_wv == o) + return r; + for (GList *r = dwb.state.fview->prev; r; r=r->prev) + if (VIEW(r)->script_wv == o) + return r; + return NULL; } /* wv_status_cb {{{*/ static gboolean -- cgit v1.2.3