unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color.
@ 2019-11-19 18:14 Oleg Pykhalov
  2019-11-19 18:23 ` [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs Oleg Pykhalov
  2019-11-19 21:19 ` [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Marius Bakke
  0 siblings, 2 replies; 7+ messages in thread
From: Oleg Pykhalov @ 2019-11-19 18:14 UTC (permalink / raw)
  To: 38279; +Cc: Oleg Pykhalov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
  2019-11-19 18:14 [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Oleg Pykhalov
@ 2019-11-19 18:23 ` Oleg Pykhalov
  2019-11-19 21:00   ` Efraim Flashner
  2019-11-19 21:19 ` [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Marius Bakke
  1 sibling, 1 reply; 7+ messages in thread
From: Oleg Pykhalov @ 2019-11-19 18:23 UTC (permalink / raw)
  To: 38279; +Cc: Oleg Pykhalov

* 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2019-11-19 21:00 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 38279

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

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@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color.
  2019-11-19 18:14 [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Oleg Pykhalov
  2019-11-19 18:23 ` [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs Oleg Pykhalov
@ 2019-11-19 21:19 ` Marius Bakke
  1 sibling, 0 replies; 7+ messages in thread
From: Marius Bakke @ 2019-11-19 21:19 UTC (permalink / raw)
  To: Oleg Pykhalov, 38279

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Hi Oleg,

Oleg Pykhalov <go.wigust@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>".

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
  2019-11-19 21:00   ` Efraim Flashner
@ 2019-11-20 22:35     ` Oleg Pykhalov
  2019-11-21 18:25       ` Marius Bakke
  0 siblings, 1 reply; 7+ messages in thread
From: Oleg Pykhalov @ 2019-11-20 22:35 UTC (permalink / raw)
  To: Efraim Flashner, Marius Bakke; +Cc: 38279

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

Hi,

Efraim Flashner <efraim@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@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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38279] [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
  2019-11-20 22:35     ` Oleg Pykhalov
@ 2019-11-21 18:25       ` Marius Bakke
  2019-11-24  0:44         ` bug#38279: " Oleg Pykhalov
  0 siblings, 1 reply; 7+ messages in thread
From: Marius Bakke @ 2019-11-21 18:25 UTC (permalink / raw)
  To: Oleg Pykhalov, Efraim Flashner; +Cc: 38279

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

Oleg Pykhalov <go.wigust@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@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!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#38279: [PATCH 1/1] gnu: sdl: Add libxcursor to propagated-inputs.
  2019-11-21 18:25       ` Marius Bakke
@ 2019-11-24  0:44         ` Oleg Pykhalov
  0 siblings, 0 replies; 7+ messages in thread
From: Oleg Pykhalov @ 2019-11-24  0:44 UTC (permalink / raw)
  To: 38279-done

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-24  0:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-19 18:14 [bug#38279] [PATCH 0/1] gnu: sdl: Fix cursor color Oleg Pykhalov
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

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).