summaryrefslogtreecommitdiff
path: root/frontends/gtk/window.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-19 16:34:56 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-23 12:05:30 +0100
commitd930da38997bb5c7ec3c077568465d2595f02693 (patch)
treee9355d2e9a9384b02f94f535fcc136cb639bd48b /frontends/gtk/window.c
parentb1029506505320859c57d056011003b71053b600 (diff)
downloadnetsurf-d930da38997bb5c7ec3c077568465d2595f02693.tar.gz
netsurf-d930da38997bb5c7ec3c077568465d2595f02693.tar.bz2
update gtk frontend with invalidate window API change
Diffstat (limited to 'frontends/gtk/window.c')
-rw-r--r--frontends/gtk/window.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index 40e5580b5..25b975e7d 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -1014,27 +1014,38 @@ static void gui_window_remove_caret(struct gui_window *g)
}
-static void gui_window_redraw_window(struct gui_window *g)
-{
- gtk_widget_queue_draw(GTK_WIDGET(g->layout));
-}
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
+/**
+ * Invalidates an area of a GTK browser window
+ *
+ * \param g gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror
+nsgtk_window_invalidate_area(struct gui_window *g, const struct rect *rect)
{
int sx, sy;
float scale;
- if (!browser_window_has_content(g->bw))
- return;
+ if (rect == NULL) {
+ gtk_widget_queue_draw(GTK_WIDGET(g->layout));
+ return NSERROR_OK;
+ }
+
+ if (!browser_window_has_content(g->bw)) {
+ return NSERROR_OK;
+ }
gui_window_get_scroll(g, &sx, &sy);
scale = browser_window_get_scale(g->bw);
gtk_widget_queue_draw_area(GTK_WIDGET(g->layout),
- rect->x0 * scale - sx,
- rect->y0 * scale - sy,
- (rect->x1 - rect->x0) * scale,
- (rect->y1 - rect->y0) * scale);
+ rect->x0 * scale - sx,
+ rect->y0 * scale - sy,
+ (rect->x1 - rect->x0) * scale,
+ (rect->y1 - rect->y0) * scale);
+
+ return NSERROR_OK;
}
static void gui_window_set_status(struct gui_window *g, const char *text)
@@ -1295,7 +1306,7 @@ gui_window_file_gadget_open(struct gui_window *g,
GTK_FILE_CHOOSER(dialog));
browser_window_set_gadget_filename(g->bw, gadget, filename);
-
+
g_free(filename);
}
@@ -1305,8 +1316,7 @@ gui_window_file_gadget_open(struct gui_window *g,
static struct gui_window_table window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = nsgtk_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,