summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-05-11 21:36:08 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-06-10 08:25:29 +0200
commit4a95a17b0c6106137e629bbcf572be3d837e8b42 (patch)
tree39a9577c579f2135ccc85cd007fb37b689d29697 /frontends
parentdac20745dc4f069267cca761fdebb3c62f3b79f6 (diff)
downloadnetsurf-4a95a17b0c6106137e629bbcf572be3d837e8b42.tar.gz
netsurf-4a95a17b0c6106137e629bbcf572be3d837e8b42.tar.bz2
Changes to gui.c as framebuffer frontend has changed
Diffstat (limited to 'frontends')
-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 ebd3a3d3b..90388acda 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);
}