summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-12-07 00:44:45 +0100
committerportix <portix@gmx.net>2012-12-07 00:44:45 +0100
commit6d228d4ff707158db60197592d7b231737f890c3 (patch)
tree8c69e6139c7bdad1975fc62fb167b2070a9ff3bf /src
parent4a656a2538eb4db0c5b66d78e25ba245e43ca03d (diff)
downloaddwb-6d228d4ff707158db60197592d7b231737f890c3.zip
Let focused view be starting point in find_webview
Diffstat (limited to 'src')
-rw-r--r--src/scripts.c10
1 files changed, 7 insertions, 3 deletions
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