From 81cd7ce209d0f460e1e78395bbabe921bad1ad67 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 14 Feb 2009 09:01:49 +0000 Subject: 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 --- framebuffer/fb_frontend_sdl.c | 4 +--- framebuffer/fb_rootwindow.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/framebuffer/fb_frontend_sdl.c b/framebuffer/fb_frontend_sdl.c index 16086c214..dd30f76ca 100644 --- a/framebuffer/fb_frontend_sdl.c +++ b/framebuffer/fb_frontend_sdl.c @@ -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: diff --git a/framebuffer/fb_rootwindow.c b/framebuffer/fb_rootwindow.c index ac86499e7..723237137 100644 --- a/framebuffer/fb_rootwindow.c +++ b/framebuffer/fb_rootwindow.c @@ -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: -- cgit v1.2.3