summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c36
-rw-r--r--desktop/browser_private.h3
-rw-r--r--desktop/gui_factory.c3
3 files changed, 32 insertions, 10 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;
}
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 3e9b8467a..5a53e2f0b 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Browser window private structure.
*/
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index e1de21ea1..559823d61 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -176,9 +176,6 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->update_extent == NULL) {
return NSERROR_BAD_PARAMETER;
}
- if (gwt->reformat == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
/* fill in the optional entries with defaults */