mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-27 12:49:32 +03:00
A few usability tweaks
svn path=/trunk/netsurf/; revision=5922
This commit is contained in:
parent
a673ad21ee
commit
327606f0fd
@ -103,12 +103,13 @@ bool artworks_convert(struct content *c, int width, int height)
|
||||
void *init_workspace;
|
||||
void *init_routine;
|
||||
os_error *error;
|
||||
int used;
|
||||
int used = -1; /* slightly better with older OSLib versions */
|
||||
|
||||
/* check whether AWViewer has been seen and we can therefore
|
||||
locate the ArtWorks rendering modules */
|
||||
if (xos_read_var_val_size("Alias$LoadArtWorksModules", 0, os_VARTYPE_STRING,
|
||||
&used, NULL, NULL) || used >= 0) {
|
||||
xos_read_var_val_size("Alias$LoadArtWorksModules", 0, os_VARTYPE_STRING,
|
||||
&used, NULL, NULL);
|
||||
if (used >= 0) {
|
||||
LOG(("Alias$LoadArtWorksModules not defined"));
|
||||
msg_data.error = messages_get("AWNotSeen");
|
||||
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
||||
|
@ -650,8 +650,8 @@ void ro_gui_dialog_close_persistent(wimp_w parent) {
|
||||
for (i = 0; i < MAX_PERSISTENT; i++) {
|
||||
if (persistent_dialog[i].parent == parent &&
|
||||
persistent_dialog[i].dialog != NULL) {
|
||||
ro_gui_dialog_close(persistent_dialog[i].dialog);
|
||||
ro_gui_wimp_event_close_window(persistent_dialog[i].dialog);
|
||||
if (!ro_gui_wimp_event_close_window(persistent_dialog[i].dialog))
|
||||
ro_gui_dialog_close(persistent_dialog[i].dialog);
|
||||
persistent_dialog[i].parent = NULL;
|
||||
persistent_dialog[i].dialog = NULL;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ void ro_gui_download_update_status(struct gui_download_window *dw)
|
||||
sprintf(time, "%u:%.2u", left / 60, left % 60);
|
||||
speed = human_friendly_bytesize(rate);
|
||||
|
||||
err = utf8_to_local_encoding(messages_get("DownloadU"), 0,
|
||||
err = utf8_to_local_encoding(messages_get("Downloaded"), 0,
|
||||
&local_status);
|
||||
if (err != UTF8_CONVERT_OK) {
|
||||
/* badenc should never happen */
|
||||
|
17
riscos/gui.c
17
riscos/gui.c
@ -961,7 +961,7 @@ void gui_poll(bool active)
|
||||
gui_last_poll = clock();
|
||||
ro_gui_handle_event(event, &block);
|
||||
schedule_run();
|
||||
ro_gui_window_update_boxes();
|
||||
ro_gui_window_update_boxes();
|
||||
|
||||
if (browser_reformat_pending && event == wimp_NULL_REASON_CODE)
|
||||
ro_gui_window_process_reformats();
|
||||
@ -1136,9 +1136,13 @@ void ro_gui_open_window_request(wimp_open *open)
|
||||
|
||||
void ro_gui_close_window_request(wimp_close *close)
|
||||
{
|
||||
if (ro_gui_wimp_event_close_window(close->w))
|
||||
return;
|
||||
ro_gui_dialog_close(close->w);
|
||||
if (ro_gui_alt_pressed())
|
||||
ro_gui_window_close_all();
|
||||
else {
|
||||
if (ro_gui_wimp_event_close_window(close->w))
|
||||
return;
|
||||
ro_gui_dialog_close(close->w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2003,7 +2007,10 @@ void ro_msg_window_info(wimp_message *message)
|
||||
g = ro_gui_window_lookup(wi->w);
|
||||
|
||||
/* ic_<task name> will suffice for our other windows */
|
||||
if (g) ro_gui_window_iconise(g, wi);
|
||||
if (g) {
|
||||
ro_gui_window_iconise(g, wi);
|
||||
ro_gui_dialog_close_persistent(wi->w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,6 +146,8 @@ void ro_gui_cert_open(struct tree *tree, struct node *node);
|
||||
|
||||
/* in window.c */
|
||||
void ro_gui_window_quit(void);
|
||||
/* void ro_gui_window_close_all(void); */
|
||||
#define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */
|
||||
void ro_gui_window_update_theme(void);
|
||||
void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer);
|
||||
bool ro_gui_toolbar_click(wimp_pointer *pointer);
|
||||
@ -166,6 +168,7 @@ void ro_gui_window_prepare_navigate_all(void);
|
||||
browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons);
|
||||
bool ro_gui_shift_pressed(void);
|
||||
bool ro_gui_ctrl_pressed(void);
|
||||
bool ro_gui_alt_pressed(void);
|
||||
void ro_gui_window_scroll_end(struct gui_window *g, wimp_dragged *drag);
|
||||
void ro_gui_window_frame_resize_end(struct gui_window *g, wimp_dragged *drag);
|
||||
void ro_gui_window_iconise(struct gui_window *g,
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "desktop/save_text.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "image/bitmap.h"
|
||||
#include "render/box.h"
|
||||
#include "render/form.h"
|
||||
#include "riscos/dialog.h"
|
||||
#include "riscos/gui.h"
|
||||
#include "riscos/menus.h"
|
||||
@ -65,7 +67,7 @@ static struct content *gui_save_content = NULL;
|
||||
static struct selection *gui_save_selection = NULL;
|
||||
static int gui_save_filetype;
|
||||
|
||||
static bool dragbox_active = false; /** there is a Wimp_DragBox or DragASprite call in progress */
|
||||
static bool dragbox_active = false; /** in-progress Wimp_DragBox/DragASprite op */
|
||||
static bool using_dragasprite = true;
|
||||
static bool saving_from_dialog = true;
|
||||
static osspriteop_area *saveas_area = NULL;
|
||||
@ -486,11 +488,56 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ignore drags that remain within the source window */
|
||||
/* perform hit-test if the destination is the same as the source window;
|
||||
we want to allow drag-saving from a page into the input fields within
|
||||
the page, but avoid accidental replacements of the current page */
|
||||
if (gui_save_sourcew != (wimp_w)-1 && pointer.w == gui_save_sourcew) {
|
||||
/* cancel the drag operation */
|
||||
gui_current_drag_type = GUI_DRAG_NONE;
|
||||
return;
|
||||
int dx = (drag->final.x1 + drag->final.x0)/2;
|
||||
int dy = (drag->final.y1 + drag->final.y0)/2;
|
||||
struct gui_window *g;
|
||||
bool dest_ok = false;
|
||||
os_coord pos;
|
||||
|
||||
g = ro_gui_window_lookup(gui_save_sourcew);
|
||||
|
||||
if (g && ro_gui_window_to_window_pos(g, dx, dy, &pos)) {
|
||||
struct content *content = g->bw->current_content;
|
||||
|
||||
if (content && content->type == CONTENT_HTML) {
|
||||
struct box *box = content->data.html.layout;
|
||||
int box_x, box_y;
|
||||
|
||||
/* Consider the margins of the html page now */
|
||||
box_x = box->margin[LEFT];
|
||||
box_y = box->margin[TOP];
|
||||
|
||||
while (!dest_ok && (box = box_at_point(box, pos.x, pos.y,
|
||||
&box_x, &box_y, &content))) {
|
||||
if (box->style &&
|
||||
box->style->visibility == CSS_VISIBILITY_HIDDEN)
|
||||
continue;
|
||||
|
||||
if (box->gadget) {
|
||||
switch (box->gadget->type) {
|
||||
case GADGET_FILE:
|
||||
case GADGET_TEXTBOX:
|
||||
case GADGET_TEXTAREA:
|
||||
case GADGET_PASSWORD:
|
||||
dest_ok = true;
|
||||
break;
|
||||
|
||||
default: /* appease compiler */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dest_ok) {
|
||||
/* cancel the drag operation */
|
||||
gui_current_drag_type = GUI_DRAG_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!saving_from_dialog) {
|
||||
@ -550,7 +597,8 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
|
||||
* clipboard contents we're being asked for when the DataSaveAck reply arrives
|
||||
*/
|
||||
|
||||
void ro_gui_send_datasave(gui_save_type save_type, wimp_full_message_data_xfer *message, wimp_t to)
|
||||
void ro_gui_send_datasave(gui_save_type save_type,
|
||||
wimp_full_message_data_xfer *message, wimp_t to)
|
||||
{
|
||||
/* Close the save window because otherwise we need two contexts
|
||||
*/
|
||||
@ -1017,7 +1065,7 @@ void ro_gui_save_set_state(struct content *c, gui_save_type save_type,
|
||||
|
||||
error = ro_gui_wimp_get_sprite(icon_buf, &sprite);
|
||||
if (error && error->errnum == error_SPRITE_OP_DOESNT_EXIST) {
|
||||
/* try the 'unknown' filetype sprite has a fallback */
|
||||
/* try the 'unknown' filetype sprite as a fallback */
|
||||
memcpy(icon_buf, "file_xxx", 9);
|
||||
error = ro_gui_wimp_get_sprite(icon_buf, &sprite);
|
||||
}
|
||||
|
@ -1921,6 +1921,7 @@ void ro_gui_window_close(wimp_w w) {
|
||||
char *temp_name, *r;
|
||||
char *filename;
|
||||
struct content *content = NULL;
|
||||
bool destroy;
|
||||
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
if (error) {
|
||||
@ -1932,6 +1933,7 @@ void ro_gui_window_close(wimp_w w) {
|
||||
if (g->bw)
|
||||
content = g->bw->current_content;
|
||||
if (pointer.buttons & wimp_CLICK_ADJUST) {
|
||||
destroy = !ro_gui_shift_pressed();
|
||||
filename = (content && content->url) ? url_to_path(content->url) : NULL;
|
||||
if (filename) {
|
||||
temp_name = malloc(strlen(filename) + 32);
|
||||
@ -1957,11 +1959,14 @@ void ro_gui_window_close(wimp_w w) {
|
||||
free(filename);
|
||||
} else {
|
||||
/* this is pointless if we are about to close the window */
|
||||
if (ro_gui_shift_pressed())
|
||||
if (!destroy)
|
||||
ro_gui_menu_handle_action(w, BROWSER_NAVIGATE_UP, true);
|
||||
}
|
||||
}
|
||||
if (!ro_gui_shift_pressed())
|
||||
else
|
||||
destroy = true;
|
||||
|
||||
if (destroy)
|
||||
browser_window_destroy(g->bw);
|
||||
}
|
||||
|
||||
@ -2770,12 +2775,12 @@ bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *p
|
||||
|
||||
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
|
||||
{
|
||||
int box_x = 0, box_y = 0;
|
||||
struct box *box;
|
||||
struct box *file_box = 0;
|
||||
struct box *text_box = 0;
|
||||
struct browser_window *bw = g->bw;
|
||||
struct content *content;
|
||||
int box_x, box_y;
|
||||
os_error *error;
|
||||
os_coord pos;
|
||||
|
||||
@ -2793,6 +2798,11 @@ bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
|
||||
|
||||
content = bw->current_content;
|
||||
box = content->data.html.layout;
|
||||
|
||||
/* Consider the margins of the html page now */
|
||||
box_x = box->margin[LEFT];
|
||||
box_y = box->margin[TOP];
|
||||
|
||||
while ((box = box_at_point(box, pos.x, pos.y, &box_x, &box_y, &content))) {
|
||||
if (box->style &&
|
||||
box->style->visibility == CSS_VISIBILITY_HIDDEN)
|
||||
@ -3095,6 +3105,18 @@ bool ro_gui_ctrl_pressed(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true iff one or more Alt keys is held down
|
||||
*/
|
||||
|
||||
bool ro_gui_alt_pressed(void)
|
||||
{
|
||||
int alt = 0;
|
||||
xosbyte1(osbyte_SCAN_KEYBOARD, 2 ^ 0x80, 0, &alt);
|
||||
return (alt == 0xff);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Completes scrolling of a browser window
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user