r3484 vince - /trunk/netsurf/utils/warning-blame.sh
by netsurf@semichrome.net
Author: vince
Date: Wed Aug 8 15:20:57 2007
New Revision: 3484
URL: http://source.netsurf-browser.org?rev=3484&view=rev
Log:
a script which will determine who was the last person to change a line which has a warning upon it (and a which revision)
Added:
trunk/netsurf/utils/warning-blame.sh (with props)
Added: trunk/netsurf/utils/warning-blame.sh
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/warning-blame.sh?re...
==============================================================================
--- trunk/netsurf/utils/warning-blame.sh (added)
+++ trunk/netsurf/utils/warning-blame.sh Wed Aug 8 15:20:57 2007
@@ -1,0 +1,36 @@
+#!/bin/sh
+
+# where to store the processed list of warnings
+WARNING_LIST=/tmp/warning-list
+
+if [ $# -gt 1 ]; then
+ if [ -f $1 ]; then
+ cp $1 ${WARNING_LIST}
+ else
+ echo "Need a valid warning file"
+ exit 1
+ fi
+else
+ make clean 2>&1 >/dev/null
+ make nsgtk 2>&1 |grep "warning:" | sort | uniq > ${WARNING_LIST}
+fi
+
+for blamefile in $(cat ${WARNING_LIST} | cut -f 1 -d ':' | sort | uniq ); do
+ if [ -f ${blamefile} ]; then
+ svn blame ${blamefile} >/tmp/blame
+
+ cat ${WARNING_LIST} | grep "^${blamefile}" >/tmp/blame-warnings
+
+ while read warning; do
+ echo ${warning}
+
+ lineno=$(echo ${warning} | cut -f 2 -d ':' ; )
+
+ cat /tmp/blame | head -n ${lineno} | tail -n 1
+
+ done < /tmp/blame-warnings
+ rm /tmp/blame-warnings
+ else
+ echo "Unable to find ${blamefile}"
+ fi
+done
Propchange: trunk/netsurf/utils/warning-blame.sh
------------------------------------------------------------------------------
svn:executable = *
15 years, 7 months
r3483 dsilvers - in /trunk/netsurf: gtk/gtk_window.c utils/
by netsurf@semichrome.net
Author: dsilvers
Date: Tue Aug 7 21:50:39 2007
New Revision: 3483
URL: http://source.netsurf-browser.org?rev=3483&view=rev
Log:
Ensure that we can scroll properly with the keyboard in nsgtk
Modified:
trunk/netsurf/gtk/gtk_window.c
trunk/netsurf/utils/ (props changed)
Modified: trunk/netsurf/gtk/gtk_window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_window.c?rev=3483...
==============================================================================
--- trunk/netsurf/gtk/gtk_window.c (original)
+++ trunk/netsurf/gtk/gtk_window.c Tue Aug 7 21:50:39 2007
@@ -348,7 +348,9 @@
browser_window_mouse_click(g->bw, button,
event->x / g->bw->scale,
event->y / g->bw->scale);
-
+
+ gtk_widget_grab_focus(widget);
+
return TRUE;
}
@@ -401,11 +403,9 @@
if (event->state == 0) {
double value;
- GtkAdjustment *vscroll = gtk_range_get_adjustment(
- g_object_get_data(G_OBJECT(g->viewport), "vScroll"));
+ GtkAdjustment *vscroll = gtk_viewport_get_vadjustment(g->viewport);
- GtkAdjustment *hscroll = gtk_range_get_adjustment(
- g_object_get_data(G_OBJECT(g->viewport), "hScroll"));
+ GtkAdjustment *hscroll = gtk_viewport_get_hadjustment(g->viewport);
GtkAdjustment *scroll;
Propchange: trunk/netsurf/utils/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 7 21:50:39 2007
@@ -1,0 +1,1 @@
+translit.c
15 years, 7 months
r3482 rjek - in /trunk/netsurf/gtk: gtk_gui.c gtk_plotters.c
by netsurf@semichrome.net
Author: rjek
Date: Tue Aug 7 19:35:28 2007
New Revision: 3482
URL: http://source.netsurf-browser.org?rev=3482&view=rev
Log:
Fix warnings in nsgtk caused by recent changes.
Modified:
trunk/netsurf/gtk/gtk_gui.c
trunk/netsurf/gtk/gtk_plotters.c
Modified: trunk/netsurf/gtk/gtk_gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_gui.c?rev=3482&r1...
==============================================================================
--- trunk/netsurf/gtk/gtk_gui.c (original)
+++ trunk/netsurf/gtk/gtk_gui.c Tue Aug 7 19:35:28 2007
@@ -33,6 +33,7 @@
#include "gtk/gtk_gui.h"
#include "gtk/gtk_options.h"
#include "gtk/gtk_completion.h"
+#include "gtk/gtk_window.h"
#include "gtk/options.h"
#include "gtk/gtk_throbber.h"
#include "gtk/gtk_history.h"
Modified: trunk/netsurf/gtk/gtk_plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_plotters.c?rev=34...
==============================================================================
--- trunk/netsurf/gtk/gtk_plotters.c (original)
+++ trunk/netsurf/gtk/gtk_plotters.c Tue Aug 7 19:35:28 2007
@@ -41,6 +41,8 @@
static bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsgtk_plot_polygon(int *p, unsigned int n, colour fill);
+static bool nsgtk_plot_path(float *p, unsigned int n, colour fill, float width,
+ colour c, float *transform);
static bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool nsgtk_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@@ -77,7 +79,8 @@
nsgtk_plot_bitmap_tile,
NULL,
NULL,
- NULL
+ NULL,
+ nsgtk_plot_path
};
@@ -363,6 +366,17 @@
return true;
}
+bool nsgtk_plot_path(float *p, unsigned int n, colour fill, float width,
+ colour c, float *transform)
+{
+ /* Only the internal SVG renderer uses this plot call currently,
+ * and the GTK version uses librsvg. Thus, we ignore this complexity,
+ * and just return true obliviously.
+ */
+
+ return true;
+}
+
void nsgtk_set_colour(colour c)
{
int r, g, b;
15 years, 7 months
r3481 jmb - in /trunk/netsurf/desktop: browser.c browser.h frames.c
by netsurf@semichrome.net
Author: jmb
Date: Tue Aug 7 08:58:04 2007
New Revision: 3481
URL: http://source.netsurf-browser.org?rev=3481&view=rev
Log:
Fix division by 0 caused by uninitialised scale value.
Break out initialisation of common parts of struct browser_window into their own function.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/desktop/frames.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=348...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Aug 7 08:58:04 2007
@@ -136,11 +136,43 @@
return NULL;
}
- /* content */
+ /* Initialise common parts */
+ browser_window_initialise_common(bw, clone);
+
+ /* window characteristics */
+ bw->browser_window_type = BROWSER_WINDOW_NORMAL;
+ bw->scrolling = SCROLLING_YES;
+ bw->border = true;
+ bw->no_resize = true;
+
+ /* gui window */
+ if ((bw->window = gui_create_browser_window(bw, clone)) == NULL) {
+ browser_window_destroy(bw);
+ return NULL;
+ }
+ if (url)
+ browser_window_go(bw, url, referer, history_add);
+
+ return bw;
+}
+
+
+/**
+ * Initialise common parts of a browser window
+ *
+ * \param bw The window to initialise
+ * \param clone The window to clone, or NULL if none
+ */
+void browser_window_initialise_common(struct browser_window *bw,
+ struct browser_window *clone)
+{
+ assert(bw);
+
if (!clone)
bw->history = history_create();
else
bw->history = history_clone(clone->history);
+
if (!clone || (clone && !clone->gesturer))
bw->gesturer = NULL;
else
@@ -149,23 +181,10 @@
/* window characteristics */
bw->sel = selection_create(bw);
bw->refresh_interval = -1;
+
bw->reformat_pending = false;
bw->drag_type = DRAGGING_NONE;
bw->scale = (float) option_scale / 100.0;
- bw->browser_window_type = BROWSER_WINDOW_NORMAL;
- bw->scrolling = SCROLLING_YES;
- bw->border = true;
- bw->no_resize = true;
-
- /* gui window */
- if ((bw->window = gui_create_browser_window(bw, clone)) == NULL) {
- browser_window_destroy(bw);
- return NULL;
- }
- if (url)
- browser_window_go(bw, url, referer, history_add);
-
- return bw;
}
@@ -1073,14 +1092,14 @@
browser_window_find_target_internal(top, target, 0, bw, &rdepth, &bw_target);
if (bw_target)
return bw_target;
-
+
/* we require a new window using the target name */
if (!option_target_blank)
return bw;
bw_target = browser_window_create(NULL, bw, NULL, false);
if (!bw_target)
return bw;
-
+
/* frame names should begin with an alphabetic character (a-z,A-Z), however in
* practice you get things such as '_new' and '2left'. The only real effect this
* has is when giving out names as it can be assumed that an author intended '_new'
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=348...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Tue Aug 7 08:58:04 2007
@@ -188,6 +188,8 @@
struct browser_window * browser_window_create(const char *url,
struct browser_window *clone, const char *referer,
bool history_add);
+void browser_window_initialise_common(struct browser_window *bw,
+ struct browser_window *clone);
void browser_window_go(struct browser_window *bw, const char *url,
const char *referer, bool history_add);
void browser_window_go_unverifiable(struct browser_window *bw,
Modified: trunk/netsurf/desktop/frames.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/frames.c?rev=3481...
==============================================================================
--- trunk/netsurf/desktop/frames.c (original)
+++ trunk/netsurf/desktop/frames.c Tue Aug 7 08:58:04 2007
@@ -66,13 +66,10 @@
for (cur = iframe; cur; cur = cur->next) {
window = &(bw->iframes[index++]);
- /* content */
- window->history = history_create();
- window->sel = selection_create(window);
- window->refresh_interval = -1;
+ /* Initialise common parts */
+ browser_window_initialise_common(window, NULL);
/* window characteristics */
- window->drag_type = DRAGGING_NONE;
window->browser_window_type = BROWSER_WINDOW_IFRAME;
window->scrolling = cur->scrolling;
window->border = cur->border;
@@ -171,13 +168,10 @@
frame = &frameset->children[index];
window = &bw->children[index];
- /* content */
- window->history = history_create();
- window->sel = selection_create(window);
- window->refresh_interval = -1;
+ /* Initialise common parts */
+ browser_window_initialise_common(window, NULL);
/* window characteristics */
- window->drag_type = DRAGGING_NONE;
if (frame->children)
window->browser_window_type =
BROWSER_WINDOW_FRAMESET;
15 years, 7 months
r3479 bursa - in /trunk/netsurf: desktop/plotters.h riscos/plotters.c
by netsurf@semichrome.net
Author: bursa
Date: Tue Aug 7 05:00:17 2007
New Revision: 3479
URL: http://source.netsurf-browser.org?rev=3479&view=rev
Log:
Add path plotter (for SVG). Requires other implementations.
Modified:
trunk/netsurf/desktop/plotters.h
trunk/netsurf/riscos/plotters.c
Modified: trunk/netsurf/desktop/plotters.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/plotters.h?rev=34...
==============================================================================
--- trunk/netsurf/desktop/plotters.h (original)
+++ trunk/netsurf/desktop/plotters.h Tue Aug 7 05:00:17 2007
@@ -42,10 +42,19 @@
bool (*group_start)(const char *name); /** optional */
bool (*group_end)(void); /** optional */
bool (*flush)(void);
+ bool (*path)(float *p, unsigned int n, colour fill, float width,
+ colour c, float *transform);
};
/** Current plotters, must be assigned before use. */
extern struct plotter_table plot;
+enum path_command {
+ PLOTTER_PATH_MOVE,
+ PLOTTER_PATH_CLOSE,
+ PLOTTER_PATH_LINE,
+ PLOTTER_PATH_BEZIER,
+};
+
#endif
Modified: trunk/netsurf/riscos/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/plotters.c?rev=347...
==============================================================================
--- trunk/netsurf/riscos/plotters.c (original)
+++ trunk/netsurf/riscos/plotters.c Tue Aug 7 05:00:17 2007
@@ -27,9 +27,11 @@
int line_width, colour c, bool dotted, bool dashed);
static bool ro_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
-static bool ro_plot_path(const draw_path * const path, int width,
+static bool ro_plot_draw_path(const draw_path * const path, int width,
colour c, bool dotted, bool dashed);
static bool ro_plot_polygon(int *p, unsigned int n, colour fill);
+static bool ro_plot_path(float *p, unsigned int n, colour fill, float width,
+ colour c, float *transform);
static bool ro_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool ro_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@@ -61,7 +63,8 @@
ro_plot_bitmap_tile,
NULL,
NULL,
- NULL
+ NULL,
+ ro_plot_path,
};
int ro_plot_origin_x = 0;
@@ -112,7 +115,7 @@
(ro_plot_origin_y - y0 * 2 - 1) * 256,
draw_END_PATH };
- return ro_plot_path((const draw_path *) path, line_width, c,
+ return ro_plot_draw_path((const draw_path *) path, line_width, c,
dotted, dashed);
}
@@ -128,11 +131,11 @@
(ro_plot_origin_y - y1 * 2 - 1) * 256,
draw_END_PATH };
- return ro_plot_path((const draw_path *) path, width, c, dotted, dashed);
-}
-
-
-bool ro_plot_path(const draw_path * const path, int width,
+ return ro_plot_draw_path((const draw_path *) path, width, c, dotted, dashed);
+}
+
+
+bool ro_plot_draw_path(const draw_path * const path, int width,
colour c, bool dotted, bool dashed)
{
static const draw_line_style line_style = { draw_JOIN_MITRED,
@@ -192,14 +195,120 @@
error = xcolourtrans_set_gcol(fill << 8, 0, os_ACTION_OVERWRITE, 0, 0);
if (error) {
LOG(("xcolourtrans_set_gcol: 0x%x: %s",
- error->errnum, error->errmess));
+ error->errnum, error->errmess));
return false;
}
error = xdraw_fill((draw_path *) path, 0, 0, 0);
if (error) {
LOG(("xdraw_fill: 0x%x: %s",
- error->errnum, error->errmess));
- return false;
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ return true;
+}
+
+
+bool ro_plot_path(float *p, unsigned int n, colour fill, float width,
+ colour c, float *transform)
+{
+ static const draw_line_style line_style = { draw_JOIN_MITRED,
+ draw_CAP_BUTT, draw_CAP_BUTT, 0, 0x7fffffff,
+ 0, 0, 0, 0 };
+ int *path;
+ unsigned int i;
+ os_trfm trfm;
+ os_error *error;
+
+ if (n == 0)
+ return true;
+
+ if (p[0] != PLOTTER_PATH_MOVE) {
+ LOG(("path doesn't start with a move"));
+ return false;
+ }
+
+ path = malloc(sizeof *path * (n + 10));
+ if (!path) {
+ LOG(("out of memory"));
+ return false;
+ }
+
+ LOG(("converting path"));
+ for (i = 0; i < n; ) {
+ if (p[i] == PLOTTER_PATH_MOVE) {
+ path[i] = draw_MOVE_TO;
+ path[i + 1] = p[i + 1] * 2 * 256;
+ path[i + 2] = -p[i + 2] * 2 * 256;
+ i += 3;
+ } else if (p[i] == PLOTTER_PATH_CLOSE) {
+ path[i] = draw_CLOSE_LINE;
+ i++;
+ } else if (p[i] == PLOTTER_PATH_LINE) {
+ path[i] = draw_LINE_TO;
+ path[i + 1] = p[i + 1] * 2 * 256;
+ path[i + 2] = -p[i + 2] * 2 * 256;
+ i += 3;
+ } else if (p[i] == PLOTTER_PATH_BEZIER) {
+ path[i] = draw_BEZIER_TO;
+ path[i + 1] = p[i + 1] * 2 * 256;
+ path[i + 2] = -p[i + 2] * 2 * 256;
+ path[i + 3] = p[i + 3] * 2 * 256;
+ path[i + 4] = -p[i + 4] * 2 * 256;
+ path[i + 5] = p[i + 5] * 2 * 256;
+ path[i + 6] = -p[i + 6] * 2 * 256;
+ i += 7;
+ } else {
+ LOG(("bad path command %f", p[i]));
+ return false;
+ }
+ }
+ path[i] = draw_END_PATH;
+ path[i + 1] = 0;
+
+ LOG(("converting matrix"));
+ trfm.entries[0][0] = transform[0] * 0x10000;
+ trfm.entries[0][1] = transform[1] * 0x10000;
+ trfm.entries[1][0] = transform[2] * 0x10000;
+ trfm.entries[1][1] = transform[3] * 0x10000;
+ trfm.entries[2][0] = (ro_plot_origin_x + transform[4] * 2) * 256;
+ trfm.entries[2][1] = (ro_plot_origin_y - transform[5] * 2) * 256;
+
+ LOG(("plotting"));
+
+ if (fill != TRANSPARENT) {
+ error = xcolourtrans_set_gcol(fill << 8, 0,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ LOG(("xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ error = xdraw_fill(path, 0, &trfm, 0);
+ if (error) {
+ LOG(("xdraw_stroke: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+ }
+
+ if (c != TRANSPARENT) {
+ error = xcolourtrans_set_gcol(c << 8, 0,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ LOG(("xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ error = xdraw_stroke(path, 0, &trfm, 0, width * 2 * 256,
+ &line_style, 0);
+ if (error) {
+ LOG(("xdraw_stroke: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
}
return true;
15 years, 7 months
r3478 bursa - in /trunk/netsurf: content/ desktop/ gtk/ riscos/
by netsurf@semichrome.net
Author: bursa
Date: Tue Aug 7 04:55:18 2007
New Revision: 3478
URL: http://source.netsurf-browser.org?rev=3478&view=rev
Log:
Move window scaling from platform-specific code to desktop/browser.c. Modify gtk gui to handle scaling in the same way as RO.
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/content.h
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/desktop/frames.c
trunk/netsurf/desktop/gui.h
trunk/netsurf/desktop/options.c
trunk/netsurf/desktop/options.h
trunk/netsurf/gtk/gtk_gui.c
trunk/netsurf/gtk/gtk_window.c
trunk/netsurf/gtk/gtk_window.h
trunk/netsurf/riscos/dialog.c
trunk/netsurf/riscos/gui.c
trunk/netsurf/riscos/gui.h
trunk/netsurf/riscos/options.h
trunk/netsurf/riscos/window.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=347...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Tue Aug 7 04:55:18 2007
@@ -513,7 +513,8 @@
* \param c content to check
* \return whether the content can reformat
*/
-bool content_get_reformat(struct content *c) {
+bool content_can_reformat(struct content *c)
+{
return (handler_map[c->type].reformat != NULL);
}
Modified: trunk/netsurf/content/content.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=347...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Tue Aug 7 04:55:18 2007
@@ -237,7 +237,7 @@
struct content * content_create(const char *url);
struct content * content_get(const char *url);
struct content * content_get_ready(const char *url);
-bool content_get_reformat(struct content *c);
+bool content_can_reformat(struct content *c);
bool content_set_type(struct content *c, content_type type,
const char *mime_type, const char *params[]);
void content_set_status(struct content *c, const char *status_message, ...);
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=347...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Aug 7 04:55:18 2007
@@ -56,6 +56,9 @@
/** fake content for <a> being saved as a link */
struct content browser_window_href_content;
+
+/** one or more windows require a reformat */
+bool browser_reformat_pending;
/** maximum frame depth */
#define FRAME_DEPTH 8
@@ -146,7 +149,9 @@
/* window characteristics */
bw->sel = selection_create(bw);
bw->refresh_interval = -1;
+ bw->reformat_pending = false;
bw->drag_type = DRAGGING_NONE;
+ bw->scale = (float) option_scale / 100.0;
bw->browser_window_type = BROWSER_WINDOW_NORMAL;
bw->scrolling = SCROLLING_YES;
bw->border = true;
@@ -961,7 +966,7 @@
if (!c)
return;
- content_reformat(c, width, height);
+ content_reformat(c, width / bw->scale, height / bw->scale);
}
@@ -986,6 +991,20 @@
void browser_window_set_scale_internal(struct browser_window *bw, float scale)
{
int i;
+ struct content *c;
+
+ if (bw->scale == scale)
+ return;
+ bw->scale = scale;
+ c = bw->current_content;
+ if (c) {
+ if (!content_can_reformat(c)) {
+ browser_window_update(bw, false);
+ } else {
+ bw->reformat_pending = true;
+ browser_reformat_pending = true;
+ }
+ }
gui_window_set_scale(bw->window, scale);
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=347...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Tue Aug 7 04:55:18 2007
@@ -115,11 +115,17 @@
/** Refresh interval (-1 if undefined) */
int refresh_interval;
+ /** Window has been resized, and content needs reformatting. */
+ bool reformat_pending;
+
/** Window dimensions */
int x0;
int y0;
int x1;
int y1;
+
+ /** scale of window contents */
+ float scale;
/** Window characteristics */
enum {
@@ -177,6 +183,7 @@
extern struct browser_window *current_redraw_browser;
+extern bool browser_reformat_pending;
struct browser_window * browser_window_create(const char *url,
struct browser_window *clone, const char *referer,
Modified: trunk/netsurf/desktop/frames.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/frames.c?rev=3478...
==============================================================================
--- trunk/netsurf/desktop/frames.c (original)
+++ trunk/netsurf/desktop/frames.c Tue Aug 7 04:55:18 2007
@@ -301,7 +301,7 @@
switch (window->frame_width.unit) {
case FRAME_DIMENSION_PIXELS:
widths[col][row] = window->frame_width.value *
- gui_window_get_scale(window->window);
+ window->scale;
if (window->border) {
if (col != 0)
widths[col][row] += 1;
@@ -363,7 +363,7 @@
switch (window->frame_height.unit) {
case FRAME_DIMENSION_PIXELS:
heights[col][row] = window->frame_height.value *
- gui_window_get_scale(window->window);
+ window->scale;
if (window->border) {
if (row != 0)
heights[col][row] += 1;
Modified: trunk/netsurf/desktop/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/gui.h?rev=3478&r1...
==============================================================================
--- trunk/netsurf/desktop/gui.h (original)
+++ trunk/netsurf/desktop/gui.h Tue Aug 7 04:55:18 2007
@@ -84,7 +84,6 @@
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,
Modified: trunk/netsurf/desktop/options.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/options.c?rev=347...
==============================================================================
--- trunk/netsurf/desktop/options.c (original)
+++ trunk/netsurf/desktop/options.c Tue Aug 7 04:55:18 2007
@@ -115,6 +115,8 @@
#else
int option_toolbar_status_width = 6667;
#endif
+/** default window scale */
+int option_scale = 100;
/* Fetcher configuration */
/** Maximum simultaneous active fetchers */
@@ -122,7 +124,7 @@
/** Maximum simultaneous active fetchers per host.
* (<=option_max_fetchers else it makes no sense
*/
-int option_max_fetchers_per_host = 2;
+int option_max_fetchers_per_host = 1;
/** Maximum number of inactive fetchers cached.
* The total number of handles netsurf will therefore have open
* is this plus option_max_fetchers.
@@ -171,13 +173,14 @@
{ "cookie_jar", OPTION_STRING, &option_cookie_jar },
{ "homepage_url", OPTION_STRING, &option_homepage_url },
{ "url_suggestion", OPTION_BOOL, &option_url_suggestion },
- { "window_x", OPTION_INTEGER, &option_window_x },
- { "window_y", OPTION_INTEGER, &option_window_y },
- { "window_width", OPTION_INTEGER, &option_window_width },
- { "window_height", OPTION_INTEGER, &option_window_height },
- { "window_screen_width", OPTION_INTEGER, &option_window_screen_width },
- { "window_screen_height", OPTION_INTEGER, &option_window_screen_height },
- { "toolbar_status_size", OPTION_INTEGER, &option_toolbar_status_width },
+ { "window_x", OPTION_INTEGER, &option_window_x },
+ { "window_y", OPTION_INTEGER, &option_window_y },
+ { "window_width", OPTION_INTEGER, &option_window_width },
+ { "window_height", OPTION_INTEGER, &option_window_height },
+ { "window_screen_width", OPTION_INTEGER, &option_window_screen_width },
+ { "window_screen_height",OPTION_INTEGER, &option_window_screen_height },
+ { "toolbar_status_size", OPTION_INTEGER, &option_toolbar_status_width },
+ { "option_scale", OPTION_INTEGER, &option_scale },
/* Fetcher options */
{ "max_fetchers", OPTION_INTEGER, &option_max_fetchers },
{ "max_fetchers_per_host",
Modified: trunk/netsurf/desktop/options.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/options.h?rev=347...
==============================================================================
--- trunk/netsurf/desktop/options.h (original)
+++ trunk/netsurf/desktop/options.h Tue Aug 7 04:55:18 2007
@@ -68,6 +68,7 @@
extern int option_window_screen_width;
extern int option_window_screen_height;
extern int option_toolbar_status_width;
+extern int option_scale;
/* Fetcher configuration. */
extern int option_max_fetchers;
Modified: trunk/netsurf/gtk/gtk_gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_gui.c?rev=3478&r1...
==============================================================================
--- trunk/netsurf/gtk/gtk_gui.c (original)
+++ trunk/netsurf/gtk/gtk_gui.c Tue Aug 7 04:55:18 2007
@@ -273,6 +273,10 @@
int max_fd;
GPollFD *fd_list[1000];
unsigned int fd_count = 0;
+ bool block = true;
+
+ if (browser_reformat_pending)
+ block = false;
if (active) {
fetch_poll();
@@ -309,12 +313,18 @@
}
}
}
- gtk_main_iteration_do(true);
+
+ gtk_main_iteration_do(block);
+
for (unsigned int i = 0; i != fd_count; i++) {
g_main_context_remove_poll(0, fd_list[i]);
free(fd_list[i]);
}
- schedule_run();
+
+ schedule_run();
+
+ if (browser_reformat_pending)
+ nsgtk_window_process_reformats();
}
Modified: trunk/netsurf/gtk/gtk_window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_window.c?rev=3478...
==============================================================================
--- trunk/netsurf/gtk/gtk_window.c (original)
+++ trunk/netsurf/gtk/gtk_window.c Tue Aug 7 04:55:18 2007
@@ -8,6 +8,7 @@
#include "gtk/gtk_window.h"
#include "desktop/browser.h"
+#include "desktop/options.h"
#include "desktop/textinput.h"
#include "gtk/gtk_gui.h"
#include "gtk/gtk_scaffolding.h"
@@ -26,7 +27,6 @@
struct browser_window *bw;
/* These are the storage for the rendering */
- float scale;
int caretx, carety, careth;
gui_pointer_shape current_pointer;
int last_x, last_y;
@@ -80,7 +80,7 @@
float nsgtk_get_scale_for_gui(struct gui_window *g)
{
- return g->scale;
+ return g->bw->scale;
}
/* Create a gui_window */
@@ -101,9 +101,9 @@
g->bw = bw;
g->current_pointer = GUI_POINTER_DEFAULT;
if (clone != NULL)
- g->scale = clone->window->scale;
+ bw->scale = clone->scale;
else
- g->scale = 1.0;
+ bw->scale = (float) option_scale / 100;
g->careth = 0;
@@ -268,6 +268,7 @@
{
struct gui_window *g = data;
struct content *c;
+ float scale = g->bw->scale;
assert(g);
assert(g->bw);
@@ -281,6 +282,10 @@
c = g->bw->current_content;
if (c == NULL)
return FALSE;
+
+ /* HTML rendering handles scale itself */
+ if (c->type == CONTENT_HTML)
+ scale = 1;
current_widget = widget;
current_drawable = widget->window;
@@ -290,15 +295,15 @@
#endif
plot = nsgtk_plotters;
- nsgtk_plot_set_scale(g->scale);
+ nsgtk_plot_set_scale(g->bw->scale);
content_redraw(c, 0, 0,
- widget->allocation.width,
- widget->allocation.height,
+ widget->allocation.width * scale,
+ widget->allocation.height * scale,
event->area.x,
event->area.y,
event->area.x + event->area.width,
event->area.y + event->area.height,
- g->scale, 0xFFFFFF);
+ g->bw->scale, 0xFFFFFF);
if (g->careth != 0)
nsgtk_plot_caret(g->caretx, g->carety, g->careth);
@@ -316,8 +321,8 @@
{
struct gui_window *g = data;
- browser_window_mouse_track(g->bw, 0, event->x / g->scale,
- event->y / g->scale);
+ browser_window_mouse_track(g->bw, 0, event->x / g->bw->scale,
+ event->y / g->bw->scale);
g->last_x = event->x;
g->last_y = event->y;
@@ -341,7 +346,8 @@
}
browser_window_mouse_click(g->bw, button,
- event->x / g->scale, event->y / g->scale);
+ event->x / g->bw->scale,
+ event->y / g->bw->scale);
return TRUE;
}
@@ -489,50 +495,43 @@
GtkAllocation *allocation, gpointer data)
{
struct gui_window *g = data;
-
- LOG(("Size allocate for %s scheduling reflow\n", g->bw->name ?
- g->bw->name : "(none"));
-
- /* schedule a callback to perform the resize for 1/10s from now */
- schedule(5, (gtk_callback)(nsgtk_window_reflow_content), g);
+
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
return TRUE;
}
-void nsgtk_window_reflow_content(struct gui_window *g)
-{
- GtkWidget *widget = GTK_WIDGET(g->viewport);
-
- if (gui_in_multitask)
- return;
-
- if (g->bw->current_content == NULL)
- return;
-
- if (g->bw->current_content->status != CONTENT_STATUS_READY &&
- g->bw->current_content->status != CONTENT_STATUS_DONE)
- return;
-
- LOG(("Doing reformat"));
-
- browser_window_reformat(g->bw,
- widget->allocation.width - 2,
- widget->allocation.height);
-
- if (nsgtk_scaffolding_is_busy(g->scaffold))
- schedule(100,
- (gtk_callback)(nsgtk_window_reflow_content), g);
-}
void nsgtk_reflow_all_windows(void)
{
- struct gui_window *g = window_list;
-
- while (g != NULL) {
- nsgtk_window_reflow_content(g);
- g = g->next;
+ for (struct gui_window *g = window_list; g; g = g->next)
+ g->bw->reformat_pending = true;
+
+ browser_reformat_pending = true;
+}
+
+
+/**
+ * Process pending reformats
+ */
+
+void nsgtk_window_process_reformats(void)
+{
+ struct gui_window *g;
+
+ browser_reformat_pending = false;
+ for (g = window_list; g; g = g->next) {
+ GtkWidget *widget = GTK_WIDGET(g->viewport);
+ if (!g->bw->reformat_pending)
+ continue;
+ g->bw->reformat_pending = false;
+ browser_window_reformat(g->bw,
+ widget->allocation.width - 2,
+ widget->allocation.height);
}
}
+
void nsgtk_window_destroy_browser(struct gui_window *g)
{
@@ -627,23 +626,18 @@
gtk_adjustment_set_value(hadj, (double)sx);
}
-float gui_window_get_scale(struct gui_window *g)
-{
- return g->scale;
-}
+
+/**
+ * Set the scale setting of a window
+ *
+ * \param g gui window
+ * \param scale scale value (1.0 == normal scale)
+ */
void gui_window_set_scale(struct gui_window *g, float scale)
{
- if (g->scale == scale)
- return;
- g->scale = scale;
-
- if (g->bw->current_content != NULL)
- gui_window_update_extent(g);
-
- gtk_widget_queue_draw(GTK_WIDGET(g->drawing_area));
-
-}
+}
+
void gui_window_update_extent(struct gui_window *g)
{
@@ -651,8 +645,8 @@
return;
gtk_widget_set_size_request(GTK_WIDGET(g->drawing_area),
- g->bw->current_content->width * g->scale,
- g->bw->current_content->height * g->scale);
+ g->bw->current_content->width * g->bw->scale,
+ g->bw->current_content->height * g->bw->scale);
gtk_widget_set_size_request(GTK_WIDGET(g->viewport), 0, 0);
@@ -837,8 +831,8 @@
*height = GTK_WIDGET(g->viewport)->allocation.height;
if (scaled) {
- *width /= g->scale;
- *height /= g->scale;
+ *width /= g->bw->scale;
+ *height /= g->bw->scale;
}
}
Modified: trunk/netsurf/gtk/gtk_window.h
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_window.h?rev=3478...
==============================================================================
--- trunk/netsurf/gtk/gtk_window.h (original)
+++ trunk/netsurf/gtk/gtk_window.h Tue Aug 7 04:55:18 2007
@@ -11,8 +11,8 @@
#include "desktop/gui.h"
#include "gtk/gtk_scaffolding.h"
-void nsgtk_window_reflow_content(struct gui_window *g);
void nsgtk_reflow_all_windows(void);
+void nsgtk_window_process_reformats(void);
nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g);
struct browser_window *nsgtk_get_browser_for_gui(struct gui_window *g);
Modified: trunk/netsurf/riscos/dialog.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/dialog.c?rev=3478&...
==============================================================================
--- trunk/netsurf/riscos/dialog.c (original)
+++ trunk/netsurf/riscos/dialog.c Tue Aug 7 04:55:18 2007
@@ -675,7 +675,7 @@
void ro_gui_dialog_prepare_zoom(struct gui_window *g)
{
char scale_buffer[8];
- sprintf(scale_buffer, "%.0f", g->option.scale * 100);
+ sprintf(scale_buffer, "%.0f", g->bw->scale * 100);
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer);
ro_gui_set_icon_selected_state(dialog_zoom, ICON_ZOOM_FRAMES, true);
ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES,
Modified: trunk/netsurf/riscos/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui.c?rev=3478&r1=...
==============================================================================
--- trunk/netsurf/riscos/gui.c (original)
+++ trunk/netsurf/riscos/gui.c Tue Aug 7 04:55:18 2007
@@ -156,9 +156,6 @@
/** Browser window which the pointer is over, or 0 if none. */
struct gui_window *gui_track_gui_window;
-/** Some windows have been resized, and should be reformatted. */
-bool gui_reformat_pending = false;
-
gui_drag_type gui_current_drag_type;
wimp_t task_handle; /**< RISC OS wimp task handle. */
static clock_t gui_last_poll; /**< Time of last wimp_poll. */
@@ -883,7 +880,7 @@
xhourglass_off();
if (active) {
event = wimp_poll(mask, &block, 0);
- } else if (sched_active || gui_track || gui_reformat_pending ||
+ } else if (sched_active || gui_track || browser_reformat_pending ||
bitmap_maintenance) {
os_t t = os_read_monotonic_time();
@@ -914,7 +911,7 @@
schedule_run();
ro_gui_window_update_boxes();
- if (gui_reformat_pending && event == wimp_NULL_REASON_CODE)
+ if (browser_reformat_pending && event == wimp_NULL_REASON_CODE)
ro_gui_window_process_reformats();
else if (bitmap_maintenance_priority ||
(bitmap_maintenance && event == wimp_NULL_REASON_CODE))
Modified: trunk/netsurf/riscos/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui.h?rev=3478&r1=...
==============================================================================
--- trunk/netsurf/riscos/gui.h (original)
+++ trunk/netsurf/riscos/gui.h Tue Aug 7 04:55:18 2007
@@ -49,7 +49,6 @@
extern wimp_menu *recent_search_menu; /* search.c */
extern wimp_w history_window;
extern struct form_control *current_gadget;
-extern bool gui_reformat_pending;
extern bool gui_redraw_debug;
extern osspriteop_area *gui_sprites;
extern bool dialog_folder_add, dialog_entry_add, hotlist_insert;
@@ -79,8 +78,6 @@
wimp_w window; /**< RISC OS window handle. */
- /** Window has been resized, and content needs reformatting. */
- bool reformat_pending;
int old_width; /**< Width when last opened / os units. */
int old_height; /**< Height when last opened / os units. */
bool update_extent; /**< Update the extent on next opening */
@@ -96,7 +93,6 @@
/** Options. */
struct {
- float scale; /**< Scale, 1.0 = 100%. */
bool background_images; /**< Display background images. */
bool buffer_animations; /**< Use screen buffering for animations. */
bool buffer_everything; /**< Use screen buffering for everything. */
Modified: trunk/netsurf/riscos/options.h
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/options.h?rev=3478...
==============================================================================
--- trunk/netsurf/riscos/options.h (original)
+++ trunk/netsurf/riscos/options.h Tue Aug 7 04:55:18 2007
@@ -23,7 +23,6 @@
extern int option_fg_plot_style; /* tinct flagword */
extern int option_bg_plot_style; /* tinct flagword */
extern bool option_history_tooltip;
-extern int option_scale;
extern bool option_toolbar_show_buttons;
extern bool option_toolbar_show_address;
extern bool option_toolbar_show_throbber;
@@ -61,7 +60,6 @@
int option_fg_plot_style = tinct_ERROR_DIFFUSE;\
int option_bg_plot_style = tinct_DITHER;\
bool option_history_tooltip = true; \
-int option_scale = 100; \
bool option_toolbar_show_buttons = true; \
bool option_toolbar_show_address = true; \
bool option_toolbar_show_throbber = true; \
@@ -99,7 +97,6 @@
{ "plot_fg_quality", OPTION_INTEGER, &option_fg_plot_style },\
{ "plot_bg_quality", OPTION_INTEGER, &option_bg_plot_style },\
{ "history_tooltip", OPTION_BOOL, &option_history_tooltip }, \
-{ "scale", OPTION_INTEGER, &option_scale }, \
{ "toolbar_show_buttons", OPTION_BOOL, &option_toolbar_show_buttons }, \
{ "toolbar_show_address", OPTION_BOOL, &option_toolbar_show_address }, \
{ "toolbar_show_throbber", OPTION_BOOL, &option_toolbar_show_throbber }, \
Modified: trunk/netsurf/riscos/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/window.c?rev=3478&...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Tue Aug 7 04:55:18 2007
@@ -173,7 +173,6 @@
g->bw = bw;
g->toolbar = 0;
g->status_bar = 0;
- g->reformat_pending = false;
g->old_width = 0;
g->old_height = 0;
g->update_extent = true;
@@ -469,13 +468,14 @@
assert(g);
assert(title);
- if (g->option.scale != 1.0) {
- scale_disp = g->option.scale * 100;
- if (ABS((float)scale_disp - g->option.scale * 100) >= 0.05)
- snprintf(g->title, sizeof g->title, "%s (%.1f%%)", title,
- g->option.scale * 100);
+ if (g->bw->scale != 1.0) {
+ scale_disp = g->bw->scale * 100;
+ if (ABS((float)scale_disp - g->bw->scale * 100) >= 0.05)
+ snprintf(g->title, sizeof g->title, "%s (%.1f%%)",
+ title, g->bw->scale * 100);
else
- snprintf(g->title, sizeof g->title, "%s (%i%%)", title, scale_disp);
+ snprintf(g->title, sizeof g->title, "%s (%i%%)",
+ title, scale_disp);
} else {
strncpy(g->title, title, sizeof g->title);
}
@@ -558,10 +558,10 @@
if (!c)
return;
- x0 = floorf(data->redraw.x * 2 * g->option.scale);
- y0 = -ceilf((data->redraw.y + data->redraw.height) * 2 * g->option.scale);
- x1 = ceilf((data->redraw.x + data->redraw.width) * 2 * g->option.scale) + 1;
- y1 = -floorf(data->redraw.y * 2 * g->option.scale) + 1;
+ x0 = floorf(data->redraw.x * 2 * g->bw->scale);
+ y0 = -ceilf((data->redraw.y + data->redraw.height) * 2 * g->bw->scale);
+ x1 = ceilf((data->redraw.x + data->redraw.width) * 2 * g->bw->scale) + 1;
+ y1 = -floorf(data->redraw.y * 2 * g->bw->scale) + 1;
use_buffer = (data->redraw.full_redraw) &&
(g->option.buffer_everything || g->option.buffer_animations);
@@ -627,8 +627,8 @@
if (g->toolbar)
toolbar_height = ro_gui_theme_toolbar_full_height(g->toolbar);
- *sx = state.xscroll / (2 * g->option.scale);
- *sy = -(state.yscroll - toolbar_height) / (2 * g->option.scale);
+ *sx = state.xscroll / (2 * g->bw->scale);
+ *sy = -(state.yscroll - toolbar_height) / (2 * g->bw->scale);
return true;
}
@@ -657,8 +657,8 @@
return;
}
- state.xscroll = sx * 2 * g->option.scale;
- state.yscroll = -sy * 2 * g->option.scale;
+ state.xscroll = sx * 2 * g->bw->scale;
+ state.yscroll = -sy * 2 * g->bw->scale;
if (g->toolbar)
state.yscroll += ro_gui_theme_toolbar_full_height(g->toolbar);
ro_gui_window_open((wimp_open *)&state);
@@ -697,10 +697,10 @@
if (g->toolbar)
toolbar_height = ro_gui_theme_toolbar_full_height(g->toolbar);
- x0 = x0 * 2 * g->option.scale;
- y0 = y0 * 2 * g->option.scale;
- x1 = x1 * 2 * g->option.scale;
- y1 = y1 * 2 * g->option.scale;
+ x0 = x0 * 2 * g->bw->scale;
+ y0 = y0 * 2 * g->bw->scale;
+ x1 = x1 * 2 * g->bw->scale;
+ y1 = y1 * 2 * g->bw->scale;
cx0 = state.xscroll;
cy0 = -state.yscroll + toolbar_height;
@@ -790,7 +790,7 @@
/* only scale iframe locations */
if (bw->browser_window_type == BROWSER_WINDOW_IFRAME)
- scale = g->option.scale;
+ scale = g->bw->scale;
/* get the position of the top level window */
state.w = top->window->window;
@@ -858,8 +858,8 @@
*width = g->old_width / 2;
*height = g->old_height / 2;
if (scaled) {
- *width /= g->option.scale;
- *height /= g->option.scale;
+ *width /= g->bw->scale;
+ *height /= g->bw->scale;
}
}
@@ -897,7 +897,7 @@
/* only allow a further reformat if we've gained/lost scrollbars */
flags = state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL);
- update = g->reformat_pending;
+ update = g->bw->reformat_pending;
g->update_extent = true;
ro_gui_window_open((wimp_open *)&state);
@@ -910,7 +910,7 @@
return;
}
if (flags == (state.flags & (wimp_WINDOW_HSCROLL | wimp_WINDOW_VSCROLL)))
- g->reformat_pending = update;
+ g->bw->reformat_pending = update;
if ((scroll != 0) && (g->bw->children))
browser_window_recalculate_frameset(g->bw);
}
@@ -1090,9 +1090,9 @@
os_error *error;
error = xwimp_set_caret_position(g->window, -1,
- x * 2 * g->option.scale,
- -(y + height) * 2 * g->option.scale,
- height * 2 * g->option.scale, -1);
+ x * 2 * g->bw->scale,
+ -(y + height) * 2 * g->bw->scale,
+ height * 2 * g->bw->scale, -1);
if (error) {
LOG(("xwimp_set_caret_position: 0x%x: %s",
error->errnum, error->errmess));
@@ -1230,10 +1230,10 @@
}
drag.type = wimp_DRAG_USER_POINT;
- drag.bbox.x0 = pointer.pos.x + (int)(x0 * 2 * g->option.scale);
- drag.bbox.y0 = pointer.pos.y + (int)(y0 * 2 * g->option.scale);
- drag.bbox.x1 = pointer.pos.x + (int)(x1 * 2 * g->option.scale);
- drag.bbox.y1 = pointer.pos.y + (int)(y1 * 2 * g->option.scale);
+ drag.bbox.x0 = pointer.pos.x + (int)(x0 * 2 * g->bw->scale);
+ drag.bbox.y0 = pointer.pos.y + (int)(y0 * 2 * g->bw->scale);
+ drag.bbox.x1 = pointer.pos.x + (int)(x1 * 2 * g->bw->scale);
+ drag.bbox.y1 = pointer.pos.y + (int)(y1 * 2 * g->bw->scale);
error = xwimp_drag_box(&drag);
if (error) {
@@ -1363,19 +1363,6 @@
/**
- * Get the scale setting of a window
- *
- * \param g gui window
- * \return scale value (1.0 == normal scale)
- */
-
-float gui_window_get_scale(struct gui_window *g)
-{
- return g->option.scale;
-}
-
-
-/**
* Set the scale setting of a window
*
* \param g gui window
@@ -1384,21 +1371,7 @@
void gui_window_set_scale(struct gui_window *g, float scale)
{
- struct content *c;
-
- if (g->option.scale == scale)
- return;
- g->option.scale = scale;
- c = g->bw->current_content;
- if (c) {
- ro_gui_dialog_update_zoom(g);
- if (!content_get_reformat(c)) {
- browser_window_update(g->bw, false);
- } else {
- g->reformat_pending = true;
- gui_reformat_pending = true;
- }
- }
+ ro_gui_dialog_update_zoom(g);
}
@@ -1422,7 +1395,7 @@
osbool more;
bool knockout = true;
struct gui_window *g = (struct gui_window *)ro_gui_wimp_event_get_user_data(redraw->w);
- float scale = g->option.scale;
+ float scale = g->bw->scale;
struct content *c = g->bw->current_content;
int clip_x0, clip_y0, clip_x1, clip_y1, clear_x1, clear_y1;
os_error *error;
@@ -1439,9 +1412,9 @@
ro_gui_current_redraw_gui = g;
current_redraw_browser = g->bw;
- /* rendering textplain has no advantages using knockout rendering other than to
- * slow things down. */
- if (c->type == CONTENT_TEXTPLAIN)
+ /* rendering textplain has no advantages using knockout rendering other
+ * than to slow things down. */
+ if (c->type == CONTENT_TEXTPLAIN || c->type == CONTENT_SVG)
knockout = false;
/* HTML rendering handles scale itself */
@@ -1477,7 +1450,7 @@
content_redraw(c, 0, 0,
c->width * scale, c->height * scale,
clip_x0, clip_y0, clip_x1, clip_y1,
- g->option.scale,
+ g->bw->scale,
0xFFFFFF);
if (knockout)
knockout_plot_end();
@@ -1569,7 +1542,7 @@
plot = ro_plotters;
ro_plot_origin_x = update.box.x0 - update.xscroll;
ro_plot_origin_y = update.box.y1 - update.yscroll;
- ro_plot_set_scale(g->option.scale);
+ ro_plot_set_scale(g->bw->scale);
/* We should clear the background, except for HTML.
*/
@@ -1601,21 +1574,21 @@
content_redraw(c, 0, 0,
c->width, c->height,
clip_x0, clip_y0, clip_x1, clip_y1,
- g->option.scale,
+ g->bw->scale,
0xFFFFFF);
} else {
assert(data->redraw.object);
content_redraw(data->redraw.object,
floorf(data->redraw.object_x *
- g->option.scale),
+ g->bw->scale),
ceilf(data->redraw.object_y *
- g->option.scale),
+ g->bw->scale),
data->redraw.object_width *
- g->option.scale,
+ g->bw->scale,
data->redraw.object_height *
- g->option.scale,
+ g->bw->scale,
clip_x0, clip_y0, clip_x1, clip_y1,
- g->option.scale,
+ g->bw->scale,
0xFFFFFF);
}
@@ -1745,8 +1718,8 @@
height -= ro_get_title_height(g->window);
}
if (content) {
- width = max(width, content->width * 2 * g->option.scale);
- height = max(height, content->height * 2 * g->option.scale);
+ width = max(width, content->width * 2 * g->bw->scale);
+ height = max(height, content->height * 2 * g->bw->scale);
}
os_box extent = { 0, -height, width, toolbar_height };
error = xwimp_set_extent(g->window, &extent);
@@ -1823,14 +1796,14 @@
if ((!no_hscroll) &&
((fheight > size) ||
(g->bw->browser_window_type == BROWSER_WINDOW_NORMAL)) &&
- ((content && width < content->width * 2 * g->option.scale) ||
+ ((content && width < content->width * 2 * g->bw->scale) ||
(g->bw->browser_window_type == BROWSER_WINDOW_NORMAL))) {
if (!(state.flags & wimp_WINDOW_HSCROLL)) {
height -= size;
state.visible.y0 += size;
if (content) {
- g->reformat_pending = true;
- gui_reformat_pending = true;
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
}
}
state.flags |= wimp_WINDOW_HSCROLL;
@@ -1839,8 +1812,8 @@
height += size;
state.visible.y0 -= size;
if (content) {
- g->reformat_pending = true;
- gui_reformat_pending = true;
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
}
}
state.flags &= ~wimp_WINDOW_HSCROLL;
@@ -1856,14 +1829,14 @@
if ((!no_vscroll) &&
((fwidth > size) ||
(g->bw->browser_window_type == BROWSER_WINDOW_NORMAL)) &&
- ((content && height < content->height * 2 * g->option.scale) ||
+ ((content && height < content->height * 2 * g->bw->scale) ||
(g->bw->scrolling == SCROLLING_YES))) {
if (!(state.flags & wimp_WINDOW_VSCROLL)) {
width -= size;
state.visible.x1 -= size;
if (content) {
- g->reformat_pending = true;
- gui_reformat_pending = true;
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
}
}
state.flags |= wimp_WINDOW_VSCROLL;
@@ -1872,8 +1845,8 @@
width += size;
state.visible.x1 += size;
if (content) {
- g->reformat_pending = true;
- gui_reformat_pending = true;
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
}
}
state.flags &= ~wimp_WINDOW_VSCROLL;
@@ -1885,9 +1858,9 @@
/* Ctrl-resize of a top-level window scales the content size */
if ((g->old_width > 0) && (g->old_width != width) && (!g->bw->parent) &&
(ro_gui_ctrl_pressed()))
- new_scale = (g->option.scale * width) / g->old_width;
- g->reformat_pending = true;
- gui_reformat_pending = true;
+ new_scale = (g->bw->scale * width) / g->old_width;
+ g->bw->reformat_pending = true;
+ browser_reformat_pending = true;
}
if (g->update_extent || g->old_width != width || g->old_height != height) {
g->old_width = width;
@@ -2514,16 +2487,16 @@
case 23: /* CTRL+W (Zoom in) */
if (!content)
break;
- scale = g->option.scale;
+ scale = g->bw->scale;
if (ro_gui_shift_pressed() && c == 17)
- scale = g->option.scale - 0.1;
+ scale = g->bw->scale - 0.1;
else if (ro_gui_shift_pressed() && c == 23)
- scale = g->option.scale + 0.1;
+ scale = g->bw->scale + 0.1;
else if (c == 17) {
for (int i = SCALE_SNAP_TO_SIZE - 1;
i >= 0; i--)
if (scale_snap_to[i] <
- g->option.scale) {
+ g->bw->scale) {
scale = scale_snap_to[i];
break;
}
@@ -2531,7 +2504,7 @@
for (unsigned int i = 0;
i < SCALE_SNAP_TO_SIZE; i++)
if (scale_snap_to[i] >
- g->option.scale) {
+ g->bw->scale) {
scale = scale_snap_to[i];
break;
}
@@ -2540,12 +2513,12 @@
scale = scale_snap_to[0];
if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1])
scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
- if (g->option.scale != scale) {
+ if (g->bw->scale != scale) {
browser_window_set_scale(g->bw, scale, true);
// g->reformat_pending = true;
// if ((content) && (content->type != CONTENT_HTML))
// browser_window_update(g->bw, false);
-// gui_reformat_pending = true;
+// browser_reformat_pending = true;
}
return true;
@@ -2712,8 +2685,8 @@
warn_user("WimpError", error->errmess);
return false;
}
- pos->x = (x - (state.visible.x0 - state.xscroll)) / 2 / g->option.scale;
- pos->y = ((state.visible.y1 - state.yscroll) - y) / 2 / g->option.scale;
+ pos->x = (x - (state.visible.x0 - state.xscroll)) / 2 / g->bw->scale;
+ pos->y = ((state.visible.y1 - state.yscroll) - y) / 2 / g->bw->scale;
return true;
}
@@ -2743,8 +2716,8 @@
warn_user("WimpError", error->errmess);
return false;
}
- pos->x = (x * 2 * g->option.scale) + (state.visible.x0 - state.xscroll);
- pos->y = (state.visible.y1 - state.yscroll) - (y * 2 * g->option.scale);
+ pos->x = (x * 2 * g->bw->scale) + (state.visible.x0 - state.xscroll);
+ pos->y = (state.visible.y1 - state.yscroll) - (y * 2 * g->bw->scale);
return true;
}
@@ -2896,14 +2869,14 @@
{
struct gui_window *g;
- gui_reformat_pending = false;
+ browser_reformat_pending = false;
for (g = window_list; g; g = g->next) {
- if (!g->reformat_pending)
+ if (!g->bw->reformat_pending)
continue;
- g->reformat_pending = false;
+ g->bw->reformat_pending = false;
browser_window_reformat(g->bw,
- g->old_width / 2 / g->option.scale,
- g->old_height / 2 / g->option.scale);
+ g->old_width / 2,
+ g->old_height / 2);
}
}
@@ -2932,7 +2905,7 @@
/* Clone the basic options
*/
if (!old_gui) {
- new_gui->option.scale = ((float)option_scale) / 100;
+ new_bw->scale = ((float)option_scale) / 100;
new_gui->option.background_images = option_background_images;
new_gui->option.buffer_animations = option_buffer_animations;
new_gui->option.buffer_everything = option_buffer_everything;
@@ -2975,7 +2948,7 @@
/* Save the basic options
*/
- option_scale = gui->option.scale * 100;
+ option_scale = bw->scale * 100;
option_buffer_animations = gui->option.buffer_animations;
option_buffer_everything = gui->option.buffer_everything;
15 years, 7 months
r3477 jmb - in /trunk/netsurf: debug/netsurfd.c utils/config.h
by netsurf@semichrome.net
Author: jmb
Date: Mon Aug 6 23:17:42 2007
New Revision: 3477
URL: http://source.netsurf-browser.org?rev=3477&view=rev
Log:
Fix debug build
Modified:
trunk/netsurf/debug/netsurfd.c
trunk/netsurf/utils/config.h
Modified: trunk/netsurf/debug/netsurfd.c
URL: http://source.netsurf-browser.org/trunk/netsurf/debug/netsurfd.c?rev=3477...
==============================================================================
--- trunk/netsurf/debug/netsurfd.c (original)
+++ trunk/netsurf/debug/netsurfd.c Mon Aug 6 23:17:42 2007
@@ -29,6 +29,7 @@
#include "utils/utils.h"
int done, destroyed;
+bool verbose_log = true;
bool print_active = false;
void *hotlist_toolbar = NULL;
void *hotlist_window = NULL;
Modified: trunk/netsurf/utils/config.h
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/config.h?rev=3477&r...
==============================================================================
--- trunk/netsurf/utils/config.h (original)
+++ trunk/netsurf/utils/config.h Mon Aug 6 23:17:42 2007
@@ -62,8 +62,10 @@
#else
/* We're likely to have a working mmap() */
#define WITH_MMAP
- /* Use librsvg and Cairo for rendering SVG */
- #define WITH_RSVG
+ #if !defined(DEBUG_BUILD)
+ /* Use librsvg and Cairo for rendering SVG */
+ #define WITH_RSVG
+ #endif
#endif
#if defined(WITH_NS_SVG) && defined(WITH_RSVG)
15 years, 7 months
r3476 jmb - in /trunk/netsurf/content: content.c fetch.c
by netsurf@semichrome.net
Author: jmb
Date: Mon Aug 6 23:17:04 2007
New Revision: 3476
URL: http://source.netsurf-browser.org?rev=3476&view=rev
Log:
Fix crash when building error page -- fetch will be NULL, so fetch_get_referer will fail.
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/fetch.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=347...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Mon Aug 6 23:17:04 2007
@@ -564,7 +564,8 @@
c->user_list->next->next) {
/* type not shareable, and more than one user: split into
* a content per user */
- const char *referer = fetch_get_referer(c->fetch);
+ const char *referer =
+ c->fetch ? fetch_get_referer(c->fetch) : NULL;
while (c->user_list->next->next) {
clone = content_create(c->url);
Modified: trunk/netsurf/content/fetch.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetch.c?rev=3476&...
==============================================================================
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Mon Aug 6 23:17:04 2007
@@ -533,6 +533,8 @@
*/
const char *fetch_get_referer(struct fetch *fetch)
{
+ assert(fetch);
+
return fetch->referer;
}
15 years, 7 months
r3475 jmb - /trunk/netsurf/riscos/wimp.c
by netsurf@semichrome.net
Author: jmb
Date: Sat Aug 4 12:47:40 2007
New Revision: 3475
URL: http://source.netsurf-browser.org?rev=3475&view=rev
Log:
Fix string length measurement for strings in icons; if the string came from the templates file, it will be LF terminated, not NUL terminated. Therefore, use a strlen variant that terminates on control characters, rather than just \0. This prevents reading memory beyond the end of the string.
Modified:
trunk/netsurf/riscos/wimp.c
Modified: trunk/netsurf/riscos/wimp.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/wimp.c?rev=3475&r1...
==============================================================================
--- trunk/netsurf/riscos/wimp.c (original)
+++ trunk/netsurf/riscos/wimp.c Sat Aug 4 12:47:40 2007
@@ -31,6 +31,7 @@
static void ro_gui_wimp_cache_furniture_sizes(wimp_w w);
+static size_t ro_gui_strlen(const char *str);
static wimpextend_furniture_sizes furniture_sizes;
static wimp_w furniture_window = NULL;
@@ -265,7 +266,7 @@
}
/* copy the text across */
- old_len = strlen(ic.icon.data.indirected_text.text);
+ old_len = ro_gui_strlen(ic.icon.data.indirected_text.text);
if (ic.icon.data.indirected_text.size) {
strncpy(ic.icon.data.indirected_text.text,
local_text ? local_text : text,
@@ -944,3 +945,22 @@
}
return state.flags & mask;
}
+
+/**
+ * RO GUI-specific strlen, for control character terminated strings
+ *
+ * \param str The string to measure the length of
+ * \return The length of the string
+ */
+size_t ro_gui_strlen(const char *str)
+{
+ size_t len = 0;
+
+ if (str == NULL)
+ return 0;
+
+ while (*(str++) >= ' ')
+ len++;
+
+ return len;
+}
15 years, 7 months