From: Oleg Pykhalov <go.wigust@gmail.com>
To: 38279@debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust@gmail.com>
Subject: [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color.
Date: Tue, 19 Nov 2019 21:14:25 +0300 [thread overview]
Message-ID: <20191119181425.23755-1-go.wigust@gmail.com> (raw)
Hello.
This patch fixes corrupted mouse cursor image in tome4 and probably other SDL2
dependent programs.
You could reproduce it with the following code:
--8<---------------cut here---------------start------------->8---
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
int
main(int argc, char *argv[])
{
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Surface *surface = NULL;
SDL_Cursor *cursor = NULL;
SDL_bool error = SDL_TRUE;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
goto exit;
}
if (SDL_CreateWindowAndRenderer(640, 480, 0, &window, &renderer) < 0) {
goto exit;
}
surface = IMG_Load("mouse.png");;
if (!surface) {
goto exit;
}
cursor = SDL_CreateColorCursor(surface, 0, 0);
if (!cursor) {
goto exit;
}
SDL_SetCursor(cursor);
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
while (SDL_TRUE) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_MOUSEBUTTONUP:
case SDL_QUIT:
error = SDL_FALSE;
goto exit;
}
}
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
}
exit:
if (error) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError());
}
if (cursor) {
SDL_FreeCursor(cursor);
}
if (surface) {
SDL_FreeSurface(surface);
}
if (renderer) {
SDL_DestroyRenderer(renderer);
}
if (window) {
SDL_DestroyWindow(window);
}
SDL_Quit();
return error;
}
--8<---------------cut here---------------end--------------->8---
mouse.png could be retrieved from
https://git.net-core.org/tome/t-engine4/blob/454dc2f02f8f5bab4ee9e40b20c7d4d8618a0222/game/engines/default/data/gfx/dark-ui/mouse.png
$ guix environment --pure tome4 --ad-hoc gcc-toolchain coreutils findutils strace
$ gcc -o cursor -lSDL2 -lSDL2_image main.c
$ ./cursor
Oleg Pykhalov (1):
gnu: sdl: Add libxcursor to propagated-inputs.
gnu/packages/sdl.scm | 1 +
1 file changed, 1 insertion(+)
--
2.24.0
next reply other threads:[~2019-11-19 18:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 18:14 Oleg Pykhalov [this message]
2019-11-19 18:23 ` [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs Oleg Pykhalov
2019-11-19 21:00 ` Efraim Flashner
2019-11-20 22:35 ` Oleg Pykhalov
2019-11-21 18:25 ` Marius Bakke
2019-11-24 0:44 ` bug#38279: " Oleg Pykhalov
2019-11-19 21:19 ` [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Marius Bakke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191119181425.23755-1-go.wigust@gmail.com \
--to=go.wigust@gmail.com \
--cc=38279@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).