mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-03 19:31:55 +03:00
[project @ 2005-04-18 11:52:26 by adrianl]
Ignore save drags from browser window that remain within window svn path=/import/netsurf/; revision=1667
This commit is contained in:
parent
b75fd1a26b
commit
b72b5032bf
@ -694,9 +694,9 @@ void browser_window_mouse_click(struct browser_window *bw,
|
||||
default:
|
||||
if (mouse & BROWSER_MOUSE_MOD_2) {
|
||||
if (mouse & BROWSER_MOUSE_DRAG_2)
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, c);
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, c, bw->window);
|
||||
else if (mouse & BROWSER_MOUSE_DRAG_1)
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, c);
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, c, bw->window);
|
||||
}
|
||||
else if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) {
|
||||
browser_window_page_drag_start(bw, x, y);
|
||||
@ -893,9 +893,9 @@ void browser_window_mouse_action_html(struct browser_window *bw,
|
||||
} else if (object && (mouse & BROWSER_MOUSE_MOD_2)) {
|
||||
|
||||
if (mouse & BROWSER_MOUSE_DRAG_2)
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, object);
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, object, bw->window);
|
||||
else if (mouse & BROWSER_MOUSE_DRAG_1)
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, object);
|
||||
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, object, bw->window);
|
||||
|
||||
/* \todo should have a drag-saving object msg */
|
||||
status = c->status_message;
|
||||
@ -954,7 +954,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
|
||||
|
||||
if (mouse & BROWSER_MOUSE_DRAG_1) {
|
||||
if (mouse & BROWSER_MOUSE_MOD_2) {
|
||||
gui_drag_save_object(GUI_SAVE_COMPLETE, c);
|
||||
gui_drag_save_object(GUI_SAVE_COMPLETE, c, bw->window);
|
||||
}
|
||||
else {
|
||||
browser_window_page_drag_start(bw, x, y);
|
||||
@ -963,7 +963,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
|
||||
}
|
||||
else if (mouse & BROWSER_MOUSE_DRAG_2) {
|
||||
if (mouse & BROWSER_MOUSE_MOD_2) {
|
||||
gui_drag_save_object(GUI_SAVE_SOURCE, c);
|
||||
gui_drag_save_object(GUI_SAVE_SOURCE, c, bw->window);
|
||||
}
|
||||
else {
|
||||
browser_window_page_drag_start(bw, x, y);
|
||||
@ -997,8 +997,8 @@ void browser_window_mouse_track(struct browser_window *bw,
|
||||
struct content *c = bw->current_content;
|
||||
if (!c) return;
|
||||
|
||||
/* detect end of drag operation in case the platform specific
|
||||
code doesn't call browser_mouse_drag_end() */
|
||||
/* detect end of drag operation in case the platform-specific code
|
||||
doesn't call browser_mouse_drag_end() (RISC OS code does) */
|
||||
|
||||
if (bw->drag_type != DRAGGING_NONE && !mouse) {
|
||||
browser_window_mouse_drag_end(bw, mouse, x, y);
|
||||
|
@ -80,8 +80,9 @@ void gui_download_window_error(struct gui_download_window *dw,
|
||||
const char *error_msg);
|
||||
void gui_download_window_done(struct gui_download_window *dw);
|
||||
|
||||
void gui_drag_save_object(gui_save_type type, struct content *c);
|
||||
void gui_drag_save_selection(struct selection *s);
|
||||
void gui_drag_save_object(gui_save_type type, struct content *c,
|
||||
struct gui_window *g);
|
||||
void gui_drag_save_selection(struct selection *s, struct gui_window *g);
|
||||
void gui_start_selection(struct gui_window *g);
|
||||
|
||||
bool gui_copy_to_clipboard(struct selection *s);
|
||||
|
@ -226,7 +226,8 @@ bool selection_click(struct selection *s, struct box *box,
|
||||
if (!pos && (mouse & BROWSER_MOUSE_MOD_2) &&
|
||||
(mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2))) {
|
||||
/* drag-saving selection */
|
||||
gui_drag_save_selection(s);
|
||||
assert(s->bw);
|
||||
gui_drag_save_selection(s, s->bw->window);
|
||||
}
|
||||
else if (!modkeys) {
|
||||
if (mouse & BROWSER_MOUSE_DRAG_1) {
|
||||
|
@ -42,7 +42,8 @@ static struct selection *gui_save_selection = NULL;
|
||||
static int gui_save_filetype;
|
||||
|
||||
static bool using_dragasprite = true;
|
||||
static wimp_w gui_save_dialogw = (wimp_w)-1;
|
||||
static bool saving_from_dialog = true;
|
||||
static wimp_w gui_save_sourcew = (wimp_w)-1;
|
||||
|
||||
typedef enum { LINK_ACORN, LINK_ANT, LINK_TEXT } link_format;
|
||||
|
||||
@ -124,6 +125,8 @@ void ro_gui_save_prepare(gui_save_type save_type, struct content *c)
|
||||
|
||||
/**
|
||||
* Handle clicks in the save dialog.
|
||||
*
|
||||
* \param pointer mouse position info from Wimp
|
||||
*/
|
||||
|
||||
void ro_gui_save_click(wimp_pointer *pointer)
|
||||
@ -134,17 +137,18 @@ void ro_gui_save_click(wimp_pointer *pointer)
|
||||
break;
|
||||
case ICON_SAVE_CANCEL:
|
||||
if (pointer->buttons == wimp_CLICK_SELECT) {
|
||||
xwimp_create_menu((wimp_menu *)-1, 0, 0);
|
||||
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
ro_gui_dialog_close(pointer->w);
|
||||
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
|
||||
/* ro_gui_menu_prepare_save(gui_save_content); */
|
||||
ro_gui_save_prepare(gui_save_current_type, gui_save_content);
|
||||
}
|
||||
break;
|
||||
case ICON_SAVE_ICON:
|
||||
if (pointer->buttons == wimp_DRAG_SELECT) {
|
||||
const char *sprite = ro_gui_get_icon_string(pointer->w, pointer->i);
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
gui_save_dialogw = pointer->w;
|
||||
gui_save_sourcew = pointer->w;
|
||||
saving_from_dialog = true;
|
||||
ro_gui_drag_icon(pointer->pos.x, pointer->pos.y, sprite);
|
||||
}
|
||||
break;
|
||||
@ -154,6 +158,8 @@ void ro_gui_save_click(wimp_pointer *pointer)
|
||||
|
||||
/**
|
||||
* Handle OK click/keypress in the save dialog.
|
||||
*
|
||||
* \param w window handle of save dialog
|
||||
*/
|
||||
|
||||
void ro_gui_save_ok(wimp_w w)
|
||||
@ -164,9 +170,10 @@ void ro_gui_save_ok(wimp_w w)
|
||||
warn_user("NoPathError", NULL);
|
||||
return;
|
||||
}
|
||||
gui_save_dialogw = w;
|
||||
gui_save_sourcew = w;
|
||||
saving_from_dialog = true;
|
||||
if (ro_gui_save_content(gui_save_content, name)) {
|
||||
xwimp_create_menu((wimp_menu *)-1, 0, 0);
|
||||
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
ro_gui_dialog_close(w);
|
||||
}
|
||||
}
|
||||
@ -177,9 +184,11 @@ void ro_gui_save_ok(wimp_w w)
|
||||
*
|
||||
* \param save_type type of save
|
||||
* \param c content to save
|
||||
* \param g gui window
|
||||
*/
|
||||
|
||||
void gui_drag_save_object(gui_save_type save_type, struct content *c)
|
||||
void gui_drag_save_object(gui_save_type save_type, struct content *c,
|
||||
struct gui_window *g)
|
||||
{
|
||||
wimp_pointer pointer;
|
||||
char icon_buf[20];
|
||||
@ -188,10 +197,11 @@ void gui_drag_save_object(gui_save_type save_type, struct content *c)
|
||||
|
||||
/* Close the save window because otherwise we need two contexts
|
||||
*/
|
||||
if (gui_save_dialogw != (wimp_w)-1)
|
||||
ro_gui_dialog_close(gui_save_dialogw);
|
||||
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
ro_gui_dialog_close(dialog_saveas);
|
||||
|
||||
gui_save_dialogw = (wimp_w)-1;
|
||||
gui_save_sourcew = g->window;
|
||||
saving_from_dialog = false;
|
||||
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
if (error) {
|
||||
@ -218,7 +228,14 @@ void gui_drag_save_object(gui_save_type save_type, struct content *c)
|
||||
}
|
||||
|
||||
|
||||
void gui_drag_save_selection(struct selection *s)
|
||||
/**
|
||||
* Initiates drag saving of a selection from a browser window
|
||||
*
|
||||
* \param s selection object
|
||||
* \param g gui window
|
||||
*/
|
||||
|
||||
void gui_drag_save_selection(struct selection *s, struct gui_window *g)
|
||||
{
|
||||
wimp_pointer pointer;
|
||||
char icon_buf[20];
|
||||
@ -227,10 +244,11 @@ void gui_drag_save_selection(struct selection *s)
|
||||
|
||||
/* Close the save window because otherwise we need two contexts
|
||||
*/
|
||||
if (gui_save_dialogw != (wimp_w)-1)
|
||||
ro_gui_dialog_close(gui_save_dialogw);
|
||||
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
ro_gui_dialog_close(dialog_saveas);
|
||||
|
||||
gui_save_dialogw = (wimp_w)-1;
|
||||
gui_save_sourcew = g->window;
|
||||
saving_from_dialog = false;
|
||||
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
if (error) {
|
||||
@ -323,10 +341,15 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gui_save_dialogw == (wimp_w)-1) {
|
||||
/* ignore drags that remain within the source window */
|
||||
if (gui_save_sourcew != (wimp_w)-1 && pointer.w == gui_save_sourcew)
|
||||
return;
|
||||
|
||||
if (!saving_from_dialog) {
|
||||
/* saving directly from browser window, choose a name based upon the URL */
|
||||
struct content *c = gui_save_content;
|
||||
const char *nice;
|
||||
|
||||
name = gui_save_table[gui_save_current_type].name;
|
||||
if (c) {
|
||||
url_func_result res;
|
||||
@ -337,11 +360,8 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
|
||||
else {
|
||||
char *dot;
|
||||
|
||||
/* ignore drags to the saveas window itself */
|
||||
if (pointer.w == gui_save_dialogw) return;
|
||||
|
||||
/* saving from dialog, grab leafname from icon */
|
||||
name = ro_gui_get_icon_string(gui_save_dialogw, ICON_SAVE_PATH);
|
||||
name = ro_gui_get_icon_string(gui_save_sourcew, ICON_SAVE_PATH);
|
||||
dot = strrchr(name, '.');
|
||||
if (dot)
|
||||
name = dot + 1;
|
||||
@ -387,8 +407,8 @@ void ro_gui_send_datasave(gui_save_type save_type, const wimp_full_message_data_
|
||||
|
||||
/* Close the save window because otherwise we need two contexts
|
||||
*/
|
||||
if (gui_save_dialogw != (wimp_w)-1)
|
||||
ro_gui_dialog_close(gui_save_dialogw);
|
||||
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
ro_gui_dialog_close(dialog_saveas);
|
||||
|
||||
error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)message, to);
|
||||
if (error) {
|
||||
@ -397,7 +417,8 @@ void ro_gui_send_datasave(gui_save_type save_type, const wimp_full_message_data_
|
||||
}
|
||||
else {
|
||||
gui_save_current_type = save_type;
|
||||
gui_save_dialogw = (wimp_w)-1;
|
||||
gui_save_sourcew = (wimp_w)-1;
|
||||
saving_from_dialog = false;
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
}
|
||||
}
|
||||
@ -427,18 +448,12 @@ void ro_gui_save_datasave_ack(wimp_message *message)
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui_save_dialogw != (wimp_w)-1)
|
||||
ro_gui_set_icon_string(gui_save_dialogw, ICON_SAVE_PATH, path);
|
||||
if (saving_from_dialog)
|
||||
ro_gui_set_icon_string(gui_save_sourcew, ICON_SAVE_PATH, path);
|
||||
|
||||
if (ro_gui_save_content(c, path)) {
|
||||
os_error *error;
|
||||
|
||||
if (gui_save_dialogw != (wimp_w)-1) {
|
||||
/* Close the save window
|
||||
*/
|
||||
ro_gui_dialog_close(gui_save_dialogw);
|
||||
}
|
||||
|
||||
/* Ack successful save with message_DATA_LOAD */
|
||||
message->action = message_DATA_LOAD;
|
||||
message->your_ref = message->my_ref;
|
||||
@ -450,6 +465,8 @@ void ro_gui_save_datasave_ack(wimp_message *message)
|
||||
warn_user("SaveError", error->errmess);
|
||||
}
|
||||
|
||||
/* Close the save window */
|
||||
ro_gui_dialog_close(dialog_saveas);
|
||||
error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
||||
if (error) {
|
||||
LOG(("xwimp_create_menu: 0x%x: %s",
|
||||
|
Loading…
Reference in New Issue
Block a user