diff --git a/doc/changelog.dox b/doc/changelog.dox index 3a715882f..2319a2209 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -226,6 +226,9 @@ See also: other context classes - Undefining even more noise from `Xlib.h` (see [mosra/magnum#498](https://github.com/mosra/magnum/pull/498)) +- Added @ref Platform::EmscriptenApplication::Configuration::addWindowFlags() + and @ref Platform::EmscriptenApplication::Configuration::clearWindowFlags() + for consistency with other application implementations @subsubsection changelog-latest-changes-shaders Shaders library diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index ddc1fb2e2..1f16dfbb9 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1232,12 +1232,45 @@ class EmscriptenApplication::Configuration { /** * @brief Set window flags * @return Reference to self (for method chaining) + * + * Default are none. To avoid clearing default flags by accident, + * prefer to use @ref addWindowFlags() and @ref clearWindowFlags() + * instead. */ Configuration& setWindowFlags(WindowFlags windowFlags) { _windowFlags = windowFlags; return *this; } + /** + * @brief Add window flags + * @return Reference to self (for method chaining) + * @m_since_latest + * + * Unlike @ref setWindowFlags(), ORs the flags with existing instead of + * replacing them. Useful for preserving the defaults. + * @see @ref clearWindowFlags() + */ + Configuration& addWindowFlags(WindowFlags flags) { + _windowFlags |= flags; + return *this; + } + + /** + * @brief Clear window flags + * @return Reference to self (for method chaining) + * @m_since_latest + * + * Unlike @ref setWindowFlags(), ANDs the inverse of @p flags with + * existing instead of replacing them. Useful for removing default + * flags. + * @see @ref addWindowFlags() + */ + Configuration& clearWindowFlags(WindowFlags flags) { + _windowFlags &= ~flags; + return *this; + } + private: Vector2i _size; Vector2 _dpiScaling;