mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-11 05:19:18 +03:00
replace wallclock API usage with nsutils monitonic time
This commit is contained in:
parent
377652e047
commit
77a1b4b5e0
@ -842,9 +842,11 @@ nserror browser_window_create(enum browser_window_create_flags flags,
|
|||||||
ret->scrolling = BW_SCROLLING_YES;
|
ret->scrolling = BW_SCROLLING_YES;
|
||||||
ret->border = true;
|
ret->border = true;
|
||||||
ret->no_resize = true;
|
ret->no_resize = true;
|
||||||
ret->last_action = wallclock();
|
|
||||||
ret->focus = ret;
|
ret->focus = ret;
|
||||||
|
|
||||||
|
/* initialise last action with creation time */
|
||||||
|
nsu_getmonotonic_ms(&ret->last_action);
|
||||||
|
|
||||||
/* The existing gui_window is on the top-level existing
|
/* The existing gui_window is on the top-level existing
|
||||||
* browser_window. */
|
* browser_window. */
|
||||||
existing = browser_window_get_root(existing);
|
existing = browser_window_get_root(existing);
|
||||||
@ -2079,7 +2081,7 @@ nserror browser_window_navigate(struct browser_window *bw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Record time */
|
/* Record time */
|
||||||
bw->last_action = wallclock();
|
nsu_getmonotonic_ms(&bw->last_action);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -2492,25 +2494,29 @@ void browser_window_set_pointer(struct browser_window *bw,
|
|||||||
struct browser_window *root = browser_window_get_root(bw);
|
struct browser_window *root = browser_window_get_root(bw);
|
||||||
gui_pointer_shape gui_shape;
|
gui_pointer_shape gui_shape;
|
||||||
bool loading;
|
bool loading;
|
||||||
|
uint64_t ms_now;
|
||||||
|
|
||||||
assert(root);
|
assert(root);
|
||||||
assert(root->window);
|
assert(root->window);
|
||||||
|
|
||||||
loading = (bw->loading_content != NULL || (bw->current_content &&
|
loading = ((bw->loading_content != NULL) ||
|
||||||
content_get_status(bw->current_content) ==
|
((bw->current_content != NULL) &&
|
||||||
CONTENT_STATUS_READY));
|
(content_get_status(bw->current_content) == CONTENT_STATUS_READY)));
|
||||||
|
|
||||||
if (wallclock() - bw->last_action < 100 && loading) {
|
nsu_getmonotonic_ms(&ms_now);
|
||||||
|
|
||||||
|
if (loading && ((ms_now - bw->last_action) < 1000)) {
|
||||||
/* If loading and less than 1 second since last link followed,
|
/* If loading and less than 1 second since last link followed,
|
||||||
* force progress indicator pointer */
|
* force progress indicator pointer */
|
||||||
gui_shape = GUI_POINTER_PROGRESS;
|
gui_shape = GUI_POINTER_PROGRESS;
|
||||||
|
|
||||||
} else if (shape == BROWSER_POINTER_AUTO) {
|
} else if (shape == BROWSER_POINTER_AUTO) {
|
||||||
/* Up to browser window to decide */
|
/* Up to browser window to decide */
|
||||||
if (loading)
|
if (loading) {
|
||||||
gui_shape = GUI_POINTER_PROGRESS;
|
gui_shape = GUI_POINTER_PROGRESS;
|
||||||
else
|
} else {
|
||||||
gui_shape = GUI_POINTER_DEFAULT;
|
gui_shape = GUI_POINTER_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Use what we were told */
|
/* Use what we were told */
|
||||||
|
@ -141,7 +141,7 @@ struct browser_window {
|
|||||||
struct browser_window *focus;
|
struct browser_window *focus;
|
||||||
|
|
||||||
/** Last time a link was followed in this window */
|
/** Last time a link was followed in this window */
|
||||||
unsigned int last_action;
|
uint64_t last_action;
|
||||||
|
|
||||||
/** Current selection */
|
/** Current selection */
|
||||||
struct {
|
struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user