From 3c1a6f9c52b57274f1388dd3bf8e07d9b046ae03 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 23 May 2017 09:45:37 +0100 Subject: update gtk frontend for corewindow API change --- frontends/gtk/corewindow.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c index a3d606637..9ad644d7f 100644 --- a/frontends/gtk/corewindow.c +++ b/frontends/gtk/corewindow.c @@ -547,19 +547,33 @@ nsgtk_cw_draw_event(GtkWidget *widget, /** - * redraw window core window callback + * callback from core to request an invalidation of a GTK core window area. * - * \param cw core window handle. - * \param r rectangle that needs redrawing. + * The specified area of the window should now be considered + * out of date. If the area is NULL the entire window must be + * invalidated. + * + * \param[in] cw The core window to invalidate. + * \param[in] rect area to redraw or NULL for the entire window area. + * \return NSERROR_OK on success or appropriate error code. */ -static void -nsgtk_cw_redraw_request(struct core_window *cw, const struct rect *r) +static nserror +nsgtk_cw_invalidate_area(struct core_window *cw, const struct rect *rect) { struct nsgtk_corewindow *nsgtk_cw = (struct nsgtk_corewindow *)cw; + if (rect == NULL) { + gtk_widget_queue_draw(GTK_WIDGET(nsgtk_cw->drawing_area)); + return NSERROR_OK; + } + gtk_widget_queue_draw_area(GTK_WIDGET(nsgtk_cw->drawing_area), - r->x0, r->y0, - r->x1 - r->x0, r->y1 - r->y0); + rect->x0, + rect->y0, + rect->x1 - rect->x0, + rect->y1 - rect->y0); + + return NSERROR_OK; } @@ -656,13 +670,14 @@ nsgtk_cw_drag_status(struct core_window *cw, core_window_drag_status ds) * core window callback table for nsgtk */ static struct core_window_callback_table nsgtk_cw_cb_table = { - .redraw_request = nsgtk_cw_redraw_request, + .invalidate = nsgtk_cw_invalidate_area, .update_size = nsgtk_cw_update_size, .scroll_visible = nsgtk_cw_scroll_visible, .get_window_dimensions = nsgtk_cw_get_window_dimensions, .drag_status = nsgtk_cw_drag_status }; + /* exported function documented gtk/corewindow.h */ nserror nsgtk_corewindow_init(struct nsgtk_corewindow *nsgtk_cw) { -- cgit v1.2.3