summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-06-30 16:40:56 +0100
committerVincent Sanders <vince@kyllikki.org>2014-07-01 09:27:20 +0100
commit18aefabd20a16dda9ed5363088f0da5ada0d4431 (patch)
tree9447e1e0edb1d93b8ad575472e67bf7f844c5ca3 /riscos
parent06eb81235d975bc7721719d25ac114b4ab2c94da (diff)
downloadnetsurf-18aefabd20a16dda9ed5363088f0da5ada0d4431.tar.gz
netsurf-18aefabd20a16dda9ed5363088f0da5ada0d4431.tar.bz2
change reformat to be driven from the scheduler like redraw
Diffstat (limited to 'riscos')
-rw-r--r--riscos/gui.c14
-rw-r--r--riscos/gui.h1
-rw-r--r--riscos/window.c45
3 files changed, 22 insertions, 38 deletions
diff --git a/riscos/gui.c b/riscos/gui.c
index 00f6ebc11..3253f796f 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -1864,17 +1864,18 @@ static void riscos_poll(bool active)
/* Poll wimp. */
xhourglass_off();
track_poll_offset = ro_mouse_poll_interval();
- if (sched_active || (track_poll_offset > 0) ||
- browser_reformat_pending) {
+ if (sched_active || (track_poll_offset > 0)) {
os_t t = os_read_monotonic_time();
- if (track_poll_offset > 0)
+ if (track_poll_offset > 0) {
t += track_poll_offset;
- else
+ } else {
t += 10;
+ }
- if (sched_active && (sched_time - t) < 0)
+ if (sched_active && (sched_time - t) < 0) {
t = sched_time;
+ }
event = wimp_poll_idle(mask, &block, t, 0);
} else {
@@ -1895,9 +1896,6 @@ static void riscos_poll(bool active)
}
ro_gui_window_update_boxes();
-
- if (browser_reformat_pending && event == wimp_NULL_REASON_CODE)
- ro_gui_window_process_reformats();
}
diff --git a/riscos/gui.h b/riscos/gui.h
index bc59b5db9..3403f551e 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -134,7 +134,6 @@ void ro_gui_window_iconise(struct gui_window *g,
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
void ro_gui_window_redraw_all(void);
void ro_gui_window_update_boxes(void);
-void ro_gui_window_process_reformats(void);
void ro_gui_window_quit(void);
/* void ro_gui_window_close_all(void); */
#define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */
diff --git a/riscos/window.c b/riscos/window.c
index e1eaf871d..3bb359d31 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -975,7 +975,6 @@ static void gui_window_update_extent(struct gui_window *g)
os_error *error;
wimp_window_info info;
wimp_window_state state;
- bool update;
unsigned int flags;
assert(g);
@@ -995,9 +994,8 @@ static void gui_window_update_extent(struct gui_window *g)
info.yscroll += scroll;
}
- /* only allow a further reformat if we've gained/lost scrollbars */
+ /* only schedule a reformat if we've gained/lost scrollbars */
flags = info.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL);
- update = g->bw->reformat_pending;
g->update_extent = true;
ro_gui_window_open(PTR_WIMP_OPEN(&info));
@@ -1009,8 +1007,9 @@ static void gui_window_update_extent(struct gui_window *g)
warn_user("WimpError", error->errmess);
return;
}
- if (flags == (state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL)))
- g->bw->reformat_pending = update;
+ if (flags == (state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL))) {
+ browser_window_schedule_reformat(g->bw);
+ }
}
@@ -1563,8 +1562,7 @@ void ro_gui_window_open(wimp_open *open)
height -= size;
state.visible.y0 += size;
if (h) {
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
}
}
state.flags |= wimp_WINDOW_HSCROLL;
@@ -1573,8 +1571,7 @@ void ro_gui_window_open(wimp_open *open)
height += size;
state.visible.y0 -= size;
if (h) {
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
}
}
state.flags &= ~wimp_WINDOW_HSCROLL;
@@ -1589,8 +1586,7 @@ void ro_gui_window_open(wimp_open *open)
width -= size;
state.visible.x1 -= size;
if (h) {
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
}
}
state.flags |= wimp_WINDOW_VSCROLL;
@@ -1599,8 +1595,7 @@ void ro_gui_window_open(wimp_open *open)
width += size;
state.visible.x1 += size;
if (h) {
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
}
}
state.flags &= ~wimp_WINDOW_VSCROLL;
@@ -1613,8 +1608,7 @@ void ro_gui_window_open(wimp_open *open)
if ((g->old_width > 0) && (g->old_width != width) &&
(ro_gui_ctrl_pressed()))
new_scale = (g->bw->scale * width) / g->old_width;
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
}
if (g->update_extent || g->old_width != width ||
g->old_height != height) {
@@ -4385,25 +4379,17 @@ void ro_gui_window_update_boxes(void)
/**
- * Process pending reformats
+ * callback from core to reformat a window.
*/
-
-void ro_gui_window_process_reformats(void)
+static void riscos_window_reformat(struct gui_window *gw)
{
- struct gui_window *g;
-
- browser_reformat_pending = false;
- for (g = window_list; g; g = g->next) {
- if (!g->bw->reformat_pending)
- continue;
- g->bw->reformat_pending = false;
- browser_window_reformat(g->bw, false,
- g->old_width / 2,
- g->old_height / 2);
+ if (gw != NULL) {
+ browser_window_reformat(gw->bw, false,
+ gw->old_width / 2,
+ gw->old_height / 2);
}
}
-
/**
* Destroy all browser windows.
*/
@@ -5180,6 +5166,7 @@ static struct gui_window_table window_table = {
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
+ .reformat = riscos_window_reformat,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,