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 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 } diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 69f4cd666..a57aae744 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -16,8 +16,8 @@ #include "NaClApplication.h" #include +#include #include -#include #include "Context.h" @@ -45,6 +45,8 @@ NaClApplication::NaClApplication(PP_Instance instance, const Math::Vector2pp_resource()); c = new Context; @@ -52,14 +54,51 @@ 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 */ @@ -70,7 +109,7 @@ void NaClApplication::DidChangeView(const pp::View& view) { } /* Update viewport, if changed */ - if(!(flags & Flag::ViewportUpdated)) { + if(flags & Flag::ViewportUpdated) { flags &= ~Flag::ViewportUpdated; viewportEvent(size); } @@ -79,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 135e3f171..d634924f7 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -35,6 +34,7 @@ namespace pp { class Graphics3D; + class Fullscreen; } namespace Magnum { @@ -79,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 */ @@ -154,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; @@ -169,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;