summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-05-11 19:36:08 (GMT)
committer Ashish Gupta <ashmew2@gmail.com>2017-09-12 17:59:04 (GMT)
commit571d788f118f0314e933f2c0f89bd928131df236 (patch)
tree69cf754819a622dcd7196b02b202d4a13c3a087e
parentb57ca0c5e399da94b9b2790f236aa7afa19faeb9 (diff)
downloadnetsurf-571d788f118f0314e933f2c0f89bd928131df236.tar.gz
netsurf-571d788f118f0314e933f2c0f89bd928131df236.tar.bz2
Changes to gui.c as framebuffer frontend has changed
-rw-r--r--frontends/kolibrios/fb/gui.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/frontends/kolibrios/fb/gui.c b/frontends/kolibrios/fb/gui.c
index ebd3a3d..90388ac 100644
--- a/frontends/kolibrios/fb/gui.c
+++ b/frontends/kolibrios/fb/gui.c
@@ -1592,7 +1592,7 @@ resize_browser_widget(struct gui_window *gw, int x, int y,
int width, int height)
{
fbtk_set_pos_and_size(gw->browser, x, y, width, height);
- browser_window_reformat(gw->bw, false, width, height);
+ browser_window_schedule_reformat(gw->bw);
}
static void
@@ -1858,34 +1858,56 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
-static void
-gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
+/**
+ * Set the scroll position of a framebuffer browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The framebuffer implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param gw gui_window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
float scale = browser_window_get_scale(gw->bw);
assert(bwidget);
- widget_scroll_x(gw, sx * scale, true);
- widget_scroll_y(gw, sy * scale, true);
+ widget_scroll_x(gw, rect->x0 * scale, true);
+ widget_scroll_y(gw, rect->y0 * scale, true);
+
+ return NSERROR_OK;
}
-static void
-gui_window_get_dimensions(struct gui_window *g,
+/**
+ * Find the current dimensions of a framebuffer browser window content area.
+ *
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated.
+ */
+static nserror
+gui_window_get_dimensions(struct gui_window *gw,
int *width,
int *height,
bool scaled)
{
- float scale = browser_window_get_scale(g->bw);
-
- *width = fbtk_get_width(g->browser);
- *height = fbtk_get_height(g->browser);
+ *width = fbtk_get_width(gw->browser);
+ *height = fbtk_get_height(gw->browser);
if (scaled) {
+ float scale = browser_window_get_scale(gw->bw);
*width /= scale;
*height /= scale;
}
+ return NSERROR_OK;
}
static void
@@ -2064,15 +2086,6 @@ gui_window_remove_caret(struct gui_window *g)
}
}
-static void framebuffer_window_reformat(struct gui_window *gw)
-{
- /** @todo if we ever do zooming reformat should be implemented */
- LOG("window:%p", gw);
-
- /*
- browser_window_reformat(gw->bw, false, width, height);
- */
-}
static struct gui_window_table framebuffer_window_table = {
.create = gui_window_create,
@@ -2082,7 +2095,6 @@ static struct gui_window_table framebuffer_window_table = {
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = framebuffer_window_reformat,
.set_url = gui_window_set_url,
.set_status = gui_window_set_status,
@@ -2234,6 +2246,7 @@ MKARGV(ARGC, "\0");
fb_warn_user(messages_get_errorcode(ret), 0);
} else {
framebuffer_run();
+
browser_window_destroy(bw);
}