summaryrefslogtreecommitdiff
path: root/src/events
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2012-03-24 09:41:34 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2012-03-24 09:41:34 +0000
commit95f6dc8e41e91d274b6c8da9167ec212b1584bcf (patch)
treea4be6838c3ffd1b837f743db4a8e505520adac03 /src/events
parentd581cec6ead65ab4ffb1e09f040b262cd8b4501c (diff)
downloadlibdom-95f6dc8e41e91d274b6c8da9167ec212b1584bcf.tar.gz
libdom-95f6dc8e41e91d274b6c8da9167ec212b1584bcf.tar.bz2
C89 for BeOS build.
svn path=/trunk/libdom/; revision=13581
Diffstat (limited to 'src/events')
-rw-r--r--src/events/document_event.c5
-rw-r--r--src/events/keyboard_event.c16
-rw-r--r--src/events/mouse_event.c7
-rw-r--r--src/events/mouse_multi_wheel_event.c4
-rw-r--r--src/events/mouse_wheel_event.c2
5 files changed, 22 insertions, 12 deletions
diff --git a/src/events/document_event.c b/src/events/document_event.c
index 0a14988..0546364 100644
--- a/src/events/document_event.c
+++ b/src/events/document_event.c
@@ -103,6 +103,8 @@ dom_exception _dom_document_event_create_event(dom_document_event *de,
lwc_string *t = NULL;
dom_exception err;
struct dom_document *doc = de;
+ int i, et = 0;
+ dom_document_event_internal *dei;
err = dom_string_intern(type, &t);
if (err != DOM_NO_ERR)
@@ -110,8 +112,7 @@ dom_exception _dom_document_event_create_event(dom_document_event *de,
assert(t != NULL);
- int i, et = 0;
- dom_document_event_internal *dei = &de->dei;
+ dei = &de->dei;
for (i = 0; i < DOM_EVENT_COUNT; i++) {
if (dei->event_types[i] == t) {
et = i;
diff --git a/src/events/keyboard_event.c b/src/events/keyboard_event.c
index 3b065e0..76f32ba 100644
--- a/src/events/keyboard_event.c
+++ b/src/events/keyboard_event.c
@@ -172,13 +172,16 @@ dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt,
dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt,
dom_string *m, bool *state)
{
+ const char *data;
+ size_t len;
+
if (m == NULL) {
*state = false;
return DOM_NO_ERR;
}
- const char *data = dom_string_data(m);
- size_t len = dom_string_byte_length(m);
+ data = dom_string_data(m);
+ len = dom_string_byte_length(m);
if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) {
*state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0);
@@ -286,14 +289,17 @@ dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt,
dom_exception _dom_parse_modifier_list(dom_string *modifier_list,
uint32_t *modifier_state)
{
+ const char *data;
+ const char *m;
+ size_t len = 0;
+
*modifier_state = 0;
if (modifier_list == NULL)
return DOM_NO_ERR;
- const char *data = dom_string_data(modifier_list);
- const char *m = data;
- size_t len = 0;
+ data = dom_string_data(modifier_list);
+ m = data;
while (true) {
/* If we reach a space or end of the string, we should parse
diff --git a/src/events/mouse_event.c b/src/events/mouse_event.c
index 68e21bc..a2a97bb 100644
--- a/src/events/mouse_event.c
+++ b/src/events/mouse_event.c
@@ -224,13 +224,16 @@ dom_exception _dom_mouse_event_get_related_target(dom_mouse_event *evt,
dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt,
dom_string *m, bool *state)
{
+ const char *data;
+ size_t len;
+
if (m == NULL) {
*state = false;
return DOM_NO_ERR;
}
- const char *data = dom_string_data(m);
- size_t len = dom_string_byte_length(m);
+ data = dom_string_data(m);
+ len = dom_string_byte_length(m);
if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) {
*state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0);
diff --git a/src/events/mouse_multi_wheel_event.c b/src/events/mouse_multi_wheel_event.c
index 2923a4c..8c4615b 100644
--- a/src/events/mouse_multi_wheel_event.c
+++ b/src/events/mouse_multi_wheel_event.c
@@ -136,12 +136,12 @@ dom_exception _dom_mouse_multi_wheel_event_init_ns(
long wheel_delta_y, long wheel_delta_z)
{
dom_exception err;
+ dom_mouse_event *e = (dom_mouse_event *) evt;
+
evt->x = wheel_delta_x;
evt->y = wheel_delta_y;
evt->z = wheel_delta_z;
- dom_mouse_event *e = (dom_mouse_event *) evt;
-
err = _dom_parse_modifier_list(modifier_list, &e->modifier_state);
if (err != DOM_NO_ERR)
return err;
diff --git a/src/events/mouse_wheel_event.c b/src/events/mouse_wheel_event.c
index acc65cf..cce4fac 100644
--- a/src/events/mouse_wheel_event.c
+++ b/src/events/mouse_wheel_event.c
@@ -101,8 +101,8 @@ dom_exception _dom_mouse_wheel_event_init_ns(
dom_string *modifier_list, long wheel_delta)
{
dom_exception err;
- evt->delta = wheel_delta;
dom_mouse_event *e = (dom_mouse_event *) evt;
+ evt->delta = wheel_delta;
err = _dom_parse_modifier_list(modifier_list, &e->modifier_state);
if (err != DOM_NO_ERR)