REPRODUCIBILITY: | 100% |
BUILD ID = OS VERSION | any, till with 4.1.0.24 |
HARDWARE (XA2, Xperia 10…): | Any device |
UI LANGUAGE: | Any Language |
REGRESSION: | No |
DESCRIPTION:
In my applications ( like some games ports Quake 2, Love2D Engine )
PRECONDITIONS:
For creating SDL applications, need some missing functions for Wayland backend.
STEPS TO REPRODUCE:
Just try create SDL2 application with EGL initialization, or try use SDL_GetDeviceDPI function, which return just SDL_Unsuported() error.
This code should work (use here) Bug Report on SDL
struct SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
if (!SDL_GetWindowWMInfo(sdlwContext->window, &wmInfo)) {
printf("Cannot get the window handle.\n");
return (EGLNativeWindowType)NULL;
}
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
nativeWindow=wmInfo.info.wl.egl_window;
#endif
and this code should work to
float ddpi = -1;
if( SDL_GetDeviceDPI( 0, &ddpi, NULL, NULL ) != 0 ) {
std::cerr << "SDL_Error: " << SDL_GetError(); // Here on SailfishOS it return SDL_Unsuported()
return 1.0;
}
return ddpi;
EXPECTED RESULT:
SDL_SysWMinfo should contains in wmInfo.info.wl.egl_window pointer to wayland_egl
SDL_GetDeviceDPI should return device DPI
ACTUAL RESULT:
First code sample cant even compile,
Second code sample show SDL_Error (Unsuported) and return 1.0
ADDITIONAL INFORMATION:
Wayland EGL pointer bug report
SDL_GetDisplayDPI commit
Both features are implemented and used in Quake2 port with statically built in SDL2 =)