Fix imagemap cursors.

svn path=/trunk/netsurf/; revision=6584
This commit is contained in:
Michael Drake 2009-02-20 19:34:40 +00:00
parent b7fcefc2f5
commit dd6031d297

View File

@ -116,7 +116,7 @@ static const char *browser_window_scrollbar_click(struct browser_window *bw,
int box_x, int box_y, int x, int y); int box_x, int box_y, int x, int y);
static void browser_radio_set(struct content *content, static void browser_radio_set(struct content *content,
struct form_control *radio); struct form_control *radio);
static gui_pointer_shape get_pointer_shape(struct box *box); static gui_pointer_shape get_pointer_shape(struct box *box, bool imagemap);
static bool browser_window_nearer_text_box(struct box *box, int bx, int by, static bool browser_window_nearer_text_box(struct box *box, int bx, int by,
int x, int y, int dir, struct box **nearest, int *tx, int *ty, int x, int y, int dir, struct box **nearest, int *tx, int *ty,
int *nr_xd, int *nr_yd); int *nr_xd, int *nr_yd);
@ -1345,6 +1345,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
char status_buffer[200]; char status_buffer[200];
const char *status = 0; const char *status = 0;
gui_pointer_shape pointer = GUI_POINTER_DEFAULT; gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
bool imagemap = false;
int box_x = 0, box_y = 0; int box_x = 0, box_y = 0;
int gadget_box_x = 0, gadget_box_y = 0; int gadget_box_x = 0, gadget_box_y = 0;
int scroll_box_x = 0, scroll_box_y = 0; int scroll_box_x = 0, scroll_box_y = 0;
@ -1392,9 +1393,14 @@ void browser_window_mouse_action_html(struct browser_window *bw,
url_box = box; url_box = box;
} }
if (box->usemap) if (box->usemap) {
url = imagemap_get(content, box->usemap, url = imagemap_get(content, box->usemap,
box_x, box_y, x, y, &target); box_x, box_y, x, y, &target);
if (url) {
imagemap = true;
url_box = box;
}
}
if (box->gadget) { if (box->gadget) {
gadget_content = content; gadget_content = content;
@ -1411,7 +1417,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
title = box->title; title = box->title;
if (box->style && box->style->cursor != CSS_CURSOR_UNKNOWN) if (box->style && box->style->cursor != CSS_CURSOR_UNKNOWN)
pointer = get_pointer_shape(box); pointer = get_pointer_shape(box, false);
if (box->style && box->type != BOX_BR && if (box->style && box->type != BOX_BR &&
box->type != BOX_INLINE && box->type != BOX_INLINE &&
@ -1476,7 +1482,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
messages_get("FormSubmit"), messages_get("FormSubmit"),
gadget->form->action); gadget->form->action);
status = status_buffer; status = status_buffer;
pointer = get_pointer_shape(gadget_box); pointer = get_pointer_shape(gadget_box, false);
if (mouse & (BROWSER_MOUSE_CLICK_1 | if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2)) BROWSER_MOUSE_CLICK_2))
action = ACTION_SUBMIT; action = ACTION_SUBMIT;
@ -1486,7 +1492,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
break; break;
case GADGET_TEXTAREA: case GADGET_TEXTAREA:
status = messages_get("FormTextarea"); status = messages_get("FormTextarea");
pointer = get_pointer_shape(gadget_box); pointer = get_pointer_shape(gadget_box, false);
if (mouse & (BROWSER_MOUSE_PRESS_1 | if (mouse & (BROWSER_MOUSE_PRESS_1 |
BROWSER_MOUSE_PRESS_2)) { BROWSER_MOUSE_PRESS_2)) {
@ -1529,7 +1535,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
case GADGET_TEXTBOX: case GADGET_TEXTBOX:
case GADGET_PASSWORD: case GADGET_PASSWORD:
status = messages_get("FormTextbox"); status = messages_get("FormTextbox");
pointer = get_pointer_shape(gadget_box); pointer = get_pointer_shape(gadget_box, false);
if ((mouse & BROWSER_MOUSE_PRESS_1) && if ((mouse & BROWSER_MOUSE_PRESS_1) &&
!(mouse & (BROWSER_MOUSE_MOD_1 | !(mouse & (BROWSER_MOUSE_MOD_1 |
@ -1599,7 +1605,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
} else } else
status = url; status = url;
pointer = get_pointer_shape(url_box); pointer = get_pointer_shape(url_box, imagemap);
if (mouse & BROWSER_MOUSE_CLICK_1 && if (mouse & BROWSER_MOUSE_CLICK_1 &&
mouse & BROWSER_MOUSE_MOD_1) { mouse & BROWSER_MOUSE_MOD_1) {
@ -2380,7 +2386,7 @@ void browser_window_form_select(struct browser_window *bw,
} }
gui_pointer_shape get_pointer_shape(struct box *box) gui_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
{ {
gui_pointer_shape pointer; gui_pointer_shape pointer;
struct css_style *style; struct css_style *style;
@ -2395,7 +2401,8 @@ gui_pointer_shape get_pointer_shape(struct box *box)
case CSS_CURSOR_AUTO: case CSS_CURSOR_AUTO:
if (box->href || (box->gadget && if (box->href || (box->gadget &&
(box->gadget->type == GADGET_IMAGE || (box->gadget->type == GADGET_IMAGE ||
box->gadget->type == GADGET_SUBMIT))) box->gadget->type == GADGET_SUBMIT)) ||
imagemap)
/* link */ /* link */
pointer = GUI_POINTER_POINT; pointer = GUI_POINTER_POINT;
else if (box->gadget && else if (box->gadget &&