summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2010-12-04 14:24:53 +0000
committerVincent Sanders <vince@netsurf-browser.org>2010-12-04 14:24:53 +0000
commit4cf27ef3387e52676483b4272072acf4d5ebcf29 (patch)
tree96e8d418be843e0beae0aa370c7954cc2fd0a5da
parent0c0e2d6de3deed85b515ebe39a17683496fe33c9 (diff)
downloadnetsurf-4cf27ef3387e52676483b4272072acf4d5ebcf29.tar.gz
netsurf-4cf27ef3387e52676483b4272072acf4d5ebcf29.tar.bz2
Stop cursor leaving the root widget and causing a segfault (Found by tlsa)
svn path=/trunk/netsurf/; revision=10957
-rw-r--r--framebuffer/fbtk/event.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index c1c4bc1ee..8dc1b02b3 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -134,6 +134,16 @@ fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
cloc.y0 = y;
}
+ /* ensure cursor location lies within the root widget */
+ if (cloc.x0 < root->x)
+ cloc.x0 = root->x;
+ if (cloc.x0 > (root->x + root->width))
+ cloc.x0 = (root->x + root->width);
+ if (cloc.y0 < root->y)
+ cloc.y0 = root->y;
+ if (cloc.y0 > (root->y + root->height))
+ cloc.y0 = (root->y + root->height);
+
if (root->u.root.grabbed == NULL) {
/* update the pointer cursor */
nsfb_cursor_loc_set(root->u.root.fb, &cloc);