move mouse movement handling to common place and make it cope with

passing movement to browser window if inside

svn path=/trunk/netsurf/; revision=6475
This commit is contained in:
Vincent Sanders 2009-02-14 09:01:49 +00:00
parent ce23bb867b
commit 81cd7ce209
2 changed files with 24 additions and 3 deletions

View File

@ -139,9 +139,7 @@ void fb_os_input(struct gui_window *g, bool active)
break;
case SDL_MOUSEMOTION:
fb_cursor_move_abs(framebuffer,
event.motion.x,
event.motion.y);
fb_rootwindow_move_abs(framebuffer, g, event.motion.x, event.motion.y);
break;
case SDL_MOUSEBUTTONDOWN:

View File

@ -425,6 +425,29 @@ fb_rootwindow_click(struct gui_window *g, browser_mouse_state st, int x, int y)
}
void
fb_rootwindow_move_abs(framebuffer_t *fb, struct gui_window *g, int x, int y)
{
struct fb_widget *widget;
fb_cursor_move_abs(fb, x, y);
widget = widget_list;
while (widget != NULL) {
if ((x > widget->x) &&
(y > widget->y) &&
(x < widget->x + widget->width) &&
(y < widget->y + widget->height)) {
if (widget->g == g) {
browser_window_mouse_track(g->bw, 0, x - widget->x, y - widget->y);
break;
}
}
widget = widget->next;
}
}
/*
* Local Variables: