Permalink
Browse files

Fix mouse cursor on x86_64.

  • Loading branch information...
1 parent 2172e05 commit 84df17a786a8b1698b5f7af0aba4b78926a92f8d @liskin committed Apr 6, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 screenclone.cc
View
@@ -324,7 +324,17 @@ struct mouse_replayer {
image.size = std::max( image.width, image.height );
image.xhot = cur->xhot;
image.yhot = cur->yhot;
- image.pixels = (unsigned int *) cur->pixels; // FIXME: 64b unsafe
+
+ if ( 0 && sizeof( * image.pixels ) == sizeof( * cur->pixels ) ) {
+ // 32-bit machines where int is long
+ image.pixels = (unsigned int *) cur->pixels;
+ } else {
+ image.pixels = (unsigned int *) alloca(
+ image.width * image.height * sizeof( unsigned int ) );
+ for ( unsigned i = 0; i < image.width * image.height; ++i )
+ image.pixels[ i ] = cur->pixels[ i ];
+ }
+
cursor = XcursorImageLoadCursor( dst.dpy, &image );
XFree( cur );

0 comments on commit 84df17a

Please sign in to comment.