summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-03-08 14:13:27 +0000
committerVincent Sanders <vince@kyllikki.org>2014-03-09 15:37:40 +0000
commit87f6314dabdc2067a19e01f8b29f9ecc38ed825b (patch)
tree78f8f8395e3bf3b7ee2c18a7b5a5e6d2d5ca9ddc /desktop
parentfb9b171e325488dc9792ee0f3062f15d8ec597ee (diff)
downloadnetsurf-87f6314dabdc2067a19e01f8b29f9ecc38ed825b.tar.gz
netsurf-87f6314dabdc2067a19e01f8b29f9ecc38ed825b.tar.bz2
move scheduleing into browser operation table
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c13
-rw-r--r--desktop/gui.h46
-rw-r--r--desktop/gui_factory.c4
3 files changed, 48 insertions, 15 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 03c7a8e76..b1e4b7594 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -63,7 +63,6 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
-#include "utils/schedule.h"
#include "utils/url.h"
#include "utils/utils.h"
#include "utils/utf8.h"
@@ -1327,9 +1326,10 @@ static nserror browser_window_callback(hlcache_handle *c,
browser_window_history_update(bw, c);
hotlist_update_url(hlcache_handle_get_url(c));
- if (bw->refresh_interval != -1)
- schedule(bw->refresh_interval,
+ if (bw->refresh_interval != -1) {
+ guit->browser->schedule(bw->refresh_interval * 10,
browser_window_refresh, bw);
+ }
break;
case CONTENT_MSG_ERRORCODE:
@@ -1620,10 +1620,11 @@ void browser_window_destroy_internal(struct browser_window *bw)
LOG(("Destroying window"));
- if (bw->children != NULL || bw->iframes != NULL)
+ if (bw->children != NULL || bw->iframes != NULL) {
browser_window_destroy_children(bw);
+ }
- schedule_remove(browser_window_refresh, bw);
+ guit->browser->schedule(-1, browser_window_refresh, bw);
/* If this brower window is not the root window, and has focus, unset
* the root browser window's focus pointer. */
@@ -2208,7 +2209,7 @@ void browser_window_stop(struct browser_window *bw)
assert(error == NSERROR_OK);
}
- schedule_remove(browser_window_refresh, bw);
+ guit->browser->schedule(-1, browser_window_refresh, bw);
if (bw->children) {
children = bw->rows * bw->cols;
diff --git a/desktop/gui.h b/desktop/gui.h
index 85f1265bb..361c6bdf4 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -75,7 +75,8 @@ typedef struct nsnsclipboard_styles {
plot_font_style_t style; /**< Style to give text run */
} nsclipboard_styles;
-/** Graphical user interface window function table
+/**
+ * Graphical user interface window function table.
*
* function table implementing window operations
*/
@@ -176,7 +177,9 @@ struct gui_window_table {
*/
void (*set_title)(struct gui_window *g, const char *title);
- /** set the navigation url. */
+ /**
+ * set the navigation url.
+ */
void (*set_url)(struct gui_window *g, const char *url);
/** set favicon */
@@ -209,7 +212,7 @@ struct gui_window_table {
/**
* Remove the caret, if present.
*
- * \param g window with caret
+ * \param g window with caret
*/
void (*remove_caret)(struct gui_window *g);
@@ -269,8 +272,9 @@ struct gui_window_table {
void (*start_selection)(struct gui_window *g);
};
+
/**
- * function table for download windows
+ * function table for download windows.
*/
struct gui_download_table {
struct gui_download_window *(*create)(struct download_context *ctx, struct gui_window *parent);
@@ -282,8 +286,9 @@ struct gui_download_table {
void (*done)(struct gui_download_window *dw);
};
+
/**
- * function table for clipboard operations
+ * function table for clipboard operations.
*/
struct gui_clipboard_table {
/**
@@ -305,6 +310,7 @@ struct gui_clipboard_table {
void (*set)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
};
+
/**
* function table for fetcher operations
*/
@@ -390,8 +396,9 @@ struct gui_fetch_table {
};
+
/**
- * User interface utf8 characterset conversion routines
+ * User interface utf8 characterset conversion routines.
*/
struct gui_utf8_table {
/**
@@ -415,7 +422,9 @@ struct gui_utf8_table {
nserror (*local_to_utf8)(const char *string, size_t len, char **result);
};
-/** Graphical user interface browser misc function table
+
+/**
+ * Graphical user interface browser misc function table.
*
* function table implementing GUI interface to miscelaneous browser
* functionality
@@ -429,6 +438,23 @@ struct gui_browser_table {
*/
void (*poll)(bool active);
+ /**
+ * Schedule a callback.
+ *
+ * \param t interval before the callback should be made in ms or
+ * negative value to remove any existing callback.
+ * \param callback callback function
+ * \param p user parameter passed to callback function
+ * \return NSERROR_OK on sucess or appropriate error on faliure
+ *
+ * The callback function will be called as soon as possible
+ * after the timeout has elapsed.
+ *
+ * Additional calls with the same callback and user parameter will
+ * reset the callback time to the newly specified value.
+ *
+ */
+ nserror (*schedule)(int t, void (*callback)(void *p), void *p);
/* Optional entries */
@@ -474,7 +500,8 @@ struct gui_browser_table {
*/
struct gui_table {
- /** Browser table.
+ /**
+ * Browser table.
*
* Provides miscellaneous browser functionality. The table
* is mandantory and must be provided.
@@ -493,7 +520,8 @@ struct gui_table {
/** Fetcher table */
struct gui_fetch_table *fetch;
- /** UTF8 table
+ /**
+ * UTF8 table.
*
* Provides for conversion between the gui local character
* encoding and utf8. The table optional and may be NULL which
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 8996ab5d6..638abfd96 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -443,6 +443,10 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
return NSERROR_BAD_PARAMETER;
}
+ if (gbt->schedule == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
/* fill in the optional entries with defaults */
if (gbt->quit == NULL) {
gbt->quit = gui_default_quit;