From 3158439cba430f8662cf45652afbec1b6ed25082 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 6 Oct 2016 15:44:24 -0700 Subject: [PATCH 1/6] Prevent deadlock when rapidly switching between openvr and desktop mode --- .../src/display-plugins/hmd/HmdDisplayPlugin.cpp | 1 - libraries/shared/src/LogHandler.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index 86322edded..70535e7a0a 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -124,7 +124,6 @@ void HmdDisplayPlugin::uncustomizeContext() { batch.setFramebuffer(_compositeFramebuffer); batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLOR0, vec4(0)); }); - internalPresent(); _overlayRenderer = OverlayRenderer(); Parent::uncustomizeContext(); } diff --git a/libraries/shared/src/LogHandler.h b/libraries/shared/src/LogHandler.h index d346913dd3..5eae57c3b6 100644 --- a/libraries/shared/src/LogHandler.h +++ b/libraries/shared/src/LogHandler.h @@ -59,7 +59,7 @@ private: QString _targetName; bool _shouldOutputProcessID { false }; - bool _shouldOutputThreadID { false }; + bool _shouldOutputThreadID { true }; bool _shouldDisplayMilliseconds { false }; QSet _repeatedMessageRegexes; QHash _repeatMessageCountHash; From 17d00ee3f9c8c7ada3a998b4eb01758248cbf03e Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 7 Oct 2016 11:41:58 -0700 Subject: [PATCH 2/6] Workaround openvr crash by calling Submit before VR_Shutdown --- plugins/openvr/src/OpenVrHelpers.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 820476191a..64bad19e3c 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -103,6 +103,15 @@ void releaseOpenVrSystem() { #if DEV_BUILD qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; #endif + + // HACK: workaround openvr crash, call submit right before VR_Shutdown. + const GLuint NON_ZERO_GL_TEXTURE_HANDLE = 1; + vr::Texture_t vrTexture{ (void*)NON_ZERO_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto }; + static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 }; + static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 }; + vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT); + vr::VRCompositor()->Submit(vr::Eye_Right, &vrTexture, &OPENVR_TEXTURE_BOUNDS_RIGHT); + vr::VR_Shutdown(); _openVrQuitRequested = false; activeHmd = nullptr; From a4c7e832b5d5fc5d46ddc0d39bd6af31ccdaff5d Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 7 Oct 2016 11:42:34 -0700 Subject: [PATCH 3/6] Reset threadID logging to false --- libraries/shared/src/LogHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/LogHandler.h b/libraries/shared/src/LogHandler.h index 5eae57c3b6..d346913dd3 100644 --- a/libraries/shared/src/LogHandler.h +++ b/libraries/shared/src/LogHandler.h @@ -59,7 +59,7 @@ private: QString _targetName; bool _shouldOutputProcessID { false }; - bool _shouldOutputThreadID { true }; + bool _shouldOutputThreadID { false }; bool _shouldDisplayMilliseconds { false }; QSet _repeatedMessageRegexes; QHash _repeatMessageCountHash; From a934f59c2ab603b9905f7b62314579063876a929 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 8 Oct 2016 13:37:31 +1300 Subject: [PATCH 4/6] Fix virtual keyboard in login dialog --- .../qml/LoginDialog/LinkAccountBody.qml | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 137556964f..debd40a67b 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -27,6 +27,11 @@ Item { loginDialog.login(usernameField.text, passwordField.text) } + property bool keyboardRaised: false + property bool punctuationMode: false + + onKeyboardRaisedChanged: d.resize(); + QtObject { id: d readonly property int minWidth: 480 @@ -35,13 +40,13 @@ Item { readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, form.contentWidth) - var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height + - 4 * hifi.dimensions.contentSpacing.y + form.height + - 4 * hifi.dimensions.contentSpacing.y + buttons.height + var targetWidth = Math.max(titleWidth, form.contentWidth); + var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height + + 4 * hifi.dimensions.contentSpacing.y + form.height + hifi.dimensions.contentSpacing.y + buttons.height; - root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) + root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)); root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + + (linkAccountBody.keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y); } } @@ -130,13 +135,39 @@ Item { } + // Override ScrollingWindow's keyboard that would be at very bottom of dialog. + Keyboard { + y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && !parent.punctuationMode + enabled: parent.keyboardRaised && !parent.punctuationMode + anchors { + left: parent.left + right: parent.right + bottom: buttons.top + bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 + } + } + + KeyboardPunctuation { + y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && parent.punctuationMode + enabled: parent.keyboardRaised && parent.punctuationMode + anchors { + left: parent.left + right: parent.right + bottom: buttons.top + bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 + } + } + Row { id: buttons anchors { - top: form.bottom right: parent.right - margins: 0 - topMargin: 3 * hifi.dimensions.contentSpacing.y + bottom: parent.bottom + bottomMargin: hifi.dimensions.contentSpacing.y } spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); From ec801cb9d8ba7b692ba00a30ade5e4051f4d2076 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 7 Oct 2016 17:46:46 -0700 Subject: [PATCH 5/6] Addressed feedback from code review. --- .../model-networking/src/model-networking/TextureCache.cpp | 4 ++-- plugins/oculus/src/OculusBaseDisplayPlugin.cpp | 5 +++++ plugins/oculus/src/OculusBaseDisplayPlugin.h | 1 + plugins/openvr/src/OpenVrHelpers.cpp | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index b4803a7bcd..215263661d 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -127,7 +127,7 @@ const gpu::TexturePointer& TextureCache::getGrayTexture() { if (!_grayTexture) { _grayTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1)); _grayTexture->setSource("TextureCache::_grayTexture"); - _grayTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_GRAY); + _grayTexture->assignStoredMip(0, _grayTexture->getTexelFormat(), sizeof(OPAQUE_GRAY), OPAQUE_GRAY); } return _grayTexture; } @@ -145,7 +145,7 @@ const gpu::TexturePointer& TextureCache::getBlackTexture() { if (!_blackTexture) { _blackTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1)); _blackTexture->setSource("TextureCache::_blackTexture"); - _blackTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK); + _blackTexture->assignStoredMip(0, _blackTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK); } return _blackTexture; } diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index 7690736a84..83da154b1f 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -61,6 +61,11 @@ void OculusBaseDisplayPlugin::customizeContext() { Parent::customizeContext(); } +void OculusBaseDisplayPlugin::uncustomizeContext() { + Parent::uncustomizeContext(); + internalPresent(); +} + bool OculusBaseDisplayPlugin::internalActivate() { _session = acquireOculusSession(); if (!_session) { diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.h b/plugins/oculus/src/OculusBaseDisplayPlugin.h index 503d8f0b90..25629f004a 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.h +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.h @@ -26,6 +26,7 @@ public: protected: void customizeContext() override; + void uncustomizeContext() override; bool internalActivate() override; void internalDeactivate() override; void updatePresentPose() override; diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 64bad19e3c..d22562a659 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -104,9 +104,9 @@ void releaseOpenVrSystem() { qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; #endif - // HACK: workaround openvr crash, call submit right before VR_Shutdown. - const GLuint NON_ZERO_GL_TEXTURE_HANDLE = 1; - vr::Texture_t vrTexture{ (void*)NON_ZERO_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto }; + // HACK: workaround openvr crash, call submit with an invalid texture, right before VR_Shutdown. + const GLuint INVALID_GL_TEXTURE_HANDLE = -1; + vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 }; vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT); From 12f4b2854d10112fe4db48e3e800e6139a130e9b Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 8 Oct 2016 19:38:57 +1300 Subject: [PATCH 6/6] Fix address bar not being able to regain focus --- interface/resources/qml/AddressBarDialog.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/AddressBarDialog.qml b/interface/resources/qml/AddressBarDialog.qml index bb44e2c56e..7ed91a2940 100644 --- a/interface/resources/qml/AddressBarDialog.qml +++ b/interface/resources/qml/AddressBarDialog.qml @@ -221,7 +221,7 @@ Window { } } onActiveFocusChanged: { - cursorVisible = isCursorVisible; + cursorVisible = isCursorVisible && focus; } MouseArea { // If user clicks in address bar show cursor to indicate ability to enter address. @@ -229,6 +229,7 @@ Window { onClicked: { isCursorVisible = true; parent.cursorVisible = true; + parent.forceActiveFocus(); } } }