GNU bug report logs - #38279
[PATCH 0/1] gnu: sdl: Fix cursor color.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Tue, 19 Nov 2019 18:16:02 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#38279: closed ([PATCH 0/1] gnu: sdl: Fix cursor color.)
Date: Sun, 24 Nov 2019 00:45:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 24 Nov 2019 03:44:06 +0300
with message-id <871rtyrtm1.fsf <at> gmail.com>
and subject line Re: [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
has caused the debbugs.gnu.org bug report #38279,
regarding [PATCH 0/1] gnu: sdl: Fix cursor color.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
38279: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38279
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 0/1] gnu: sdl: Fix cursor color.
Date: Tue, 19 Nov 2019 21:14:25 +0300
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



[Message part 3 (message/rfc822, inline)]
From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 38279-done <at> debbugs.gnu.org
Subject: Re: [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to
 propagated-inputs.
Date: Sun, 24 Nov 2019 03:44:06 +0300
[Message part 4 (text/plain, inline)]
Hi,

Thank you for the review.

I tested QEMU in SDL video mode, tried gource, and used a guix profile
with patch applied for several days.  I think the patch is OK.  Pushed
to master as 82de17dc8d3eb827aec5902078a0e87f43dece6b

Oleg.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 5 years and 180 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.