diff --git a/.gitignore b/.gitignore index 4eb9fcf..40559c0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ out/ *.po~ kwin/src/xrdriveripc/xrdriveripc.py kwin/VERSION -kwin/build-test/ \ No newline at end of file +kwin/build-test/ +kwin/src/qml/calibrating.png +kwin/src/qml/custom_banner.png diff --git a/bin/package_kwin b/bin/package_kwin index af1dd34..6ba691f 100755 --- a/bin/package_kwin +++ b/bin/package_kwin @@ -75,6 +75,7 @@ fi # this file is in .gitignore so it doesn't get duplicated cp ui/modules/PyXRLinuxDriverIPC/xrdriveripc.py $KWIN_DIR/src/xrdriveripc/xrdriveripc.py cp VERSION $KWIN_DIR +cp modules/sombrero/*.png $KWIN_DIR/src/qml pushd $KWIN_DIR > /dev/null if [ -z "${LOCAL_BUILD_SYSTEM+x}" ]; then diff --git a/kwin/src/CMakeLists.txt b/kwin/src/CMakeLists.txt index 8cbb15a..5b88fdd 100644 --- a/kwin/src/CMakeLists.txt +++ b/kwin/src/CMakeLists.txt @@ -67,6 +67,4 @@ target_link_libraries(breezy_desktop ) -install(DIRECTORY qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop) -install(FILES qml/cursorOverlay.frag DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop/qml) -install(FILES qml/cursorOverlay.vert DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop/qml) \ No newline at end of file +install(DIRECTORY qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop) \ No newline at end of file diff --git a/kwin/src/breezydesktopeffect.cpp b/kwin/src/breezydesktopeffect.cpp index 55ecdc4..8b5f91d 100644 --- a/kwin/src/breezydesktopeffect.cpp +++ b/kwin/src/breezydesktopeffect.cpp @@ -509,7 +509,11 @@ void BreezyDesktopEffect::updateImuRotation() { float imuData[4 * DataView::IMU_QUAT_ENTRIES]; // 4 quaternion-sized rows memcpy(imuData, data + DataView::IMU_QUAT_DATA[DataView::OFFSET_INDEX], sizeof(imuData)); + bool wasImuResetState = m_imuResetState; m_imuResetState = (imuData[0] == 0.0f && imuData[1] == 0.0f && imuData[2] == 0.0f && imuData[3] == 1.0f); + if (m_imuResetState != wasImuResetState) { + Q_EMIT imuResetStateChanged(); + } // convert NWU to EUS by passing root.rotation values: -y, z, -x QQuaternion quatT0(imuData[3], -imuData[1], imuData[2], -imuData[0]); @@ -532,7 +536,6 @@ void BreezyDesktopEffect::updateImuRotation() { m_imuTimeElapsedMs = static_cast(imuData[imuDataOffset + 0] - imuData[imuDataOffset + 1]); m_imuTimestamp = imuDateMs; - Q_EMIT imuRotationsChanged(); } QString BreezyDesktopEffect::cursorImageSource() const diff --git a/kwin/src/breezydesktopeffect.h b/kwin/src/breezydesktopeffect.h index 4d21cb6..9ef137e 100644 --- a/kwin/src/breezydesktopeffect.h +++ b/kwin/src/breezydesktopeffect.h @@ -16,7 +16,7 @@ namespace KWin Q_OBJECT Q_PROPERTY(bool isEnabled READ isEnabled NOTIFY enabledStateChanged) Q_PROPERTY(bool zoomOnFocusEnabled READ isZoomOnFocusEnabled WRITE setZoomOnFocusEnabled NOTIFY zoomOnFocusChanged) - Q_PROPERTY(bool imuResetState READ imuResetState) + Q_PROPERTY(bool imuResetState READ imuResetState NOTIFY imuResetStateChanged) Q_PROPERTY(QList imuRotations READ imuRotations) Q_PROPERTY(quint32 imuTimeElapsedMs READ imuTimeElapsedMs) Q_PROPERTY(quint64 imuTimestamp READ imuTimestamp) @@ -92,7 +92,7 @@ namespace KWin void displayWrappingSchemeChanged(); void enabledStateChanged(); void zoomOnFocusChanged(); - void imuRotationsChanged(); + void imuResetStateChanged(); void cursorImageSourceChanged(); void cursorPosChanged(); void devicePropertiesChanged(); diff --git a/kwin/src/qml/SingleDesktopView.qml b/kwin/src/qml/SingleDesktopView.qml index 3d0151f..88eeccd 100644 --- a/kwin/src/qml/SingleDesktopView.qml +++ b/kwin/src/qml/SingleDesktopView.qml @@ -3,6 +3,8 @@ import QtQuick Item { id: singleDesktopView property point cursorPos: effect.cursorPos + property bool supportsXR: false + property bool showCalibratingBanner: false function cursorInBounds() { const x = cursorPos.x @@ -15,6 +17,7 @@ Item { } DesktopView { + id: desktopViewComponent screen: targetScreen width: targetScreen.geometry.width height: targetScreen.geometry.height @@ -27,6 +30,13 @@ Item { z: 9999 // ensure on top } + Image { + source: effect.customBannerEnabled ? "custom_banner.png" : "calibrating.png" + visible: supportsXR && showCalibratingBanner + anchors.horizontalCenter: desktopViewComponent.horizontalCenter + anchors.bottom: desktopViewComponent.bottom + } + onCursorPosChanged: { if (singleDesktopView.cursorInBounds()) { const newX = effect.cursorPos.x - targetScreen.geometry.x diff --git a/kwin/src/qml/main.qml b/kwin/src/qml/main.qml index 01cd949..2794a05 100644 --- a/kwin/src/qml/main.qml +++ b/kwin/src/qml/main.qml @@ -87,9 +87,16 @@ Item { return displays.monitorsToPlacements(fovDetails, adjustedGeometries, effect.displaySpacing); } + property bool targetScreenSupported: supportedModels.some(model => root.targetScreen.model.endsWith(model)) + property bool imuResetState: effect.imuResetState + property bool isEnabled: effect.isEnabled + Component { id: desktopViewComponent - SingleDesktopView {} + SingleDesktopView { + supportsXR: targetScreenSupported + showCalibratingBanner: isEnabled && imuResetState + } } Component { @@ -121,9 +128,21 @@ Item { id: viewLoader anchors.fill: parent } + + function checkLoadedComponent() { + const show3DView = targetScreenSupported && isEnabled && !imuResetState; + viewLoader.sourceComponent = show3DView ? view3DComponent : desktopViewComponent; + } + + onImuResetStateChanged: { + checkLoadedComponent(); + } + + onIsEnabledChanged: { + checkLoadedComponent(); + } Component.onCompleted: { - const targetScreenSupported = supportedModels.some(model => root.targetScreen.model.endsWith(model)); - viewLoader.sourceComponent = targetScreenSupported ? view3DComponent : desktopViewComponent; + checkLoadedComponent(); } }