mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-03-27 09:23:01 +03:00
Make adjust-clicking submit open a new window (fix 1430135)
svn path=/trunk/netsurf/; revision=2716
This commit is contained in:
parent
cd59d27008
commit
a102f34fa6
@ -100,7 +100,7 @@ static void browser_window_scroll_box(struct browser_window *bw,
|
||||
* \param referer The referring uri
|
||||
*/
|
||||
|
||||
void browser_window_create(const char *url, struct browser_window *clone,
|
||||
struct browser_window *browser_window_create(const char *url, struct browser_window *clone,
|
||||
char *referer, bool history_add)
|
||||
{
|
||||
struct browser_window *bw;
|
||||
@ -109,7 +109,7 @@ void browser_window_create(const char *url, struct browser_window *clone,
|
||||
|
||||
if ((bw = malloc(sizeof *bw)) == NULL) {
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bw->current_content = NULL;
|
||||
@ -133,10 +133,12 @@ void browser_window_create(const char *url, struct browser_window *clone,
|
||||
bw->download = false;
|
||||
if ((bw->window = gui_create_browser_window(bw, clone)) == NULL) {
|
||||
free(bw);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
bw->refresh_interval = -1;
|
||||
browser_window_go(bw, url, referer, history_add);
|
||||
if (url)
|
||||
browser_window_go(bw, url, referer, history_add);
|
||||
return bw;
|
||||
}
|
||||
|
||||
|
||||
@ -966,7 +968,10 @@ void browser_window_mouse_action_html(struct browser_window *bw,
|
||||
pointer = GUI_POINTER_POINT;
|
||||
if (mouse & BROWSER_MOUSE_CLICK_1)
|
||||
browser_form_submit(bw, gadget->form,
|
||||
gadget);
|
||||
gadget, false);
|
||||
else if (mouse & BROWSER_MOUSE_CLICK_2)
|
||||
browser_form_submit(bw, gadget->form,
|
||||
gadget, true);
|
||||
} else {
|
||||
status = messages_get("FormBadSubmit");
|
||||
}
|
||||
@ -1887,10 +1892,11 @@ gui_pointer_shape get_pointer_shape(css_cursor cursor)
|
||||
*/
|
||||
|
||||
void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
struct form_control *submit_button)
|
||||
struct form_control *submit_button, bool new_window)
|
||||
{
|
||||
char *data = 0, *url = 0;
|
||||
struct form_successful_control *success;
|
||||
struct browser_window *target;
|
||||
|
||||
assert(form);
|
||||
assert(bw->current_content->type == CONTENT_HTML);
|
||||
@ -1899,6 +1905,15 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_window) {
|
||||
target = browser_window_create(NULL, bw, NULL, true);
|
||||
/* any error has already been reported */
|
||||
if (!target)
|
||||
return;
|
||||
} else {
|
||||
target = bw;
|
||||
}
|
||||
|
||||
switch (form->method) {
|
||||
case method_GET:
|
||||
@ -1911,6 +1926,7 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
url = calloc(1, strlen(form->action) + strlen(data) + 2);
|
||||
if (!url) {
|
||||
form_free_successful(success);
|
||||
free(data);
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
@ -1920,7 +1936,7 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
else {
|
||||
sprintf(url, "%s?%s", form->action, data);
|
||||
}
|
||||
browser_window_go(bw, url, bw->current_content->url,
|
||||
browser_window_go(target, url, bw->current_content->url,
|
||||
true);
|
||||
break;
|
||||
|
||||
@ -1931,13 +1947,13 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
warn_user("NoMemory", 0);
|
||||
return;
|
||||
}
|
||||
browser_window_go_post(bw, form->action, data, 0,
|
||||
browser_window_go_post(target, form->action, data, 0,
|
||||
true, bw->current_content->url,
|
||||
false);
|
||||
break;
|
||||
|
||||
case method_POST_MULTIPART:
|
||||
browser_window_go_post(bw, form->action, 0, success,
|
||||
browser_window_go_post(target, form->action, 0, success,
|
||||
true, bw->current_content->url,
|
||||
false);
|
||||
break;
|
||||
|
@ -123,8 +123,8 @@ typedef enum {
|
||||
|
||||
extern struct browser_window *current_redraw_browser;
|
||||
|
||||
void browser_window_create(const char *url, struct browser_window *clone,
|
||||
char *referer, bool history_add);
|
||||
struct browser_window * browser_window_create(const char *url,
|
||||
struct browser_window *clone, char *referer, bool history_add);
|
||||
void browser_window_go(struct browser_window *bw, const char *url,
|
||||
char *referer, bool history_add);
|
||||
void browser_window_go_post(struct browser_window *bw, const char *url,
|
||||
@ -150,7 +150,7 @@ void browser_window_form_select(struct browser_window *bw,
|
||||
struct form_control *control, int item);
|
||||
void browser_redraw_box(struct content *c, struct box *box);
|
||||
void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
struct form_control *submit_button);
|
||||
struct form_control *submit_button, bool new_window);
|
||||
|
||||
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
||||
int width, int height);
|
||||
|
@ -922,7 +922,7 @@ void browser_window_input_callback(struct browser_window *bw,
|
||||
case 10:
|
||||
case 13: /* Return/Enter hit */
|
||||
if (form)
|
||||
browser_form_submit(bw, form, 0);
|
||||
browser_form_submit(bw, form, 0, false);
|
||||
return;
|
||||
|
||||
case 11: { /* Shift + Tab */
|
||||
|
@ -1352,8 +1352,12 @@ void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer)
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_state: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
/*
|
||||
* the WIMP sometimes fails to realise the pointer has left a NetSurf window
|
||||
* so we get an error -- there is no gain from telling the user about this
|
||||
*
|
||||
* warn_user("WimpError", error->errmess);
|
||||
*/ return;
|
||||
}
|
||||
|
||||
x = window_x_units(pointer->pos.x, &state) / 2 / g->option.scale;
|
||||
|
Loading…
x
Reference in New Issue
Block a user