From 7ba6fc51edd48b49c7e6fbf9eeb0823d0cce153a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 22 Nov 2012 11:56:04 +0100 Subject: [PATCH 1/5] Fixed compilation for OpenGL ES. --- src/DebugMarker.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/DebugMarker.cpp b/src/DebugMarker.cpp index 490128344..e4ec3d21a 100644 --- a/src/DebugMarker.cpp +++ b/src/DebugMarker.cpp @@ -25,11 +25,16 @@ namespace Magnum { DebugMarker::MarkImplementation DebugMarker::markImplementation = &DebugMarker::markImplementationDefault; void DebugMarker::initializeContextBasedFunctionality(Context* context) { + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES if(context->isExtensionSupported()) { Debug() << "DebugMarker: using" << Extensions::GL::GREMEDY::string_marker::string() << "features"; markImplementation = &DebugMarker::markImplementationDebugger; } + #else + static_cast(context); + #endif } void DebugMarker::markImplementationDefault(const std::string&) {} @@ -41,6 +46,8 @@ void DebugMarker::markImplementationDebugger(const std::string& string) { #else #if 0 glInsertEventMarkerEXT(string.length(), string.c_str()); + #else + static_cast(string); #endif #endif } From d7f9538f15d5b4fc0679e7940c5322f39ccfa152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 22 Nov 2012 11:58:48 +0100 Subject: [PATCH 2/5] PKGBUILD-nacl: we can use makeflags. Was building only on one core all the time. Arrgh. --- PKGBUILD-nacl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD-nacl b/PKGBUILD-nacl index 2f941ee3f..344e53f7b 100644 --- a/PKGBUILD-nacl +++ b/PKGBUILD-nacl @@ -8,7 +8,7 @@ url="https://github.com/mosra/magnum" license=('LGPLv3') depends=('nacl-corrade') makedepends=('nacl-sdk' 'cmake') -options=(!makeflags !buildflags !strip) +options=(!buildflags !strip) build() { # Build 32bit From c488d8f2d022c0ae480a6da0c252d36d0cd4375b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 22 Nov 2012 13:03:26 +0100 Subject: [PATCH 3/5] Minor #include cleanup. --- src/Platform/NaClApplication.cpp | 1 - src/Platform/NaClApplication.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 69f4cd666..34b8925f5 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -17,7 +17,6 @@ #include #include -#include #include "Context.h" diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index 135e3f171..901e928a2 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include From 152eb4e4b4904ce7f873da9461d560e09c4c9310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 22 Nov 2012 13:06:16 +0100 Subject: [PATCH 4/5] NaClApplication: fixed boolean fuckup. Now viewportEvent() is called properly on startup _and_ when resizing, not everytime else. --- src/Platform/NaClApplication.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 34b8925f5..1d0b5583e 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -51,6 +51,9 @@ NaClApplication::NaClApplication(PP_Instance instance, const Math::Vector2 Date: Thu, 22 Nov 2012 13:07:27 +0100 Subject: [PATCH 5/5] NaClApplication: fullscreen switching support. --- src/Platform/NaClApplication.cpp | 40 ++++++++++++++++++++++++++++++++ src/Platform/NaClApplication.h | 19 ++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 1d0b5583e..a57aae744 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -16,6 +16,7 @@ #include "NaClApplication.h" #include +#include #include #include "Context.h" @@ -44,6 +45,8 @@ NaClApplication::NaClApplication(PP_Instance instance, const Math::Vector2pp_resource()); c = new Context; @@ -58,10 +61,44 @@ NaClApplication::NaClApplication(PP_Instance instance, const Math::Vector2IsFullscreen(); +} + +bool NaClApplication::setFullscreen(bool enabled) { + /* Given fullscreen mode already set or switching to it is in progress, done */ + if(isFullscreen() == enabled || ((flags & Flag::FullscreenSwitchInProgress) && (flags & Flag::WillBeFullscreen) == enabled)) + return true; + + /* Switch to opposite fullscreen mode is in progress, can't revert it back */ + if((flags & Flag::FullscreenSwitchInProgress) && (flags & Flag::WillBeFullscreen) != enabled) + return false; + + /* Set fullscreen */ + if(!fullscreen->SetFullscreen(enabled)) + return false; + + /* Set flags */ + flags |= Flag::FullscreenSwitchInProgress; + enabled ? flags |= Flag::WillBeFullscreen : flags &= ~Flag::WillBeFullscreen; + return true; +} + void NaClApplication::DidChangeView(const pp::View& view) { + /* Fullscreen switch in progress */ + if(flags & Flag::FullscreenSwitchInProgress) { + /* Done, remove the progress flag */ + if(isFullscreen() == bool(flags & Flag::WillBeFullscreen)) + flags &= ~Flag::FullscreenSwitchInProgress; + + /* Don't process anything during the switch */ + else return; + } + Math::Vector2 size(view.GetRect().width(), view.GetRect().height()); /* Canvas resized */ @@ -81,6 +118,9 @@ void NaClApplication::DidChangeView(const pp::View& view) { } bool NaClApplication::HandleInputEvent(const pp::InputEvent& event) { + /* Don't handle anything during switch from/to fullscreen */ + if(flags & Flag::FullscreenSwitchInProgress) return false; + Flags tmpFlags = flags; switch(event.GetType()) { diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index 901e928a2..d634924f7 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -34,6 +34,7 @@ namespace pp { class Graphics3D; + class Fullscreen; } namespace Magnum { @@ -78,6 +79,19 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient { ~NaClApplication(); + /** @brief Whether the application runs fullscreen */ + bool isFullscreen(); + + /** + * @brief Set fullscreen + * @return `False` if switch to opposite mode is in progress or if the + * switch is not possible, `true` otherwise. + * + * The switch is done asynchronously, during the switch no event + * processing is done. + */ + bool setFullscreen(bool enabled); + protected: /** @{ @name Drawing functions */ @@ -153,7 +167,9 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient { enum class Flag: std::uint8_t { ViewportUpdated = 1 << 0, SwapInProgress = 1 << 1, - Redraw = 1 << 2 + Redraw = 1 << 2, + FullscreenSwitchInProgress = 1 << 3, + WillBeFullscreen = 1 << 4 }; typedef Corrade::Containers::EnumSet Flags; @@ -168,6 +184,7 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient { static void swapCallback(void* applicationInstance, std::int32_t); pp::Graphics3D* graphics; + pp::Fullscreen* fullscreen; Context* c; Math::Vector2 viewportSize; Flags flags;