From bde04d10347414251b40af574d1bc94962d23a5a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 1 Aug 2012 12:51:30 +0100 Subject: Add support for offset mouse pointer hotspots. --- src/surface/sdl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/surface') diff --git a/src/surface/sdl.c b/src/surface/sdl.c index 2a905f5..8908a21 100644 --- a/src/surface/sdl.c +++ b/src/surface/sdl.c @@ -636,8 +636,13 @@ sdl_cursor(nsfb_t *nsfb, struct nsfb_cursor_s *cursor) nsfb_bbox_t fbarea; if ((cursor != NULL) && (cursor->plotted == true)) { + nsfb_bbox_t loc_shift = cursor->loc; + loc_shift.x0 -= cursor->hotspot_x; + loc_shift.y0 -= cursor->hotspot_y; + loc_shift.x1 -= cursor->hotspot_x; + loc_shift.y1 -= cursor->hotspot_y; - nsfb_plot_add_rect(&cursor->savloc, &cursor->loc, &redraw); + nsfb_plot_add_rect(&cursor->savloc, &loc_shift, &redraw); /* screen area */ fbarea.x0 = 0; -- cgit v1.2.3