summaryrefslogtreecommitdiff
path: root/frontends/kolibrios/browser_table.h
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-04-05 21:39:01 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-06-10 08:24:39 +0200
commit6fd280bb5b27842a0ef2977798566c37bd4e1d0e (patch)
tree8e5dd8aa1adf8c6550b955d130c81c36b3db9ea5 /frontends/kolibrios/browser_table.h
parent9bf5ecfa87d022645e986249270c5a89e27f46fe (diff)
downloadnetsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.gz
netsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.bz2
Add kolibrios/ dir : Step 1 towards porting this to Kolibri OS
Diffstat (limited to 'frontends/kolibrios/browser_table.h')
-rw-r--r--frontends/kolibrios/browser_table.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/frontends/kolibrios/browser_table.h b/frontends/kolibrios/browser_table.h
new file mode 100644
index 000000000..2ee11826b
--- /dev/null
+++ b/frontends/kolibrios/browser_table.h
@@ -0,0 +1,57 @@
+/* ------------------------------ */
+/* Part about Browser table. Will contain all functions required as well. */
+/* ------------------------------ */
+nserror kolibri_schedule_cb(int t, void (*callback)(void *p), void *p);
+void kolibri_browser_quit(void);
+
+struct kolibri_callback {
+ void (*cb)(void *p);
+ void *arg;
+ struct kolibri_callback *next_cb;
+} head_dummy;
+
+struct kolibri_callback *kcb_head = &head_dummy;
+struct kolibri_callback *kcb_tail = &head_dummy;
+
+static struct gui_browser_table kolibri_browser_table = {
+ .schedule = kolibri_schedule_cb,
+ .quit = kolibri_browser_quit,
+ };
+
+nserror kolibri_schedule_cb(int t, void (*callback)(void *p), void *p)
+{
+ /* debug_board_write_str("kolibri_schedule_cb called!\n"); */
+ struct kolibri_callback *new_cb = malloc(sizeof(struct kolibri_callback));
+ new_cb->arg = p;
+ new_cb->cb = callback;
+ new_cb->next_cb = NULL;
+
+ kcb_tail -> next_cb = new_cb;
+ kcb_tail = new_cb;
+
+ return NSERROR_OK;
+}
+
+bool kolibri_schedule_run(void)
+{
+ if(kcb_head != kcb_tail)
+ return false;
+
+ struct kolibri_callback *runner = kcb_head -> next_cb;
+
+ while(runner != NULL)
+ {
+ runner->cb(runner->arg);
+ runner = runner -> next_cb;
+ }
+
+ return true;
+ /* TODO: Free the whole list of callbacks */
+}
+
+void kolibri_browser_quit(void)
+{
+ debug_board_write_str("Netsurf is shutting down Normally..GoodBye.");
+ /* TODO: Do the actual killing of process with mcall -1 */
+ /* Maybe set Kolibri_quit = 1 here */
+}