From 6e0f5bee5587db14f7c5755f50a7a17d665d0b99 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 23 Apr 2017 20:59:50 +0100 Subject: Update beos frontend to use invalidate window area API --- frontends/beos/window.cpp | 54 ++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'frontends/beos') diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp index fbf7b1652..4db7b3ca6 100644 --- a/frontends/beos/window.cpp +++ b/frontends/beos/window.cpp @@ -1000,39 +1000,42 @@ void nsbeos_redraw_caret(struct gui_window *g) g->view->UnlockLooper(); } -static void gui_window_redraw_window(struct gui_window *g) +/** + * Invalidate an area of a beos browser window + * + * \param gw The netsurf window being invalidated. + * \param rect area to redraw or NULL for entrire window area. + * \return NSERROR_OK or appropriate error code. + */ +static nserror +beos_window_invalidate_area(struct gui_window *g, const struct rect *rect) { - if (g->view == NULL) - return; - if (!g->view->LockLooper()) - return; - - nsbeos_current_gc_set(g->view); - - g->view->Invalidate(); - - nsbeos_current_gc_set(NULL); - g->view->UnlockLooper(); -} + if (browser_window_has_content(g->bw) == false) { + return NSERROR_OK; + } -static void gui_window_update_box(struct gui_window *g, const struct rect *rect) -{ - if (browser_window_has_content(g->bw) == false) - return; + if (g->view == NULL) { + return NSERROR_OK; + } - if (g->view == NULL) - return; - if (!g->view->LockLooper()) - return; + if (!g->view->LockLooper()) { + return NSERROR_OK; + } nsbeos_current_gc_set(g->view); -//XXX +1 ?? - g->view->Invalidate(BRect(rect->x0, rect->y0, - rect->x1 - 1, rect->y1 - 1)); + if (rect != NULL) { + //XXX +1 ?? + g->view->Invalidate(BRect(rect->x0, rect->y0, + rect->x1 - 1, rect->y1 - 1)); + } else { + g->view->Invalidate(); + } nsbeos_current_gc_set(NULL); g->view->UnlockLooper(); + + return NSERROR_OK; } static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) @@ -1349,8 +1352,7 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei static struct gui_window_table window_table = { gui_window_create, gui_window_destroy, - gui_window_redraw_window, - gui_window_update_box, + beos_window_invalidate_area, gui_window_get_scroll, gui_window_set_scroll, gui_window_get_dimensions, -- cgit v1.2.3