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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38279 in the body.
You can then email your comments to 38279 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Tue, 19 Nov 2019 18:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 19 Nov 2019 18:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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





Information forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Tue, 19 Nov 2019 18:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 38279 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 38279 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
Date: Tue, 19 Nov 2019 21:23:00 +0300
* gnu/packages/sdl.scm (sdl)[propagated-inputs]: Add libxcursor.
---
 gnu/packages/sdl.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 6093405c43..a1a2c233dc 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -88,6 +88,7 @@
      ;; SDL headers include X11 headers.
      `(("libx11" ,libx11)
        ("libcap" ,libcap) ; 'libSDL.la' contain `-lcap'.
+       ("libxcursor" ,libxcursor)
        ;; TODO: Since building Mesa with Meson it is now necessary that Mesa is
        ;; a propogated input. We still need to figure out why, possibly due to a
        ;; change in pkg-config.
-- 
2.24.0





Information forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Tue, 19 Nov 2019 21:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 38279 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 38279 <at> debbugs.gnu.org
Subject: Re: [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to
 propagated-inputs.
Date: Tue, 19 Nov 2019 23:00:36 +0200
[Message part 1 (text/plain, inline)]
This increases the size of 'guix size sdl' from 491.1MiB to 491.2. Do we
need anything similar for sdl2?

LGTM


-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Tue, 19 Nov 2019 21:20:01 GMT) Full text and rfc822 format available.

Message #14 received at 38279 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>, 38279 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: Re: [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color.
Date: Tue, 19 Nov 2019 22:19:23 +0100
[Message part 1 (text/plain, inline)]
Hi Oleg,

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

> Hello.
>
> This patch fixes corrupted mouse cursor image in tome4 and probably other SDL2
> dependent programs.
>
> You could reproduce it with the following code:

Woow, nice find.  The patch LGTM, but please add a comment in the code
about why it has to be propagated, along the lines of "Enable X11 cursor
support in dependent programs, see <https://bugs.gnu.org/38279>".
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Wed, 20 Nov 2019 22:37:01 GMT) Full text and rfc822 format available.

Message #17 received at 38279 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Efraim Flashner <efraim <at> flashner.co.il>, Marius Bakke <mbakke <at> fastmail.com>
Cc: 38279 <at> debbugs.gnu.org
Subject: Re: [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to
 propagated-inputs.
Date: Thu, 21 Nov 2019 01:35:53 +0300
[Message part 1 (text/plain, inline)]
Hi,

Efraim Flashner <efraim <at> flashner.co.il> writes:

> This increases the size of 'guix size sdl' from 491.1MiB to 491.2. Do we
> need anything similar for sdl2?

I tried to fix sdl2.  Do you mean ‘sdl’?  I tried to run tuxpaint which
was build from our Guix package collection and sdl version 1.  The
cursor is black, so I cannot say is it broken or not.

Also I checked other ‘sdl’ games, but no custom cursor there, too:
meritous, knights, prboom-plus, lierolibre, chromium-bsu, tuxpaint,
kobodeluxe, enigma.

NIX's SDL package doesn't contain libXcursor input, but SDL2 does
contain.  I think we should follow this decision.


I worry about qemu and other sdl2 dependent packages.  Should the patch
be merged to core-updates?


Marius Bakke <mbakke <at> fastmail.com> writes:

> Woow, nice find.  The patch LGTM, but please add a comment in the code
> about why it has to be propagated, along the lines of "Enable X11 cursor
> support in dependent programs, see <https://bugs.gnu.org/38279>".

Sure.  I'll add “Enable X11 cursor support in dependent programs” above
‘("libxcursor" ,libxcursor)’.  Also I'll place the libxcursor to
‘inputs’ instead of ‘propagated-inputs’ of SDL2 package, because it's
enough as I tested.

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

Information forwarded to guix-patches <at> gnu.org:
bug#38279; Package guix-patches. (Thu, 21 Nov 2019 18:26:02 GMT) Full text and rfc822 format available.

Message #20 received at 38279 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>,
 Efraim Flashner <efraim <at> flashner.co.il>
Cc: 38279 <at> debbugs.gnu.org
Subject: Re: [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to
 propagated-inputs.
Date: Thu, 21 Nov 2019 19:25:01 +0100
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

> I worry about qemu and other sdl2 dependent packages.  Should the patch
> be merged to core-updates?

`guix refresh -l sdl2` lists 214 dependent packages, so it is within the
"300 packages rebuild limit" on 'master'.

It's good if you verify that some of the important-looking packages in
that list still build properly before pushing however!  :-)

> Marius Bakke <mbakke <at> fastmail.com> writes:
>
>> Woow, nice find.  The patch LGTM, but please add a comment in the code
>> about why it has to be propagated, along the lines of "Enable X11 cursor
>> support in dependent programs, see <https://bugs.gnu.org/38279>".
>
> Sure.  I'll add “Enable X11 cursor support in dependent programs” above
> ‘("libxcursor" ,libxcursor)’.  Also I'll place the libxcursor to
> ‘inputs’ instead of ‘propagated-inputs’ of SDL2 package, because it's
> enough as I tested.

Excellent, thanks!
[signature.asc (application/pgp-signature, inline)]

Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Sun, 24 Nov 2019 00:45:02 GMT) Full text and rfc822 format available.

Notification sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
bug acknowledged by developer. (Sun, 24 Nov 2019 00:45:04 GMT) Full text and rfc822 format available.

Message #25 received at 38279-done <at> debbugs.gnu.org (full text, mbox):

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 1 (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)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 22 Dec 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 120 days ago.

Previous Next


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