Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81
...commit
http://git.netsurf-browser.org/netsurf.git/commit/e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81
...tree
http://git.netsurf-browser.org/netsurf.git/tree/e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81
The branch, master has been updated
via e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81 (commit)
via bf0e6be9cad29ade1acd114f664af38f6de2f801 (commit)
via 0aae3c370ba498d726eda40b71d2259c00f86a24 (commit)
via 077237a4df2b576e972ff2d98b9c35175536ccd5 (commit)
via 13276f56549f1c03cf485fb39c4f683a3ea4d3c7 (commit)
via 98f8eaeb31ec77f37fdc30d4a28e889c663c7d3b (commit)
from 3be2b98cc2d5c4e7c97a6caba86d1869893f25eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81
commit e78dc4f5a945f2035f48c8dc01cd3b1d76f03c81
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove RISC OS scale shadow variable
diff --git a/frontends/riscos/gui.h b/frontends/riscos/gui.h
index d4ff9ce..0d7ee38 100644
--- a/frontends/riscos/gui.h
+++ b/frontends/riscos/gui.h
@@ -93,8 +93,6 @@ struct gui_window {
char validation[12]; /**< Validation string for colours */
- float scale; /**< Browser window scale */
-
/** Options. */
struct {
bool buffer_animations; /**< Use screen buffering for
animations. */
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index f6ffdc4..e2238ac 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3268,7 +3268,6 @@ static struct gui_window *gui_window_create(struct
browser_window *bw,
g->active = false;
strcpy(g->title, "NetSurf");
g->iconise_icon = -1;
- g->scale = browser_window_get_scale(bw);
/* Set the window position */
if (existing != NULL &&
@@ -3952,6 +3951,7 @@ gui_window_drag_start(struct gui_window *g,
{
wimp_pointer pointer;
wimp_drag drag;
+ float scale = browser_window_get_scale(g->bw);
if (rect != NULL) {
/* We have a box to constrain the pointer to, for the drag
@@ -3968,13 +3968,13 @@ gui_window_drag_start(struct gui_window *g,
drag.type = wimp_DRAG_USER_POINT;
drag.bbox.x0 = pointer.pos.x +
- (int)(rect->x0 * 2 * g->scale);
+ (int)(rect->x0 * 2 * scale);
drag.bbox.y0 = pointer.pos.y +
- (int)(rect->y0 * 2 * g->scale);
+ (int)(rect->y0 * 2 * scale);
drag.bbox.x1 = pointer.pos.x +
- (int)(rect->x1 * 2 * g->scale);
+ (int)(rect->x1 * 2 * scale);
drag.bbox.y1 = pointer.pos.y +
- (int)(rect->y1 * 2 * g->scale);
+ (int)(rect->y1 * 2 * scale);
error = xwimp_drag_box(&drag);
if (error) {
@@ -4388,7 +4388,6 @@ nserror ro_gui_window_set_url(struct gui_window *g, nsurl
*url)
void ro_gui_window_set_scale(struct gui_window *g, float scale)
{
browser_window_set_scale(g->bw, scale, true);
- g->scale = browser_window_get_scale(g->bw);
}
@@ -4727,17 +4726,19 @@ void ro_gui_throb(void)
/* exported interface documented in riscos/window.h */
void ro_gui_window_default_options(struct gui_window *gui)
{
+ float cscale;
+
if (gui == NULL)
return;
- /* Save the basic options
- */
- nsoption_set_int(scale, gui->scale * 100);
+ cscale = browser_window_get_scale(gui->bw);
+
+ /* Save the basic options */
+ nsoption_set_int(scale, cscale * 100);
nsoption_set_bool(buffer_animations, gui->option.buffer_animations);
nsoption_set_bool(buffer_everything, gui->option.buffer_everything);
- /* Set up the toolbar
- */
+ /* Set up the toolbar */
if (gui->toolbar != NULL) {
nsoption_set_bool(toolbar_show_buttons,
ro_toolbar_get_display_buttons(gui->toolbar));
@@ -4746,9 +4747,10 @@ void ro_gui_window_default_options(struct gui_window
*gui)
nsoption_set_bool(toolbar_show_throbber,
ro_toolbar_get_display_throbber(gui->toolbar));
}
- if (gui->status_bar != NULL)
+ if (gui->status_bar != NULL) {
nsoption_set_int(toolbar_status_size,
ro_gui_status_bar_get_width(gui->status_bar));
+ }
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=bf0e6be9cad29ade1acd114f664af38f6de2f801
commit bf0e6be9cad29ade1acd114f664af38f6de2f801
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove unecessary scaling in RISC OS get and set scroll offsets
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 0a0faed..f6ffdc4 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3598,10 +3598,11 @@ static bool gui_window_get_scroll(struct gui_window *g,
int *sx, int *sy)
return false;
}
- if (g->toolbar)
+ if (g->toolbar) {
toolbar_height = ro_toolbar_full_height(g->toolbar);
- *sx = state.xscroll / (2 * g->scale);
- *sy = -(state.yscroll - toolbar_height) / (2 * g->scale);
+ }
+ *sx = state.xscroll / 2;
+ *sy = -(state.yscroll - toolbar_height) / 2;
return true;
}
@@ -3640,8 +3641,8 @@ gui_window_set_scroll(struct gui_window *g, const struct
rect *rect)
if ((rect->x0 == rect->x1) && (rect->y0 == rect->y1)) {
/* scroll to top */
- state.xscroll = rect->x0 * 2 * g->scale;
- state.yscroll = (-rect->y0 * 2 * g->scale) + toolbar_height;
+ state.xscroll = rect->x0 * 2;
+ state.yscroll = (-rect->y0 * 2) + toolbar_height;
} else {
/* scroll area into view with padding */
int x0, y0, x1, y1;
@@ -3649,10 +3650,10 @@ gui_window_set_scroll(struct gui_window *g, const
struct rect *rect)
int padding_available;
int correction;
- x0 = rect->x0 * 2 * g->scale;
- y0 = rect->y0 * 2 * g->scale;
- x1 = rect->x1 * 2 * g->scale;
- y1 = rect->y1 * 2 * g->scale;
+ x0 = rect->x0 * 2 ;
+ y0 = rect->y0 * 2 ;
+ x1 = rect->x1 * 2 ;
+ y1 = rect->y1 * 2 ;
cx0 = state.xscroll;
cy0 = -state.yscroll + toolbar_height;
@@ -3987,8 +3988,9 @@ gui_window_drag_start(struct gui_window *g,
switch (type) {
case GDRAGGING_SCROLLBAR:
/* Dragging a core scrollbar */
- ro_mouse_drag_start(ro_gui_window_scroll_end,
ro_gui_window_mouse_at,
- NULL, g);
+ ro_mouse_drag_start(ro_gui_window_scroll_end,
+ ro_gui_window_mouse_at,
+ NULL, g);
break;
default:
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=0aae3c370ba498d726eda40b71d2259c00f86a24
commit 0aae3c370ba498d726eda40b71d2259c00f86a24
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
change RISC OS keypress handling for scale to not use shadow variable
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index a92d4c7..0a0faed 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -390,15 +390,18 @@ static void ro_gui_window_open(wimp_open *open)
/* reformat or change extent if necessary */
if (have_content &&
- (g->old_width != width || g->old_height != height)) {
+ (g->old_width != width || g->old_height != height)) {
/* Ctrl-resize of a top-level window scales the content size */
- if ((g->old_width > 0) && (g->old_width != width) &&
- (ro_gui_ctrl_pressed()))
- new_scale = (g->scale * width) / g->old_width;
+ if ((g->old_width > 0) &&
+ (g->old_width != width) &&
+ (ro_gui_ctrl_pressed())) {
+ new_scale = (browser_window_get_scale(g->bw) * width) /
g->old_width;
+ }
browser_window_schedule_reformat(g->bw);
}
- if (g->update_extent || g->old_width != width ||
- g->old_height != height) {
+ if (g->update_extent ||
+ g->old_width != width ||
+ g->old_height != height) {
g->old_width = width;
g->old_height = height;
g->update_extent = false;
@@ -1209,6 +1212,52 @@ ro_gui_window_scroll_action(struct gui_window *g,
}
}
+/**
+ * handle scale kepresses within RISC OS
+ */
+static bool handle_local_keypress_scale(struct gui_window *gw, uint32_t c)
+{
+ float cscale; /* current scale */
+ float scale; /* new scale */
+
+ cscale = browser_window_get_scale(gw->bw);
+
+ scale = cscale;
+
+ if (ro_gui_shift_pressed() && c == 17) {
+ scale = cscale - 0.1;
+ } else if (ro_gui_shift_pressed() && c == 23) {
+ scale = cscale + 0.1;
+ } else if (c == 17) {
+ for (int i = SCALE_SNAP_TO_SIZE - 1; i >= 0; i--) {
+ if (scale_snap_to[i] < cscale) {
+ scale = scale_snap_to[i];
+ break;
+ }
+ }
+ } else {
+ for (unsigned int i = 0; i < SCALE_SNAP_TO_SIZE; i++) {
+ if (scale_snap_to[i] > cscale) {
+ scale = scale_snap_to[i];
+ break;
+ }
+ }
+ }
+
+ if (scale < scale_snap_to[0]) {
+ 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 (cscale != scale) {
+ ro_gui_window_set_scale(gw, scale);
+ }
+
+ return true;
+}
/**
* Handle keypresses within the RISC OS GUI
@@ -1231,7 +1280,6 @@ ro_gui_window_handle_local_keypress(struct gui_window *g,
os_error *ro_error;
wimp_pointer pointer;
os_coord pos;
- float scale;
uint32_t c = (uint32_t) key->c;
wimp_scroll_direction xscroll = wimp_SCROLL_NONE;
wimp_scroll_direction yscroll = wimp_SCROLL_NONE;
@@ -1392,34 +1440,10 @@ ro_gui_window_handle_local_keypress(struct gui_window
*g,
case 17: /* CTRL+Q (Zoom out) */
case 23: /* CTRL+W (Zoom in) */
- if (browser_window_has_content(g->bw) == false)
- break;
- scale = g->scale;
- if (ro_gui_shift_pressed() && c == 17)
- scale = g->scale - 0.1;
- else if (ro_gui_shift_pressed() && c == 23)
- scale = g->scale + 0.1;
- else if (c == 17) {
- for (int i = SCALE_SNAP_TO_SIZE - 1; i >= 0; i--)
- if (scale_snap_to[i] < g->scale) {
- scale = scale_snap_to[i];
- break;
- }
- } else {
- for (unsigned int i = 0; i < SCALE_SNAP_TO_SIZE; i++)
- if (scale_snap_to[i] > g->scale) {
- scale = scale_snap_to[i];
- break;
- }
- }
- if (scale < scale_snap_to[0])
- 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->scale != scale) {
- ro_gui_window_set_scale(g, scale);
+ if (browser_window_has_content(g->bw) == true) {
+ return handle_local_keypress_scale(g, c);
}
- return true;
+ break;
case IS_WIMP_KEY + wimp_KEY_PRINT:
ro_gui_window_action_print(g);
@@ -1700,37 +1724,48 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
*/
static void ro_gui_window_scroll(wimp_scroll *scroll)
{
- struct gui_window *g = ro_gui_window_lookup(scroll->w);
-
- if (g && browser_window_has_content(g->bw) && ro_gui_shift_pressed()) {
- /* extended scroll request with shift held down; change zoom */
- float scale, inc;
-
- if (scroll->ymin & 3)
- inc = 0.02; /* RO5 sends the msg 5 times;
- * don't ask me why
- *
- * @todo this is liable to break if
- * HID is configured optimally for
- * frame scrolling. *5 appears to be
- * an artifact of non-HID mode scrolling.
- */
- else
- inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
-
- if (scroll->ymin > 0) {
- scale = g->scale + inc;
- if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1])
- scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
- } else {
- scale = g->scale - inc;
- if (scale < scale_snap_to[0])
- scale = scale_snap_to[0];
- }
- if (g->scale != scale)
- ro_gui_window_set_scale(g, scale);
- } else if (g != NULL) {
+ float cscale, scale, inc;
+ struct gui_window *g = ro_gui_window_lookup(scroll->w);
+
+ if (g == NULL) {
+ return;
+ }
+
+ if ((browser_window_has_content(g->bw) == false) ||
+ (ro_gui_shift_pressed() == false)) {
ro_gui_window_scroll_action(g, scroll->xmin, scroll->ymin);
+ return;
+ }
+
+ /* extended scroll request with shift held down; change zoom */
+ cscale = browser_window_get_scale(g->bw);
+
+ if (scroll->ymin & 3) {
+ inc = 0.02; /* RO5 sends the msg 5 times;
+ * don't ask me why
+ *
+ * @todo this is liable to break if
+ * HID is configured optimally for
+ * frame scrolling. *5 appears to be
+ * an artifact of non-HID mode scrolling.
+ */
+ } else {
+ inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
+ }
+
+ if (scroll->ymin > 0) {
+ scale = cscale + inc;
+ if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1]) {
+ scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
+ }
+ } else {
+ scale = cscale - inc;
+ if (scale < scale_snap_to[0]) {
+ scale = scale_snap_to[0];
+ }
+ }
+ if (scale != cscale) {
+ ro_gui_window_set_scale(g, scale);
}
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=077237a4df2b576e972ff2d98b9c35175536ccd5
commit 077237a4df2b576e972ff2d98b9c35175536ccd5
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove core snapping for values set in absolute mode
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index f3b173f..176fced 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -3379,13 +3379,8 @@ browser_window_set_scale(struct browser_window *bw,
float scale, bool absolute)
bw = bw->parent;
}
- if (absolute) {
- /* ensure "close" to 1 is treated as 1 */
- if (scale > 0.95 && scale < 1.05) {
- scale = 1.0;
- }
- } else {
- /* ensure "close" to 1 is treated as 1 */
+ if (!absolute) {
+ /* snap small values around 1.0 */
if ((scale + bw->scale) > (1.01 - scale) &&
(scale + bw->scale) < (0.99 + scale)) {
scale = 1.0;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=13276f56549f1c03cf485fb39c4f683a3ea4d3c7
commit 13276f56549f1c03cf485fb39c4f683a3ea4d3c7
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
make risc os title setting not use shadow scale value
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index beadf4c..a92d4c7 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -3514,20 +3514,24 @@ static void gui_window_destroy(struct gui_window *g)
*/
static void gui_window_set_title(struct gui_window *g, const char *title)
{
+ float scale;
assert(g);
assert(title);
- if (g->scale != 1.0) {
- int scale_disp = g->scale * 100;
+ scale = browser_window_get_scale(g->bw);
- if (ABS((float)scale_disp - g->scale * 100) >= 0.05)
+ if (scale != 1.0) {
+ int scale_disp = scale * 100;
+
+ if (ABS((float)scale_disp - scale * 100) >= 0.05) {
snprintf(g->title, sizeof g->title, "%s (%.1f%%)",
- title, g->scale * 100);
- else
+ title, scale * 100);
+ } else {
snprintf(g->title, sizeof g->title, "%s (%i%%)",
title, scale_disp);
+ }
} else {
- strncpy(g->title, title, sizeof g->title);
+ strncpy(g->title, title, sizeof(g->title));
}
ro_gui_set_window_title(g->window, g->title);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=98f8eaeb31ec77f37fdc30d4a28e889c663c7d3b
commit 98f8eaeb31ec77f37fdc30d4a28e889c663c7d3b
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove unused interface
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index ab46f28..beadf4c 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -4766,31 +4766,6 @@ ro_gui_window_to_window_pos(struct gui_window *g, int x,
int y, os_coord *pos)
/* exported interface documented in riscos/window.h */
-bool ro_gui_window_to_screen_pos(struct gui_window *g,
- int x,
- int y,
- os_coord *pos)
-{
- wimp_window_state state;
- os_error *error;
-
- assert(g);
-
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s",
- error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
- pos->x = (x * 2 * g->scale) + (state.visible.x0 - state.xscroll);
- pos->y = (state.visible.y1 - state.yscroll) - (y * 2 * g->scale);
- return true;
-}
-
-
-/* exported interface documented in riscos/window.h */
enum browser_mouse_state
ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type)
{
diff --git a/frontends/riscos/window.h b/frontends/riscos/window.h
index 0a5bd43..c3325a7 100644
--- a/frontends/riscos/window.h
+++ b/frontends/riscos/window.h
@@ -192,17 +192,6 @@ bool ro_gui_window_to_window_pos(struct gui_window *g, int
x, int y, os_coord *p
/**
- * Convert x,y window co-ordinates into screen co-ordinates.
- *
- * \param g gui window
- * \param x x ordinate
- * \param y y ordinate
- * \param pos receives position in screen co-ordinatates
- * \return true iff conversion successful
- */
-bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord
*pos);
-
-/**
* Returns the state of the mouse buttons and modifiers keys for a
* mouse action, suitable for passing to the OS-independent
* browser window/ treeview/ etc code.
-----------------------------------------------------------------------
Summary of changes:
desktop/browser_window.c | 9 +-
frontends/riscos/gui.h | 2 -
frontends/riscos/window.c | 254 ++++++++++++++++++++++++---------------------
frontends/riscos/window.h | 11 --
4 files changed, 138 insertions(+), 138 deletions(-)
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index f3b173f..176fced 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -3379,13 +3379,8 @@ browser_window_set_scale(struct browser_window *bw,
float scale, bool absolute)
bw = bw->parent;
}
- if (absolute) {
- /* ensure "close" to 1 is treated as 1 */
- if (scale > 0.95 && scale < 1.05) {
- scale = 1.0;
- }
- } else {
- /* ensure "close" to 1 is treated as 1 */
+ if (!absolute) {
+ /* snap small values around 1.0 */
if ((scale + bw->scale) > (1.01 - scale) &&
(scale + bw->scale) < (0.99 + scale)) {
scale = 1.0;
diff --git a/frontends/riscos/gui.h b/frontends/riscos/gui.h
index d4ff9ce..0d7ee38 100644
--- a/frontends/riscos/gui.h
+++ b/frontends/riscos/gui.h
@@ -93,8 +93,6 @@ struct gui_window {
char validation[12]; /**< Validation string for colours */
- float scale; /**< Browser window scale */
-
/** Options. */
struct {
bool buffer_animations; /**< Use screen buffering for
animations. */
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index ab46f28..e2238ac 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -390,15 +390,18 @@ static void ro_gui_window_open(wimp_open *open)
/* reformat or change extent if necessary */
if (have_content &&
- (g->old_width != width || g->old_height != height)) {
+ (g->old_width != width || g->old_height != height)) {
/* Ctrl-resize of a top-level window scales the content size */
- if ((g->old_width > 0) && (g->old_width != width) &&
- (ro_gui_ctrl_pressed()))
- new_scale = (g->scale * width) / g->old_width;
+ if ((g->old_width > 0) &&
+ (g->old_width != width) &&
+ (ro_gui_ctrl_pressed())) {
+ new_scale = (browser_window_get_scale(g->bw) * width) /
g->old_width;
+ }
browser_window_schedule_reformat(g->bw);
}
- if (g->update_extent || g->old_width != width ||
- g->old_height != height) {
+ if (g->update_extent ||
+ g->old_width != width ||
+ g->old_height != height) {
g->old_width = width;
g->old_height = height;
g->update_extent = false;
@@ -1209,6 +1212,52 @@ ro_gui_window_scroll_action(struct gui_window *g,
}
}
+/**
+ * handle scale kepresses within RISC OS
+ */
+static bool handle_local_keypress_scale(struct gui_window *gw, uint32_t c)
+{
+ float cscale; /* current scale */
+ float scale; /* new scale */
+
+ cscale = browser_window_get_scale(gw->bw);
+
+ scale = cscale;
+
+ if (ro_gui_shift_pressed() && c == 17) {
+ scale = cscale - 0.1;
+ } else if (ro_gui_shift_pressed() && c == 23) {
+ scale = cscale + 0.1;
+ } else if (c == 17) {
+ for (int i = SCALE_SNAP_TO_SIZE - 1; i >= 0; i--) {
+ if (scale_snap_to[i] < cscale) {
+ scale = scale_snap_to[i];
+ break;
+ }
+ }
+ } else {
+ for (unsigned int i = 0; i < SCALE_SNAP_TO_SIZE; i++) {
+ if (scale_snap_to[i] > cscale) {
+ scale = scale_snap_to[i];
+ break;
+ }
+ }
+ }
+
+ if (scale < scale_snap_to[0]) {
+ 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 (cscale != scale) {
+ ro_gui_window_set_scale(gw, scale);
+ }
+
+ return true;
+}
/**
* Handle keypresses within the RISC OS GUI
@@ -1231,7 +1280,6 @@ ro_gui_window_handle_local_keypress(struct gui_window *g,
os_error *ro_error;
wimp_pointer pointer;
os_coord pos;
- float scale;
uint32_t c = (uint32_t) key->c;
wimp_scroll_direction xscroll = wimp_SCROLL_NONE;
wimp_scroll_direction yscroll = wimp_SCROLL_NONE;
@@ -1392,34 +1440,10 @@ ro_gui_window_handle_local_keypress(struct gui_window
*g,
case 17: /* CTRL+Q (Zoom out) */
case 23: /* CTRL+W (Zoom in) */
- if (browser_window_has_content(g->bw) == false)
- break;
- scale = g->scale;
- if (ro_gui_shift_pressed() && c == 17)
- scale = g->scale - 0.1;
- else if (ro_gui_shift_pressed() && c == 23)
- scale = g->scale + 0.1;
- else if (c == 17) {
- for (int i = SCALE_SNAP_TO_SIZE - 1; i >= 0; i--)
- if (scale_snap_to[i] < g->scale) {
- scale = scale_snap_to[i];
- break;
- }
- } else {
- for (unsigned int i = 0; i < SCALE_SNAP_TO_SIZE; i++)
- if (scale_snap_to[i] > g->scale) {
- scale = scale_snap_to[i];
- break;
- }
+ if (browser_window_has_content(g->bw) == true) {
+ return handle_local_keypress_scale(g, c);
}
- if (scale < scale_snap_to[0])
- 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->scale != scale) {
- ro_gui_window_set_scale(g, scale);
- }
- return true;
+ break;
case IS_WIMP_KEY + wimp_KEY_PRINT:
ro_gui_window_action_print(g);
@@ -1700,37 +1724,48 @@ static void ro_gui_window_redraw(wimp_draw *redraw)
*/
static void ro_gui_window_scroll(wimp_scroll *scroll)
{
- struct gui_window *g = ro_gui_window_lookup(scroll->w);
-
- if (g && browser_window_has_content(g->bw) && ro_gui_shift_pressed()) {
- /* extended scroll request with shift held down; change zoom */
- float scale, inc;
-
- if (scroll->ymin & 3)
- inc = 0.02; /* RO5 sends the msg 5 times;
- * don't ask me why
- *
- * @todo this is liable to break if
- * HID is configured optimally for
- * frame scrolling. *5 appears to be
- * an artifact of non-HID mode scrolling.
- */
- else
- inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
-
- if (scroll->ymin > 0) {
- scale = g->scale + inc;
- if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1])
- scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
- } else {
- scale = g->scale - inc;
- if (scale < scale_snap_to[0])
- scale = scale_snap_to[0];
- }
- if (g->scale != scale)
- ro_gui_window_set_scale(g, scale);
- } else if (g != NULL) {
+ float cscale, scale, inc;
+ struct gui_window *g = ro_gui_window_lookup(scroll->w);
+
+ if (g == NULL) {
+ return;
+ }
+
+ if ((browser_window_has_content(g->bw) == false) ||
+ (ro_gui_shift_pressed() == false)) {
ro_gui_window_scroll_action(g, scroll->xmin, scroll->ymin);
+ return;
+ }
+
+ /* extended scroll request with shift held down; change zoom */
+ cscale = browser_window_get_scale(g->bw);
+
+ if (scroll->ymin & 3) {
+ inc = 0.02; /* RO5 sends the msg 5 times;
+ * don't ask me why
+ *
+ * @todo this is liable to break if
+ * HID is configured optimally for
+ * frame scrolling. *5 appears to be
+ * an artifact of non-HID mode scrolling.
+ */
+ } else {
+ inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
+ }
+
+ if (scroll->ymin > 0) {
+ scale = cscale + inc;
+ if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1]) {
+ scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
+ }
+ } else {
+ scale = cscale - inc;
+ if (scale < scale_snap_to[0]) {
+ scale = scale_snap_to[0];
+ }
+ }
+ if (scale != cscale) {
+ ro_gui_window_set_scale(g, scale);
}
}
@@ -3233,7 +3268,6 @@ static struct gui_window *gui_window_create(struct
browser_window *bw,
g->active = false;
strcpy(g->title, "NetSurf");
g->iconise_icon = -1;
- g->scale = browser_window_get_scale(bw);
/* Set the window position */
if (existing != NULL &&
@@ -3514,20 +3548,24 @@ static void gui_window_destroy(struct gui_window *g)
*/
static void gui_window_set_title(struct gui_window *g, const char *title)
{
+ float scale;
assert(g);
assert(title);
- if (g->scale != 1.0) {
- int scale_disp = g->scale * 100;
+ scale = browser_window_get_scale(g->bw);
- if (ABS((float)scale_disp - g->scale * 100) >= 0.05)
+ if (scale != 1.0) {
+ int scale_disp = scale * 100;
+
+ if (ABS((float)scale_disp - scale * 100) >= 0.05) {
snprintf(g->title, sizeof g->title, "%s (%.1f%%)",
- title, g->scale * 100);
- else
+ title, scale * 100);
+ } else {
snprintf(g->title, sizeof g->title, "%s (%i%%)",
title, scale_disp);
+ }
} else {
- strncpy(g->title, title, sizeof g->title);
+ strncpy(g->title, title, sizeof(g->title));
}
ro_gui_set_window_title(g->window, g->title);
@@ -3559,10 +3597,11 @@ static bool gui_window_get_scroll(struct gui_window *g,
int *sx, int *sy)
return false;
}
- if (g->toolbar)
+ if (g->toolbar) {
toolbar_height = ro_toolbar_full_height(g->toolbar);
- *sx = state.xscroll / (2 * g->scale);
- *sy = -(state.yscroll - toolbar_height) / (2 * g->scale);
+ }
+ *sx = state.xscroll / 2;
+ *sy = -(state.yscroll - toolbar_height) / 2;
return true;
}
@@ -3601,8 +3640,8 @@ gui_window_set_scroll(struct gui_window *g, const struct
rect *rect)
if ((rect->x0 == rect->x1) && (rect->y0 == rect->y1)) {
/* scroll to top */
- state.xscroll = rect->x0 * 2 * g->scale;
- state.yscroll = (-rect->y0 * 2 * g->scale) + toolbar_height;
+ state.xscroll = rect->x0 * 2;
+ state.yscroll = (-rect->y0 * 2) + toolbar_height;
} else {
/* scroll area into view with padding */
int x0, y0, x1, y1;
@@ -3610,10 +3649,10 @@ gui_window_set_scroll(struct gui_window *g, const
struct rect *rect)
int padding_available;
int correction;
- x0 = rect->x0 * 2 * g->scale;
- y0 = rect->y0 * 2 * g->scale;
- x1 = rect->x1 * 2 * g->scale;
- y1 = rect->y1 * 2 * g->scale;
+ x0 = rect->x0 * 2 ;
+ y0 = rect->y0 * 2 ;
+ x1 = rect->x1 * 2 ;
+ y1 = rect->y1 * 2 ;
cx0 = state.xscroll;
cy0 = -state.yscroll + toolbar_height;
@@ -3912,6 +3951,7 @@ gui_window_drag_start(struct gui_window *g,
{
wimp_pointer pointer;
wimp_drag drag;
+ float scale = browser_window_get_scale(g->bw);
if (rect != NULL) {
/* We have a box to constrain the pointer to, for the drag
@@ -3928,13 +3968,13 @@ gui_window_drag_start(struct gui_window *g,
drag.type = wimp_DRAG_USER_POINT;
drag.bbox.x0 = pointer.pos.x +
- (int)(rect->x0 * 2 * g->scale);
+ (int)(rect->x0 * 2 * scale);
drag.bbox.y0 = pointer.pos.y +
- (int)(rect->y0 * 2 * g->scale);
+ (int)(rect->y0 * 2 * scale);
drag.bbox.x1 = pointer.pos.x +
- (int)(rect->x1 * 2 * g->scale);
+ (int)(rect->x1 * 2 * scale);
drag.bbox.y1 = pointer.pos.y +
- (int)(rect->y1 * 2 * g->scale);
+ (int)(rect->y1 * 2 * scale);
error = xwimp_drag_box(&drag);
if (error) {
@@ -3948,8 +3988,9 @@ gui_window_drag_start(struct gui_window *g,
switch (type) {
case GDRAGGING_SCROLLBAR:
/* Dragging a core scrollbar */
- ro_mouse_drag_start(ro_gui_window_scroll_end,
ro_gui_window_mouse_at,
- NULL, g);
+ ro_mouse_drag_start(ro_gui_window_scroll_end,
+ ro_gui_window_mouse_at,
+ NULL, g);
break;
default:
@@ -4347,7 +4388,6 @@ nserror ro_gui_window_set_url(struct gui_window *g, nsurl
*url)
void ro_gui_window_set_scale(struct gui_window *g, float scale)
{
browser_window_set_scale(g->bw, scale, true);
- g->scale = browser_window_get_scale(g->bw);
}
@@ -4686,17 +4726,19 @@ void ro_gui_throb(void)
/* exported interface documented in riscos/window.h */
void ro_gui_window_default_options(struct gui_window *gui)
{
+ float cscale;
+
if (gui == NULL)
return;
- /* Save the basic options
- */
- nsoption_set_int(scale, gui->scale * 100);
+ cscale = browser_window_get_scale(gui->bw);
+
+ /* Save the basic options */
+ nsoption_set_int(scale, cscale * 100);
nsoption_set_bool(buffer_animations, gui->option.buffer_animations);
nsoption_set_bool(buffer_everything, gui->option.buffer_everything);
- /* Set up the toolbar
- */
+ /* Set up the toolbar */
if (gui->toolbar != NULL) {
nsoption_set_bool(toolbar_show_buttons,
ro_toolbar_get_display_buttons(gui->toolbar));
@@ -4705,9 +4747,10 @@ void ro_gui_window_default_options(struct gui_window
*gui)
nsoption_set_bool(toolbar_show_throbber,
ro_toolbar_get_display_throbber(gui->toolbar));
}
- if (gui->status_bar != NULL)
+ if (gui->status_bar != NULL) {
nsoption_set_int(toolbar_status_size,
ro_gui_status_bar_get_width(gui->status_bar));
+ }
}
@@ -4766,31 +4809,6 @@ ro_gui_window_to_window_pos(struct gui_window *g, int x,
int y, os_coord *pos)
/* exported interface documented in riscos/window.h */
-bool ro_gui_window_to_screen_pos(struct gui_window *g,
- int x,
- int y,
- os_coord *pos)
-{
- wimp_window_state state;
- os_error *error;
-
- assert(g);
-
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s",
- error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
- pos->x = (x * 2 * g->scale) + (state.visible.x0 - state.xscroll);
- pos->y = (state.visible.y1 - state.yscroll) - (y * 2 * g->scale);
- return true;
-}
-
-
-/* exported interface documented in riscos/window.h */
enum browser_mouse_state
ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type)
{
diff --git a/frontends/riscos/window.h b/frontends/riscos/window.h
index 0a5bd43..c3325a7 100644
--- a/frontends/riscos/window.h
+++ b/frontends/riscos/window.h
@@ -192,17 +192,6 @@ bool ro_gui_window_to_window_pos(struct gui_window *g, int
x, int y, os_coord *p
/**
- * Convert x,y window co-ordinates into screen co-ordinates.
- *
- * \param g gui window
- * \param x x ordinate
- * \param y y ordinate
- * \param pos receives position in screen co-ordinatates
- * \return true iff conversion successful
- */
-bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord
*pos);
-
-/**
* Returns the state of the mouse buttons and modifiers keys for a
* mouse action, suitable for passing to the OS-independent
* browser window/ treeview/ etc code.
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org