Browse Source

Platform: properly support the MAGNUM_DPI_SCALING environment variable.

pull/297/head
Vladimír Vondruš 8 years ago
parent
commit
a14975cc42
  1. 10
      doc/changelog.dox
  2. 4
      src/Magnum/Platform/Implementation/dpiScaling.hpp
  3. 19
      src/Magnum/Platform/Sdl2Application.h

10
doc/changelog.dox

@ -36,7 +36,15 @@ See also:
- @subpage changelog-extras "Extras changelog" - @subpage changelog-extras "Extras changelog"
- @subpage changelog-examples "Examples changelog" - @subpage changelog-examples "Examples changelog"
@anchor changelog-latest @section changelog-latest Changes since 2018.10
@subsection changelog-latest-bugfixes Bug fixes
- Fixed @ref Platform::Sdl2Application and @ref Platform::GlfwApplication to
properly support the @cb{.sh} $MAGNUM_DPI_SCALING @ce environment variable
as an alternative to `--magnum-dpi-scaling` command-line parameter. It was
also not documented anywhere. Besides that, the default `--magnum-dpi-scaling`
value should have been `default` as documented, not `virtual`.
@section changelog-2018-10 2018.10 @section changelog-2018-10 2018.10

4
src/Magnum/Platform/Implementation/dpiScaling.hpp

@ -46,8 +46,8 @@ namespace {
inline Utility::Arguments windowScalingArguments() { inline Utility::Arguments windowScalingArguments() {
Utility::Arguments args{"magnum"}; Utility::Arguments args{"magnum"};
args.addOption("dpi-scaling", "virtual") args.addOption("dpi-scaling", "default")
.setFromEnvironment("dpi-scaling", "default") .setFromEnvironment("dpi-scaling")
#ifdef CORRADE_TARGET_APPLE #ifdef CORRADE_TARGET_APPLE
.setHelp("dpi-scaling", "\n window DPI scaling", "default|framebuffer|<d>|\"<h> <v>\"") .setHelp("dpi-scaling", "\n window DPI scaling", "default|framebuffer|<d>|\"<h> <v>\"")
#elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_ANDROID) #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_ANDROID)

19
src/Magnum/Platform/Sdl2Application.h

@ -277,7 +277,8 @@ size and the framebuffer pixels will match display pixels 1:1. On displays that
have different DPI, there are three possible scenarios, listed below. It's have different DPI, there are three possible scenarios, listed below. It's
possible to fine tune the behavior either using extra parameters passed to possible to fine tune the behavior either using extra parameters passed to
@ref Configuration::setSize() or via the `--magnum-dpi-scaling` command-line @ref Configuration::setSize() or via the `--magnum-dpi-scaling` command-line
option. option (or the equivalent @cb{.sh} $MAGNUM_DPI_SCALING @ce environment
variable).
- Framebuffer DPI scaling. The window is created with exactly the requested - Framebuffer DPI scaling. The window is created with exactly the requested
size and all event coordinates are reported also relative to that size. size and all event coordinates are reported also relative to that size.
@ -285,7 +286,8 @@ option.
supported on macOS and iOS. See @ref platforms-macos-hidpi for details how supported on macOS and iOS. See @ref platforms-macos-hidpi for details how
to enable it. Equivalent to passing to enable it. Equivalent to passing
@ref Configuration::DpiScalingPolicy::Framebuffer to @ref Configuration::DpiScalingPolicy::Framebuffer to
@ref Configuration::setSize() or `framebuffer` on command line. @ref Configuration::setSize() or `framebuffer` via command line /
environment.
- Virtual DPI scaling. Scales the window based on DPI scaling setting in the - Virtual DPI scaling. Scales the window based on DPI scaling setting in the
system. For example if a 800x600 window is requested and DPI scaling is set system. For example if a 800x600 window is requested and DPI scaling is set
to 200%, the resulting window will have 1600x1200 pixels. The backing to 200%, the resulting window will have 1600x1200 pixels. The backing
@ -303,15 +305,16 @@ option.
This is supported on Linux, Windows, all mobile platforms except iOS and This is supported on Linux, Windows, all mobile platforms except iOS and
Emscripten. Equivalent to passing Emscripten. Equivalent to passing
@ref Configuration::DpiScalingPolicy::Physical to @ref Configuration::DpiScalingPolicy::Physical to
@ref Configuration::setSize() or `physical` on command line. @ref Configuration::setSize() or `physical` via command line / environment.
Besides the above, it's possible to supply a custom DPI scaling value to Besides the above, it's possible to supply a custom DPI scaling value to
@ref Configuration::setSize() or the `--magnum-dpi-scaling` command-line @ref Configuration::setSize() or the `--magnum-dpi-scaling` command-line
option. Using `--magnum-dpi-scaling &lt;number&gt;` will make the scaling option (or environment variable). Using `--magnum-dpi-scaling &lt;number&gt;`
same in both directions, with `--magnum-dpi-scaling "<horizontal> <vertical>"` will make the scaling same in both directions, with
the scaling will be different in each direction. On desktop systems custom DPI `--magnum-dpi-scaling "<horizontal> <vertical>"` the scaling will be different
scaling value will affect physical window size (with the content being scaled), in each direction. On desktop systems custom DPI scaling value will affect
on mobile and web it will affect sharpness of the contents. physical window size (with the content being scaled), on mobile and web it will
affect sharpness of the contents.
The default is depending on the platform: The default is depending on the platform:

Loading…
Cancel
Save