SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL_CreateWindowFrom failed

Open itxiaoxian opened this issue 6 months ago • 2 comments

void create_window()
{
    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        qDebug() << "SDL initialization failed";
        return;
    }
     WId id = ui->widget->winId();
    SDL_Window* mSDLWindow = SDL_CreateWindowFrom((void*)id );
    if (!mSDLWindow1) {
        qDebug() << "SDL_CreateWindowFrom failed:" << SDL_GetError();
        return;
    }
    return;
}

When I'm on the Windows platform, I can create it normally. But when I try to create it on Ubuntu, it prompts "That operation is not supported".May I ask why?

itxiaoxian avatar Jun 11 '25 11:06 itxiaoxian

Are you using the X or Wayland backend? If it is Wayland, SDL_CreateWindowFrom() was never implemented for that backend in SDL2.

Kontrabant avatar Jun 11 '25 15:06 Kontrabant

Also I guess make sure id is actually a usable handle (is it an Xlib Window handle? Something from xcb that isn't compatible? Is it a Wayland thing but SDL is talking to XWayland?)

icculus avatar Jun 11 '25 16:06 icculus