I am creating a window using the most recent SDL (compiled from source) using the SDL_WINDOW_ALLOW_HIGHDPI flag. On OSX with a retina display I get a window with a size of 800x600 (which is what SDL_GetWindowSize reports) and a framebuffer size of twice that (as reported by SDL_GL_GetDrawableSize). On Ubuntu 18.10 with a hidpi display I get a small window of 800x600 which makes me wonder what the expected behavior on x11 based platforms is. Wouldn’t it be desirable to have the same behavior on all platforms or is that just not possible (or a good idea)?
Either way, I’d at least be able to detect if I am on a hidpi display so I can scale things accordingly myself. Is there a way to get that information on ubuntu using sdl? Or possibly to detect the content scaling factor that is specified on a screen?
Thanks. My problem is linux specific. RIght now, SDL seems to do whatever is the “default” behavior on each platform. I think it might be worth considering doing something that is consistent across platforms instead or at least give people the means to gather all the information needed.
As of now, AFAIK, there is no way to detect the content scale set in the display settings on linux (x11, gnome) which would be a great thing to add in order to even detect if you are on a hidpi display. Adding a function to get the content scale on either patform (possibly per display) would be amazing.
slime, do you know what the wayland behavior is right now? Is it similar to OSX in the sense that it creates a hidpi window based on the content scaling factor of a screen? (i.e. if you create a 800x600 window on osx with hidpi, it creates a 1600x1200 back buffer)
Okay cool, looking at the commit it appears to me like that is what it is doing, too. I’ll try to see if that works on my machine and if so, will possibly try to commit a patch that does something similar using x11. (I will have to freshen up my mercurial skills o_o)