summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <none@none>2012-11-05 21:23:18 +0100
committerportix <none@none>2012-11-05 21:23:18 +0100
commit773dbe7055f3c10ac2329803647fba405ac7cff8 (patch)
treea1f1fb536d9e0c4a2425d23106d1b98e06252591
parent46af32e61b13c8e31987592630e00ec954f41147 (diff)
downloaddwb-773dbe7055f3c10ac2329803647fba405ac7cff8.zip
Ignore default action of button 8 and button 9
-rw-r--r--api/dwb-js.717
-rw-r--r--api/jsapi.7.txt13
-rw-r--r--api/jsapi.txt20
-rw-r--r--scripts/lib/extensions.js1
-rw-r--r--src/scripts.c2
-rw-r--r--src/view.c10
6 files changed, 32 insertions, 31 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7
index c208d932..1a14f5d4 100644
--- a/api/dwb-js.7
+++ b/api/dwb-js.7
@@ -2,12 +2,12 @@
.\" Title: dwb-js
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
-.\" Date: 11/03/2012
+.\" Date: 11/04/2012
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "DWB\-JS" "7" "11/03/2012" "\ \&" "\ \&"
+.TH "DWB\-JS" "7" "11/04/2012" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -2518,16 +2518,15 @@ Since all scripts share the same execution context, they are encapsulated in a f
number = 0;
io\&.print(number); // undefined
-// always use var instead
-var number = 0;
+var number2 = 0;
io\&.print(number2); // 0
-// won\*(Aqt work either
-function foo() {
- bar = 1;
+// not allowed
+foo = function()
+{
+ io\&.print("foo");
}
-foo();
-io\&.print(bar); // undefined
+foo(); // fails
.fi
.if n \{\
.RE
diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt
index 1f6eff2d..cd83b493 100644
--- a/api/jsapi.7.txt
+++ b/api/jsapi.7.txt
@@ -1216,16 +1216,15 @@ on the global object, i.e.
number = 0;
io.print(number); // undefined
-// always use var instead
-var number = 0;
+var number2 = 0;
io.print(number2); // 0
-// won't work either
-function foo() {
- bar = 1;
+// not allowed
+foo = function()
+{
+ io.print("foo");
}
-foo();
-io.print(bar); // undefined
+foo(); // fails
-------
For sharing data between scripts either signals or modules can be created.
diff --git a/api/jsapi.txt b/api/jsapi.txt
index d411c0d3..55d112f7 100644
--- a/api/jsapi.txt
+++ b/api/jsapi.txt
@@ -2094,9 +2094,9 @@ const Modes = {
[[Globaldata]]
== Global data ==
-Since all scripts share the same execution context, they are encapsulated as a
-module function. To avoid conflicts with other scripts it is not allowed to set
-properties on the global object, i.e.
+Since all scripts share the same execution context, every script is encapsulated
+in a function. To avoid conflicts between scripts, e.g. with duplicate
+variables, it is not allowed to set properties on the global object:
[source,javascript]
-------
@@ -2106,21 +2106,19 @@ properties on the global object, i.e.
number = 0;
io.print(number); // undefined
-// always use var instead
-var number = 0;
+var number2 = 0;
io.print(number2); // 0
-// won't work either
-function foo() {
- bar = 1;
+// not allowed
+foo = function()
+{
+ io.print("foo");
}
-foo();
-io.print(bar); // undefined
+foo(); // fails
-------
For sharing data between scripts either signals or modules can be created.
-
[[Modules]]
== Modules ==
diff --git a/scripts/lib/extensions.js b/scripts/lib/extensions.js
index 1fb8b496..37888abf 100644
--- a/scripts/lib/extensions.js
+++ b/scripts/lib/extensions.js
@@ -146,6 +146,7 @@
}
}
try {
+ plugin._name = name;
if (plugin.init(extConfig)) {
_registered[name] = plugin;
extensions.message(name, "Successfully loaded and initialized.");
diff --git a/src/scripts.c b/src/scripts.c
index 7bfb84df..2cde4e94 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -738,7 +738,7 @@ global_bind(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size
Key key = dwb_str_to_key(keystr);
map->key = key.str;
map->mod = key.mod;
- FunctionMap fm = { { name, callback }, option, (Func)scripts_eval_key, NULL, POST_SM, { .arg = func }, EP_NONE, {NULL} };
+ FunctionMap fm = { { name, callback }, option, (Func)scripts_eval_key, NULL, NEVER_SM, { .arg = func }, EP_NONE, {NULL} };
*fmap = fm;
map->map = fmap;
dwb.keymap = g_list_prepend(dwb.keymap, map);
diff --git a/src/view.c b/src/view.c
index f774a6f8..6b6ea1dd 100644
--- a/src/view.c
+++ b/src/view.c
@@ -170,10 +170,11 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
webkit_dom_dom_selection_add_range(selection, range);
m_sig_caret_button_release = g_signal_connect(web, "button-release-event", G_CALLBACK(view_caret_release_cb), range);
m_sig_caret_motion = g_signal_connect(web, "motion-notify-event", G_CALLBACK(view_caret_motion_cb), range);
- ret = true;
+ return false;
}
else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION && e->type == GDK_BUTTON_PRESS && e->state & GDK_BUTTON1_MASK) {
char *clipboard = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY));
+ char *backup = clipboard;
g_strstrip(clipboard);
if (e->button == 3) {
dwb_load_uri(NULL, clipboard);
@@ -183,7 +184,8 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
view_add(clipboard, dwb.state.background_tabs);
ret = true;
}
- g_free(clipboard);
+ g_free(backup);
+ return ret;
}
else if (e->button == 1 && e->type == GDK_BUTTON_PRESS && WEBVIEW(gl) != CURRENT_WEBVIEW()) {
dwb_unfocus();
@@ -191,13 +193,15 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
}
else if (e->button == 3 && e->state & GDK_BUTTON1_MASK) {
/* no popup if button 1 is presssed */
- ret = true;
+ return true;
}
else if (e->button == 8) {
dwb_history_back();
+ return true;
}
else if (e->button == 9) {
dwb_history_forward();
+ return true;
}
return ret;
}/*}}}*/