pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

devel/sdl2 pkgsrc-2026Q3 transparent/corrupted X11 window



Hi,

I believe there is a problem with SDL2 and X11 in pkgsrc-2026Q3 on NetBSD.
After updating my system to pkgsrc-2026Q3, applications using SDL2 create
 a corrupted/transparent X11 window. The desktop contents can be seen
through the application window. I first noticed the problem with
QEMU 11.1.1 and DOSBox-X. QEMU built with the GTK3 display backend
 works correctly, while its SDL display backend shows the corrupted
window. I have now reproduced the problem with a minimal standalone test
SDL2 program, so the problem does not appear to be specific
 to QEMU, DOSBox-X, NVMM, or any particular guest OS.



#include <SDL2/SDL.h>
#include <stdio.h>

int
main(void)
{
    SDL_Window *window;
    SDL_Renderer *renderer;

    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        fprintf(stderr, "SDL_Init: %s\n", SDL_GetError());
        return 1;
    }

    window = SDL_CreateWindow(
        "SDL2 test",
        SDL_WINDOWPOS_CENTERED,
        SDL_WINDOWPOS_CENTERED,
        800, 600,
        SDL_WINDOW_SHOWN
    );

    if (window == NULL) {
        fprintf(stderr, "SDL_CreateWindow: %s\n", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    if (renderer == NULL) {
        fprintf(stderr, "SDL_CreateRenderer: %s\n", SDL_GetError());
        SDL_DestroyWindow(window);
        SDL_Quit();
        return 1;
    }

    SDL_SetRenderDrawColor(renderer, 0, 128, 255, 255);
    SDL_RenderClear(renderer);
    SDL_RenderPresent(renderer);

    printf("SDL version: %d.%d.%d\n",
        SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);

    printf("Press Enter to quit...\n");
    getchar();

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}



Compiled with:

cc -I/usr/pkg/include sdltest.c -o sdltest \
    -L/usr/pkg/lib -lSDL2

and run with:

LD_LIBRARY_PATH=/usr/pkg/lib ./sdltest

The program opens the same corrupted/transparent window.

I also tested the software renderer:

LD_LIBRARY_PATH=/usr/pkg/lib \
SDL_RENDER_DRIVER=software ./sdltest

The problem remains unchanged. Therefore the problem does not appear to be limited to SDL's accelerated renderer.

Thanks so much.
Ramiro.


Home | Main Index | Thread Index | Old Index