summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-09-08 16:57:26 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-09-08 16:57:26 +0000
commit02a8722cc66980069afe7c674dbb93710846a07f (patch)
treef303fe3166116122865d4cf6908e166f494f7055 /desktop
parent79554528ba6766cfc3687a223558956ad7526b83 (diff)
downloadnetsurf-02a8722cc66980069afe7c674dbb93710846a07f.tar.gz
netsurf-02a8722cc66980069afe7c674dbb93710846a07f.tar.bz2
Fix 1553282.
svn path=/trunk/netsurf/; revision=2932
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c34
-rw-r--r--desktop/browser.h1
-rw-r--r--desktop/gui.h2
3 files changed, 35 insertions, 2 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index e4a1f8d49..43b702e90 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -60,6 +60,7 @@ struct browser_window *current_redraw_browser;
/** fake content for <a> being saved as a link */
struct content browser_window_href_content;
+static void browser_window_set_scale_internal(struct browser_window *bw, float scale);
static void browser_window_resize_frame(struct browser_window *bw, int x, int y);
static bool browser_window_resolve_frame_dimension(struct browser_window *bw,
struct browser_window *sibling, int x, int y, bool width, bool height);
@@ -405,7 +406,8 @@ void browser_window_recalculate_frameset(struct browser_window *bw) {
switch (window->frame_width.unit) {
case FRAME_DIMENSION_PIXELS:
- widths[col][row] = window->frame_width.value;
+ widths[col][row] = window->frame_width.value *
+ gui_window_get_scale(window->window);
if (window->border) {
if (col != 0)
widths[col][row] += 1;
@@ -466,7 +468,8 @@ void browser_window_recalculate_frameset(struct browser_window *bw) {
switch (window->frame_height.unit) {
case FRAME_DIMENSION_PIXELS:
- heights[col][row] = window->frame_height.value;
+ heights[col][row] = window->frame_height.value *
+ gui_window_get_scale(window->window);
if (window->border) {
if (row != 0)
heights[col][row] += 1;
@@ -543,6 +546,33 @@ void browser_window_recalculate_frameset(struct browser_window *bw) {
/**
+ * Sets the scale of a browser window
+ *
+ * \param bw The browser window to scale
+ * \param scale The new scale
+ * \param all Scale all windows in the tree (ie work up aswell as down)
+ */
+void browser_window_set_scale(struct browser_window *bw, float scale, bool all) {
+ while (bw->parent && all)
+ bw = bw->parent;
+ browser_window_set_scale_internal(bw, scale);
+}
+
+void browser_window_set_scale_internal(struct browser_window *bw, float scale) {
+ int i;
+
+ gui_window_set_scale(bw->window, scale);
+
+ for (i = 0; i < (bw->cols * bw->rows); i++)
+ browser_window_set_scale_internal(&bw->children[i], scale);
+ for (i = 0; i < bw->iframe_count; i++)
+ browser_window_set_scale_internal(&bw->iframes[i], scale);
+ if (bw->children)
+ browser_window_recalculate_frameset(bw);
+}
+
+
+/**
* Resize a browser window that is a frame.
*
* \param bw The browser window to resize
diff --git a/desktop/browser.h b/desktop/browser.h
index b9516c78b..f85fb03bc 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -199,6 +199,7 @@ void browser_window_recalculate_iframes(struct browser_window *bw);
void browser_window_create_frameset(struct browser_window *bw,
struct content_html_frames *frameset);
void browser_window_recalculate_frameset(struct browser_window *bw);
+void browser_window_set_scale(struct browser_window *bw, float scale, bool all);
void browser_window_mouse_click(struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
diff --git a/desktop/gui.h b/desktop/gui.h
index b50fe82ed..bcce94272 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -84,6 +84,8 @@ bool gui_window_box_scroll_start(struct gui_window *g,
int x0, int y0, int x1, int y1);
bool gui_window_frame_resize_start(struct gui_window *g);
void gui_window_save_as_link(struct gui_window *g, struct content *c);
+float gui_window_get_scale(struct gui_window *g);
+void gui_window_set_scale(struct gui_window *g, float scale);
struct gui_download_window *gui_download_window_create(const char *url,
const char *mime_type, struct fetch *fetch,