Browse Source

Platform: proper NoCreate constructors for windowed classes.

The move away from `nullptr` to NoCreate for constructing an application
without creating OpenGL context was done quite some time ago for
windowless application, but for some weird reason it was never done for
windowed apps. Now made this consistent.

The old `nullptr`-based constructor is still present, but marked as
deprecated and due to be removed in some future release.
pull/196/head
Vladimír Vondruš 9 years ago
parent
commit
eeba2ac848
  1. 4
      src/Magnum/Platform/AbstractXApplication.cpp
  2. 3
      src/Magnum/Platform/AbstractXApplication.h
  3. 4
      src/Magnum/Platform/AndroidApplication.cpp
  4. 13
      src/Magnum/Platform/AndroidApplication.h
  5. 4
      src/Magnum/Platform/GlfwApplication.cpp
  6. 13
      src/Magnum/Platform/GlfwApplication.h
  7. 4
      src/Magnum/Platform/GlutApplication.cpp
  8. 13
      src/Magnum/Platform/GlutApplication.h
  9. 2
      src/Magnum/Platform/GlxApplication.cpp
  10. 12
      src/Magnum/Platform/GlxApplication.h
  11. 4
      src/Magnum/Platform/NaClApplication.cpp
  12. 13
      src/Magnum/Platform/NaClApplication.h
  13. 10
      src/Magnum/Platform/ScreenedApplication.h
  14. 2
      src/Magnum/Platform/ScreenedApplication.hpp
  15. 4
      src/Magnum/Platform/Sdl2Application.cpp
  16. 11
      src/Magnum/Platform/Sdl2Application.h
  17. 2
      src/Magnum/Platform/XEglApplication.cpp
  18. 12
      src/Magnum/Platform/XEglApplication.h

4
src/Magnum/Platform/AbstractXApplication.cpp

@ -37,11 +37,11 @@
namespace Magnum { namespace Platform {
AbstractXApplication::AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, const Configuration& configuration): AbstractXApplication{contextHandler, arguments, nullptr} {
AbstractXApplication::AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, const Configuration& configuration): AbstractXApplication{contextHandler, arguments, NoCreate} {
createContext(configuration);
}
AbstractXApplication::AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, std::nullptr_t): _contextHandler{contextHandler}, _context{new Context{NoCreate, arguments.argc, arguments.argv}}, _flags{Flag::Redraw} {}
AbstractXApplication::AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, NoCreateT): _contextHandler{contextHandler}, _context{new Context{NoCreate, arguments.argc, arguments.argv}}, _flags{Flag::Redraw} {}
void AbstractXApplication::createContext() { createContext({}); }

3
src/Magnum/Platform/AbstractXApplication.h

@ -41,6 +41,7 @@
#undef Status
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -171,7 +172,7 @@ class AbstractXApplication {
#endif
explicit AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, const Configuration& configuration);
explicit AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, std::nullptr_t);
explicit AbstractXApplication(Implementation::AbstractContextHandler<Configuration, Display*, VisualID, Window>* contextHandler, const Arguments& arguments, NoCreateT);
private:
enum class Flag: unsigned int {

4
src/Magnum/Platform/AndroidApplication.cpp

@ -57,11 +57,11 @@ AndroidApplication::LogOutput::LogOutput():
AndroidApplication::AndroidApplication(const Arguments& arguments): AndroidApplication{arguments, Configuration{}} {}
#endif
AndroidApplication::AndroidApplication(const Arguments& arguments, const Configuration& configuration): AndroidApplication{arguments, nullptr} {
AndroidApplication::AndroidApplication(const Arguments& arguments, const Configuration& configuration): AndroidApplication{arguments, NoCreate} {
createContext(configuration);
}
AndroidApplication::AndroidApplication(const Arguments& arguments, std::nullptr_t): _state{arguments}, _context{new Context{NoCreate, 0, nullptr}} {
AndroidApplication::AndroidApplication(const Arguments& arguments, NoCreateT): _state{arguments}, _context{new Context{NoCreate, 0, nullptr}} {
/* Redirect debug output to Android log */
_logOutput.reset(new LogOutput);
}

13
src/Magnum/Platform/AndroidApplication.h

@ -34,6 +34,7 @@
#include <android_native_app_glue.h>
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -201,8 +202,16 @@ class AndroidApplication {
explicit AndroidApplication(const Arguments& arguments);
#endif
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit AndroidApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit AndroidApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief AndroidApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref AndroidApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use AndroidApplication(const Arguments&, NoCreateT) instead") explicit AndroidApplication(const Arguments& arguments, std::nullptr_t): AndroidApplication{arguments, NoCreate} {}
#endif
/** @brief Copying is not allowed */
AndroidApplication(const AndroidApplication&) = delete;

4
src/Magnum/Platform/GlfwApplication.cpp

@ -47,11 +47,11 @@ static_assert(GLFW_TRUE == true && GLFW_FALSE == false, "GLFW does not have sane
GlfwApplication::GlfwApplication(const Arguments& arguments): GlfwApplication{arguments, Configuration{}} {}
#endif
GlfwApplication::GlfwApplication(const Arguments& arguments, const Configuration& configuration): GlfwApplication{arguments, nullptr} {
GlfwApplication::GlfwApplication(const Arguments& arguments, const Configuration& configuration): GlfwApplication{arguments, NoCreate} {
createContext(configuration);
}
GlfwApplication::GlfwApplication(const Arguments& arguments, std::nullptr_t):
GlfwApplication::GlfwApplication(const Arguments& arguments, NoCreateT):
_context{new Context{NoCreate, arguments.argc, arguments.argv}},
_flags{Flag::Redraw}
{

13
src/Magnum/Platform/GlfwApplication.h

@ -35,6 +35,7 @@
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -122,8 +123,16 @@ class GlfwApplication {
explicit GlfwApplication(const Arguments& arguments);
#endif
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit GlfwApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit GlfwApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief GlfwApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref GlfwApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use GlfwApplication(const Arguments&, NoCreateT) instead") explicit GlfwApplication(const Arguments& arguments, std::nullptr_t): GlfwApplication{arguments, NoCreate} {}
#endif
/** @brief Copying is not allowed */
GlfwApplication(const GlfwApplication&) = delete;

4
src/Magnum/Platform/GlutApplication.cpp

@ -39,11 +39,11 @@ GlutApplication* GlutApplication::_instance = nullptr;
GlutApplication::GlutApplication(const Arguments& arguments): GlutApplication{arguments, Configuration{}} {}
#endif
GlutApplication::GlutApplication(const Arguments& arguments, const Configuration& configuration): GlutApplication{arguments, nullptr} {
GlutApplication::GlutApplication(const Arguments& arguments, const Configuration& configuration): GlutApplication{arguments, NoCreate} {
createContext(configuration);
}
GlutApplication::GlutApplication(const Arguments& arguments, std::nullptr_t): _context{new Context{NoCreate, arguments.argc, arguments.argv}} {
GlutApplication::GlutApplication(const Arguments& arguments, NoCreateT): _context{new Context{NoCreate, arguments.argc, arguments.argv}} {
/* Save global instance */
_instance = this;

13
src/Magnum/Platform/GlutApplication.h

@ -33,6 +33,7 @@
#include <string>
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -117,8 +118,16 @@ class GlutApplication {
explicit GlutApplication(const Arguments& arguments);
#endif
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit GlutApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit GlutApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief GlutApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref GlutApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use GlutApplication(const Arguments&, NoCreateT) instead") explicit GlutApplication(const Arguments& arguments, std::nullptr_t): GlutApplication{arguments, NoCreate} {}
#endif
/** @brief Copying is not allowed */
GlutApplication(const GlutApplication&) = delete;

2
src/Magnum/Platform/GlxApplication.cpp

@ -33,7 +33,7 @@ namespace Magnum { namespace Platform {
GlxApplication::GlxApplication(const Arguments& arguments, const Configuration& configuration): AbstractXApplication(new Implementation::GlxContextHandler, arguments, configuration) {}
GlxApplication::GlxApplication(const Arguments& arguments, std::nullptr_t): AbstractXApplication(new Implementation::GlxContextHandler, arguments, nullptr) {}
GlxApplication::GlxApplication(const Arguments& arguments, NoCreateT): AbstractXApplication{new Implementation::GlxContextHandler, arguments, NoCreate} {}
GlxApplication::~GlxApplication() = default;

12
src/Magnum/Platform/GlxApplication.h

@ -88,8 +88,16 @@ class GlxApplication: public AbstractXApplication {
*/
explicit GlxApplication(const Arguments& arguments, const Configuration& configuration = Configuration());
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit GlxApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit GlxApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief GlxApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref GlxApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use GlxApplication(const Arguments&, NoCreateT) instead") explicit GlxApplication(const Arguments& arguments, std::nullptr_t): GlxApplication{arguments, NoCreate} {}
#endif
protected:
/* Nobody will need to have (and delete) GlxApplication*, thus this is

4
src/Magnum/Platform/NaClApplication.cpp

@ -62,11 +62,11 @@ NaClApplication::ConsoleDebugOutput::ConsoleDebugOutput(pp::Instance* instance):
NaClApplication::NaClApplication(const Arguments& arguments): NaClApplication{arguments, Configuration{}} {}
#endif
NaClApplication::NaClApplication(const Arguments& arguments, const Configuration& configuration): NaClApplication{arguments, nullptr} {
NaClApplication::NaClApplication(const Arguments& arguments, const Configuration& configuration): NaClApplication{arguments, NoCreate} {
createContext(configuration);
}
NaClApplication::NaClApplication(const Arguments& arguments, std::nullptr_t): Instance(arguments), Graphics3DClient(this), MouseLock(this) {
NaClApplication::NaClApplication(const Arguments& arguments, NoCreateT): Instance(arguments), Graphics3DClient(this), MouseLock(this) {
_debugOutput.reset(new ConsoleDebugOutput{this});
}

13
src/Magnum/Platform/NaClApplication.h

@ -44,6 +44,7 @@
#include <ppapi/gles2/gl2ext_ppapi.h>
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -215,8 +216,16 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public
explicit NaClApplication(const Arguments& arguments);
#endif
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit NaClApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit NaClApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief NaClApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref NaClApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use NaClApplication(const Arguments&, NoCreateT) instead") explicit NaClApplication(const Arguments& arguments, std::nullptr_t): NaClApplication{arguments, NoCreate} {}
#endif
/** @brief Copying is not allowed */
NaClApplication(const NaClApplication&) = delete;

10
src/Magnum/Platform/ScreenedApplication.h

@ -120,7 +120,15 @@ template<class Application> class BasicScreenedApplication: public Application,
* with @ref Sdl2Application::createContext() "createContext()" or
* @ref Sdl2Application::tryCreateContext() "tryCreateContext()".
*/
explicit BasicScreenedApplication(const typename Application::Arguments& arguments, std::nullptr_t);
explicit BasicScreenedApplication(const typename Application::Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief BasicScreenedApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref BasicScreenedApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use BasicScreenedApplication(const Arguments&, NoCreateT) instead") explicit BasicScreenedApplication(const typename Application::Arguments& arguments, std::nullptr_t): BasicScreenedApplication{arguments, NoCreate} {}
#endif
/**
* @brief Add screen to application

2
src/Magnum/Platform/ScreenedApplication.hpp

@ -45,7 +45,7 @@ template<class Application> void BasicScreen<Application>::mouseMoveEvent(MouseM
template<class Application> BasicScreenedApplication<Application>::BasicScreenedApplication(const typename Application::Arguments& arguments, const typename Application::Configuration& configuration): Application(arguments, configuration) {}
template<class Application> BasicScreenedApplication<Application>::BasicScreenedApplication(const typename Application::Arguments& arguments, std::nullptr_t): Application(arguments, nullptr) {}
template<class Application> BasicScreenedApplication<Application>::BasicScreenedApplication(const typename Application::Arguments& arguments, NoCreateT): Application(arguments, NoCreate) {}
template<class Application> BasicScreenedApplication<Application>::~BasicScreenedApplication() = default;

4
src/Magnum/Platform/Sdl2Application.cpp

@ -69,11 +69,11 @@ void Sdl2Application::staticMainLoop() {
Sdl2Application::Sdl2Application(const Arguments& arguments): Sdl2Application{arguments, Configuration{}} {}
#endif
Sdl2Application::Sdl2Application(const Arguments& arguments, const Configuration& configuration): Sdl2Application{arguments, nullptr} {
Sdl2Application::Sdl2Application(const Arguments& arguments, const Configuration& configuration): Sdl2Application{arguments, NoCreate} {
createContext(configuration);
}
Sdl2Application::Sdl2Application(const Arguments& arguments, std::nullptr_t): _glContext{nullptr},
Sdl2Application::Sdl2Application(const Arguments& arguments, NoCreateT): _glContext{nullptr},
#ifndef CORRADE_TARGET_EMSCRIPTEN
_minimalLoopPeriod{0},
#endif

11
src/Magnum/Platform/Sdl2Application.h

@ -35,6 +35,7 @@
#include <Corrade/Containers/EnumSet.h>
#include "Magnum/Magnum.h"
#include "Magnum/Tags.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Platform/Platform.h"
@ -361,7 +362,15 @@ class Sdl2Application {
* Unlike above, the context is not created and must be created later
* with @ref createContext() or @ref tryCreateContext().
*/
explicit Sdl2Application(const Arguments& arguments, std::nullptr_t);
explicit Sdl2Application(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief Sdl2Application(const Arguments&, NoCreateT)
* @deprecated Use @ref Sdl2Application(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use Sdl2Application(const Arguments&, NoCreateT) instead") explicit Sdl2Application(const Arguments& arguments, std::nullptr_t): Sdl2Application{arguments, NoCreate} {}
#endif
/** @brief Copying is not allowed */
Sdl2Application(const Sdl2Application&) = delete;

2
src/Magnum/Platform/XEglApplication.cpp

@ -32,7 +32,7 @@ namespace Magnum { namespace Platform {
XEglApplication::XEglApplication(const Arguments& arguments, const Configuration& configuration): AbstractXApplication(new Implementation::EglContextHandler, arguments, configuration) {}
XEglApplication::XEglApplication(const Arguments& arguments, std::nullptr_t): AbstractXApplication(new Implementation::EglContextHandler, arguments, nullptr) {}
XEglApplication::XEglApplication(const Arguments& arguments, NoCreateT): AbstractXApplication{new Implementation::EglContextHandler, arguments, NoCreate} {}
XEglApplication::~XEglApplication() = default;

12
src/Magnum/Platform/XEglApplication.h

@ -89,8 +89,16 @@ class XEglApplication: public AbstractXApplication {
*/
explicit XEglApplication(const Arguments& arguments, const Configuration& configuration = Configuration());
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */
explicit XEglApplication(const Arguments& arguments, std::nullptr_t);
/** @copydoc Sdl2Application::Sdl2Application(const Arguments&, NoCreateT) */
explicit XEglApplication(const Arguments& arguments, NoCreateT);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief XEglApplication(const Arguments&, NoCreateT)
* @deprecated Use @ref XEglApplication(const Arguments&, NoCreateT) instead.
*/
CORRADE_DEPRECATED("use XEglApplication(const Arguments&, NoCreateT) instead") explicit XEglApplication(const Arguments& arguments, std::nullptr_t): XEglApplication{arguments, NoCreate} {}
#endif
protected:
/* Nobody will need to have (and delete) XEglApplication*, thus this is

Loading…
Cancel
Save