diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-03 19:05:51 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-03 19:05:51 +1100 |
commit | bac427661968d5960c5942858d03103d0ebd2c35 (patch) | |
tree | 2e7816571932d8b1a9484537f116d2ba910cbcc1 | |
parent | 731925e9f86d9c0820cd95d1117fdf549d497ed2 (diff) |
Fix cursor image handling bugs
First, don't destroy the previous cursor when relacing it as it's
common for applications to store a bunch of cursor images and flipping
them in, they don't want to have to re-create them each time.
Then, there was a NULL-deref when setting the cursor to NULL to
remove it
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | twin_screen.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/twin_screen.c b/twin_screen.c index bfa8f83..0781c91 100644 --- a/twin_screen.c +++ b/twin_screen.c @@ -293,17 +293,16 @@ void twin_screen_set_cursor (twin_screen_t *screen, twin_pixmap_t *pixmap, twin_fixed_t hotspot_x, twin_fixed_t hotspot_y) { - if (screen->cursor) { + if (screen->cursor) twin_screen_damage_cursor(screen); - twin_pixmap_destroy(screen->cursor); - } screen->cursor = pixmap; screen->curs_hx = hotspot_x; screen->curs_hy = hotspot_y; - pixmap->x = screen->curs_x - hotspot_x; - pixmap->y = screen->curs_y - hotspot_y; - if (pixmap) - twin_screen_damage_cursor(screen); + if (pixmap) { + pixmap->x = screen->curs_x - hotspot_x; + pixmap->y = screen->curs_y - hotspot_y; + twin_screen_damage_cursor(screen); + } } static void |