summaryrefslogtreecommitdiff
path: root/desktop/browser.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-26 09:43:18 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-26 09:43:18 +0100
commitbd932d958b022c5fe02c76e976d3871d8651843b (patch)
tree4022b23875df5be7ad0eaa144325ed96aad1eb4e /desktop/browser.c
parent31d98a1d2e5081ef2ca2d941f7e3b92344185399 (diff)
downloadnetsurf-bd932d958b022c5fe02c76e976d3871d8651843b.tar.gz
netsurf-bd932d958b022c5fe02c76e976d3871d8651843b.tar.bz2
remove reformat from browser window operation table
the reformat callback was completely unecessary and implementations appeared potentialy buggy. This rationalises the API and reduces the number of operations a frontend must provide.
Diffstat (limited to 'desktop/browser.c')
-rw-r--r--desktop/browser.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 45f300697..73a86c2e3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1781,6 +1781,27 @@ static void browser_window_destroy_children(struct browser_window *bw)
/**
+ * internal scheduled reformat callback.
+ *
+ * scheduled reformat callback to allow reformats from unthreaded context.
+ *
+ * \param vbw The browser window to be reformatted
+ */
+static void scheduled_reformat(void *vbw)
+{
+ struct browser_window *bw = vbw;
+ int width;
+ int height;
+ nserror res;
+
+ res = guit->window->get_dimensions(bw->window, &width, &height, false);
+ if (res == NSERROR_OK) {
+ browser_window_reformat(bw, false, width, height);
+ }
+}
+
+
+/**
* Release all memory associated with a browser window.
*
* \param bw browser window
@@ -1809,8 +1830,8 @@ static void browser_window_destroy_internal(struct browser_window *bw)
/* The ugly cast here is so the reformat function can be
* passed a gui window pointer in its API rather than void*
*/
- LOG("Clearing schedule %p(%p)", guit->window->reformat, bw->window);
- guit->misc->schedule(-1, (void(*)(void*))guit->window->reformat, bw->window);
+ LOG("Clearing reformat schedule for browser window %p", bw);
+ guit->misc->schedule(-1, scheduled_reformat, bw);
/* If this brower window is not the root window, and has focus, unset
* the root browser window's focus pointer. */
@@ -2574,13 +2595,16 @@ void browser_window_set_pointer(struct browser_window *bw,
guit->window->set_pointer(root->window, gui_shape);
}
+
/* exported function documented in netsurf/browser_window.h */
nserror browser_window_schedule_reformat(struct browser_window *bw)
{
- /* The ugly cast here is so the reformat function can be
- * passed a gui window pointer in its API rather than void*
- */
- guit->misc->schedule(0, (void(*)(void*))guit->window->reformat, bw->window);
+ if (bw->window == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ guit->misc->schedule(0, scheduled_reformat, bw);
+
return NSERROR_OK;
}