Add calibrating banner
This commit is contained in:
parent
4682153ed3
commit
f01c635138
|
|
@ -6,4 +6,6 @@ out/
|
||||||
*.po~
|
*.po~
|
||||||
kwin/src/xrdriveripc/xrdriveripc.py
|
kwin/src/xrdriveripc/xrdriveripc.py
|
||||||
kwin/VERSION
|
kwin/VERSION
|
||||||
kwin/build-test/
|
kwin/build-test/
|
||||||
|
kwin/src/qml/calibrating.png
|
||||||
|
kwin/src/qml/custom_banner.png
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ fi
|
||||||
# this file is in .gitignore so it doesn't get duplicated
|
# this file is in .gitignore so it doesn't get duplicated
|
||||||
cp ui/modules/PyXRLinuxDriverIPC/xrdriveripc.py $KWIN_DIR/src/xrdriveripc/xrdriveripc.py
|
cp ui/modules/PyXRLinuxDriverIPC/xrdriveripc.py $KWIN_DIR/src/xrdriveripc/xrdriveripc.py
|
||||||
cp VERSION $KWIN_DIR
|
cp VERSION $KWIN_DIR
|
||||||
|
cp modules/sombrero/*.png $KWIN_DIR/src/qml
|
||||||
|
|
||||||
pushd $KWIN_DIR > /dev/null
|
pushd $KWIN_DIR > /dev/null
|
||||||
if [ -z "${LOCAL_BUILD_SYSTEM+x}" ]; then
|
if [ -z "${LOCAL_BUILD_SYSTEM+x}" ]; then
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,4 @@ target_link_libraries(breezy_desktop
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
install(DIRECTORY qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/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)
|
|
||||||
|
|
@ -509,7 +509,11 @@ void BreezyDesktopEffect::updateImuRotation() {
|
||||||
|
|
||||||
float imuData[4 * DataView::IMU_QUAT_ENTRIES]; // 4 quaternion-sized rows
|
float imuData[4 * DataView::IMU_QUAT_ENTRIES]; // 4 quaternion-sized rows
|
||||||
memcpy(imuData, data + DataView::IMU_QUAT_DATA[DataView::OFFSET_INDEX], sizeof(imuData));
|
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);
|
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
|
// convert NWU to EUS by passing root.rotation values: -y, z, -x
|
||||||
QQuaternion quatT0(imuData[3], -imuData[1], imuData[2], -imuData[0]);
|
QQuaternion quatT0(imuData[3], -imuData[1], imuData[2], -imuData[0]);
|
||||||
|
|
@ -532,7 +536,6 @@ void BreezyDesktopEffect::updateImuRotation() {
|
||||||
m_imuTimeElapsedMs = static_cast<quint32>(imuData[imuDataOffset + 0] - imuData[imuDataOffset + 1]);
|
m_imuTimeElapsedMs = static_cast<quint32>(imuData[imuDataOffset + 0] - imuData[imuDataOffset + 1]);
|
||||||
|
|
||||||
m_imuTimestamp = imuDateMs;
|
m_imuTimestamp = imuDateMs;
|
||||||
Q_EMIT imuRotationsChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BreezyDesktopEffect::cursorImageSource() const
|
QString BreezyDesktopEffect::cursorImageSource() const
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace KWin
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool isEnabled READ isEnabled NOTIFY enabledStateChanged)
|
Q_PROPERTY(bool isEnabled READ isEnabled NOTIFY enabledStateChanged)
|
||||||
Q_PROPERTY(bool zoomOnFocusEnabled READ isZoomOnFocusEnabled WRITE setZoomOnFocusEnabled NOTIFY zoomOnFocusChanged)
|
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<QQuaternion> imuRotations READ imuRotations)
|
Q_PROPERTY(QList<QQuaternion> imuRotations READ imuRotations)
|
||||||
Q_PROPERTY(quint32 imuTimeElapsedMs READ imuTimeElapsedMs)
|
Q_PROPERTY(quint32 imuTimeElapsedMs READ imuTimeElapsedMs)
|
||||||
Q_PROPERTY(quint64 imuTimestamp READ imuTimestamp)
|
Q_PROPERTY(quint64 imuTimestamp READ imuTimestamp)
|
||||||
|
|
@ -92,7 +92,7 @@ namespace KWin
|
||||||
void displayWrappingSchemeChanged();
|
void displayWrappingSchemeChanged();
|
||||||
void enabledStateChanged();
|
void enabledStateChanged();
|
||||||
void zoomOnFocusChanged();
|
void zoomOnFocusChanged();
|
||||||
void imuRotationsChanged();
|
void imuResetStateChanged();
|
||||||
void cursorImageSourceChanged();
|
void cursorImageSourceChanged();
|
||||||
void cursorPosChanged();
|
void cursorPosChanged();
|
||||||
void devicePropertiesChanged();
|
void devicePropertiesChanged();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import QtQuick
|
||||||
Item {
|
Item {
|
||||||
id: singleDesktopView
|
id: singleDesktopView
|
||||||
property point cursorPos: effect.cursorPos
|
property point cursorPos: effect.cursorPos
|
||||||
|
property bool supportsXR: false
|
||||||
|
property bool showCalibratingBanner: false
|
||||||
|
|
||||||
function cursorInBounds() {
|
function cursorInBounds() {
|
||||||
const x = cursorPos.x
|
const x = cursorPos.x
|
||||||
|
|
@ -15,6 +17,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopView {
|
DesktopView {
|
||||||
|
id: desktopViewComponent
|
||||||
screen: targetScreen
|
screen: targetScreen
|
||||||
width: targetScreen.geometry.width
|
width: targetScreen.geometry.width
|
||||||
height: targetScreen.geometry.height
|
height: targetScreen.geometry.height
|
||||||
|
|
@ -27,6 +30,13 @@ Item {
|
||||||
z: 9999 // ensure on top
|
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: {
|
onCursorPosChanged: {
|
||||||
if (singleDesktopView.cursorInBounds()) {
|
if (singleDesktopView.cursorInBounds()) {
|
||||||
const newX = effect.cursorPos.x - targetScreen.geometry.x
|
const newX = effect.cursorPos.x - targetScreen.geometry.x
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,16 @@ Item {
|
||||||
return displays.monitorsToPlacements(fovDetails, adjustedGeometries, effect.displaySpacing);
|
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 {
|
Component {
|
||||||
id: desktopViewComponent
|
id: desktopViewComponent
|
||||||
SingleDesktopView {}
|
SingleDesktopView {
|
||||||
|
supportsXR: targetScreenSupported
|
||||||
|
showCalibratingBanner: isEnabled && imuResetState
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
@ -121,9 +128,21 @@ Item {
|
||||||
id: viewLoader
|
id: viewLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkLoadedComponent() {
|
||||||
|
const show3DView = targetScreenSupported && isEnabled && !imuResetState;
|
||||||
|
viewLoader.sourceComponent = show3DView ? view3DComponent : desktopViewComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
onImuResetStateChanged: {
|
||||||
|
checkLoadedComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
onIsEnabledChanged: {
|
||||||
|
checkLoadedComponent();
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const targetScreenSupported = supportedModels.some(model => root.targetScreen.model.endsWith(model));
|
checkLoadedComponent();
|
||||||
viewLoader.sourceComponent = targetScreenSupported ? view3DComponent : desktopViewComponent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue