Skip to content

Commit

Permalink
Fix mouse cursor transparency when using X11_CreateXCursorCursor inte…
Browse files Browse the repository at this point in the history
…rnaly (fix ToME mouse cursors)
  • Loading branch information
ptitSeb committed Nov 4, 2016
1 parent 7356a68 commit 604d108
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/events/SDL_mouse.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,20 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
surface = temp;
}


{
int x, y;
Uint32 *ptr;
for (y = 0; y < surface->h; ++y) {
ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
for (x = 0; x < surface->w; ++x) {
int alpha = (*ptr >> 24) & 0xff;
if (alpha==0) *ptr=0;
++ptr;
}
}
}

cursor = mouse->CreateCursor(surface, hot_x, hot_y);
if (cursor) {
cursor->next = mouse->cursors;
Expand Down

0 comments on commit 604d108

Please sign in to comment.