Move browser window related control over mouse pointer out of html content handler.

This commit is contained in:
Michael Drake 2012-08-16 22:44:25 +01:00
parent 35fd2ad7f2
commit d9bd357802
2 changed files with 19 additions and 19 deletions

View File

@ -1924,14 +1924,29 @@ void browser_window_set_pointer(struct browser_window *bw,
{
struct browser_window *root = browser_window_get_root(bw);
gui_pointer_shape gui_shape;
bool loading;
assert(root);
assert(root->window);
if (shape == BROWSER_POINTER_AUTO) {
gui_shape = GUI_POINTER_DEFAULT;
loading = (bw->loading_content != NULL || (bw->current_content &&
content_get_status(bw->current_content) ==
CONTENT_STATUS_READY));
if (wallclock() - bw->last_action < 100 && loading) {
/* If loading and less than 1 second since last link followed,
* force progress indicator pointer */
gui_shape = GUI_POINTER_PROGRESS;
} else if (shape == BROWSER_POINTER_AUTO) {
/* Up to browser window to decide */
if (loading)
gui_shape = GUI_POINTER_PROGRESS;
else
gui_shape = GUI_POINTER_DEFAULT;
} else {
/* Use what we were told */
gui_shape = (gui_pointer_shape)shape;
}

View File

@ -731,19 +731,9 @@ browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *b
css_computed_style *style;
enum css_cursor_e cursor;
lwc_string **cursor_uris;
bool loading;
assert(bw);
loading = (bw->loading_content != NULL || (bw->current_content &&
content_get_status(bw->current_content) ==
CONTENT_STATUS_READY));
if (wallclock() - bw->last_action < 100 && loading)
/* If less than 1 second since last link followed, show
* progress indicating pointer and we're loading something */
return BROWSER_POINTER_PROGRESS;
if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT)
style = box->children->style;
else
@ -769,13 +759,8 @@ browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *b
/* text input */
pointer = BROWSER_POINTER_CARET;
} else {
/* anything else */
if (loading) {
/* loading new content */
pointer = BROWSER_POINTER_PROGRESS;
} else {
pointer = BROWSER_POINTER_DEFAULT;
}
/* html content doesn't mind */
pointer = BROWSER_POINTER_AUTO;
}
break;
case CSS_CURSOR_CROSSHAIR: