summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-11-19 17:15:01 (GMT)
committer Daniel Silverstone <dsilvers@digital-scurf.org>2016-11-19 17:15:01 (GMT)
commit46d9b9509a2a5f8863189d880a6722bc3ec74344 (patch)
tree80a7b513cf73d7ee141971c312255a57c9f5f70b
parentc367d92d41291e2fb88bac81159bf2a2cdc096fe (diff)
downloadlibdom-46d9b9509a2a5f8863189d880a6722bc3ec74344.tar.gz
libdom-46d9b9509a2a5f8863189d880a6722bc3ec74344.tar.bz2
Add an is_initialised flag to events
-rw-r--r--src/events/event.c17
-rw-r--r--src/events/event.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/events/event.c b/src/events/event.c
index 62a5739..8a73a0d 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -56,6 +56,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
+ evt->is_initialised = false;
return DOM_NO_ERR;
}
@@ -252,6 +253,7 @@ dom_exception _dom_event_init(dom_event *evt, dom_string *type,
evt->type = dom_string_ref(type);
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
evt->timestamp = time(NULL);
@@ -333,6 +335,7 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
return DOM_NO_ERR;
}
@@ -350,3 +353,17 @@ dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result)
return DOM_NO_ERR;
}
+
+/**
+ * Return whether or not the event is currently initialised.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
+{
+ *result = evt->is_initialised;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 4835bd0..8d8cc0f 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -48,6 +48,7 @@ struct dom_event {
struct dom_event_private_vtable *vtable;
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
+ bool is_initialised; /**< Whether this event is initialised */
};
/* Destructor */