You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported in version: 2.0.3 Reported for operating system, platform: All, All
Comments on the original bug report:
On 2014-03-31 23:40:24 +0000, Daniel Bünzli wrote:
With all the different display resolutions one gets nowadays, it would be nice to have an API to get the physical display size in millimeters so that one can work with physical units (which is also useful for human factors like touch target sizes, etc.).
Something like:
int SDL_GetDisplayPhysicalSize(int displayIndex, int* w, int* h)
The cocoa implementation would look like
int
Cocoa_GetDisplayPhysicalSize(_THIS, SDL_VideoDisplay * display, int * w, int * h)
{
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
CGSize cgsize;
Created attachment 1801
beginning of patch to add SDL_GetDisplayPhysicalSize
Here's the beginning of a patch to add this function.
I have tested it only on linux and android.
Not sure that the display_index really matches the physical screen.
There is also the Cocoa and WinRt functions but not tested, and IOS (empty).
On 2014-12-09 22:55:51 +0000, Philipp Wiesemann wrote:
(In reply to Sylvain from comment # 1)
Here's the beginning of a patch to add this function.
Thank you for working on a patch. Here are some maybe possible improvements.
The new function SDL_GetDisplayPhysicalSize() requires both width and height to be no NULL pointer. This is not consistent with other functions like SDL_GetWindowSize(). These functions only require one pointer to be no NULL pointer which allows querying only one size.
SDL_GetDisplayPhysicalSize() still returns 0 if the platform-specific implementation failed (or is #ifed like in the patch) which could mean that the returned sizes are not valid. There are return values are documented for "out of range" and "no implemented" but there for this case.
The patch removes a #define in SDL_gesture.c which is unrelated.
There is a typo in every "millimeters".
On 2014-12-11 18:35:28 +0000, Sylvain wrote:
Created attachment 1966
beginning of patch to add SDL_GetDisplayPhysicalSize
Hello, thanks for you remarks, here's a new version of the patch!
Still need some help for the others platforms. For IOS/MacOSX/WinRT, functions are there, just need the implementation.
On 2015-09-08 07:57:01 +0000, Sylvain wrote:
I have seen that SDL_GetDisplayDPI function was added recently:
So SDL_GetDisplayPhysicalSize may not be needed any-more, or simply could be reimplemented, because the physical size should be easily deduced from DPI and pixel size.
Though, it would be great to have the SDL_GetDisplayDPI for other platforms: e.g android, ios ...
Maybe some stuff could be picked from the patch of SDL_GetDisplayPhysicalSize.
On 2015-09-09 00:06:01 +0000, Alex Szpakowski wrote:
iOS doesn't have a way to get the display's DPI.
On 2015-09-09 06:24:20 +0000, Sylvain wrote:
Indeed, it seems there are no API for that. Maybe there will be one in the future.
Though, there are a few tricks, like detecting the model and hard coding a list.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
beginning of patch to add SDL_GetDisplayPhysicalSize (patch_GetDisplayPhysicalSize.diff, text/plain, 2014-08-01 18:13:25 +0000, 14987 bytes)Reported in version: 2.0.3
Reported for operating system, platform: All, All
Comments on the original bug report:
On 2014-03-31 23:40:24 +0000, Daniel Bünzli wrote:
On 2014-08-01 18:13:25 +0000, Sylvain wrote:
On 2014-12-09 22:55:51 +0000, Philipp Wiesemann wrote:
On 2014-12-11 18:35:28 +0000, Sylvain wrote:
On 2015-09-08 07:57:01 +0000, Sylvain wrote:
On 2015-09-09 00:06:01 +0000, Alex Szpakowski wrote:
On 2015-09-09 06:24:20 +0000, Sylvain wrote:
The text was updated successfully, but these errors were encountered: