Add "mouse to focused display" functionality
Fix Qt6Quick3D build check
This commit is contained in:
parent
5ec52baa3f
commit
19bacf2b92
|
|
@ -35,18 +35,25 @@ include(cmake/info.cmake)
|
|||
find_package(epoxy REQUIRED)
|
||||
find_package(XCB REQUIRED COMPONENTS XCB)
|
||||
find_package(KWinDBusInterface CONFIG REQUIRED)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core)
|
||||
|
||||
find_library(QT6_QUICK3D_LIB
|
||||
NAMES Qt6Quick3D Qt6Quick3D.so Qt6Quick3D.so.6
|
||||
PATH_SUFFIXES lib
|
||||
# Qt6 sets QT6_INSTALL_QML which is distro-aware
|
||||
get_target_property(QT6_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)
|
||||
execute_process(
|
||||
COMMAND ${QT6_QMAKE_EXECUTABLE} -query QT_INSTALL_QML
|
||||
OUTPUT_VARIABLE QT6_QML_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT QT6_QUICK3D_LIB)
|
||||
message(FATAL_ERROR "Qt6 Quick3D runtime library not found (QtQuick3D). Please install the Qt6 Quick3D runtime.")
|
||||
|
||||
find_path(QT6_QUICK3D_QML_DIR
|
||||
NAMES QtQuick3D
|
||||
PATHS ${QT6_QML_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(NOT QT6_QUICK3D_QML_DIR)
|
||||
message(FATAL_ERROR "cmake could not find the QtQuick3D QML module.")
|
||||
endif()
|
||||
set_package_properties(Qt6Quick3D PROPERTIES
|
||||
TYPE RUNTIME
|
||||
PURPOSE "Required at runtime for 3D rendering (Qt Quick 3D)."
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
ki18n_install(po)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ RUN pacman -Sy --noconfirm --needed \
|
|||
extra-cmake-modules \
|
||||
qt6-base \
|
||||
qt6-declarative \
|
||||
qt6-quick3d \
|
||||
qt6-tools \
|
||||
kconfig \
|
||||
kconfigwidgets \
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ else
|
|||
fi
|
||||
|
||||
echo "Building docker image"
|
||||
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-kwin:amd64" --load .
|
||||
# docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile -t "breezy-kwin:amd64" --load .
|
||||
# docker buildx build --platform linux/arm64 -f ./docker-build/Dockerfile -t "breezy-kwin:arm64" --load .
|
||||
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile.steamos -t "breezy-kwin-steamos:amd64" --load .
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
#include "core/output.h"
|
||||
#include "core/rendertarget.h"
|
||||
#include "core/renderviewport.h"
|
||||
#include "cursor.h"
|
||||
#include "pointer_input.h"
|
||||
#include "kcm/shortcuts.h"
|
||||
#include "breezydesktopeffect.h"
|
||||
#include "breezydesktopconfig.h"
|
||||
|
|
@ -122,6 +124,10 @@ BreezyDesktopEffect::BreezyDesktopEffect()
|
|||
BreezyShortcuts::TOGGLE_FOLLOW_MODE,
|
||||
[this]() { this->toggleSmoothFollow(); }
|
||||
);
|
||||
setupGlobalShortcut(
|
||||
BreezyShortcuts::CURSOR_TO_FOCUSED_DISPLAY,
|
||||
[this]() { this->moveCursorToFocusedDisplay(); }
|
||||
);
|
||||
|
||||
connect(effects, &EffectsHandler::cursorShapeChanged, this, &BreezyDesktopEffect::updateCursorImage);
|
||||
updateCursorImage();
|
||||
|
|
@ -203,6 +209,11 @@ void BreezyDesktopEffect::recenter() {
|
|||
XRDriverIPC::instance().writeControlFlags(flags);
|
||||
}
|
||||
|
||||
void BreezyDesktopEffect::setLookingAtScreenIndex(int index)
|
||||
{
|
||||
m_lookingAtScreenIndex = index;
|
||||
}
|
||||
|
||||
void BreezyDesktopEffect::reconfigure(ReconfigureFlags)
|
||||
{
|
||||
BreezyDesktopConfig::self()->read();
|
||||
|
|
@ -770,6 +781,23 @@ void BreezyDesktopEffect::updateCursorPos()
|
|||
Q_EMIT cursorPosChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void BreezyDesktopEffect::warpPointerToOutputCenter(Output *output)
|
||||
{
|
||||
if (!output) {
|
||||
return;
|
||||
}
|
||||
const QRect geometry = output->geometry();
|
||||
const QPointF center = geometry.center();
|
||||
Cursors::self()->mouse()->setPos(center);
|
||||
}
|
||||
|
||||
void BreezyDesktopEffect::moveCursorToFocusedDisplay()
|
||||
{
|
||||
if (m_lookingAtScreenIndex == -1) return;
|
||||
|
||||
warpPointerToOutputCenter(effects->screens().at(m_lookingAtScreenIndex));
|
||||
}
|
||||
}
|
||||
|
||||
#include "breezydesktopeffect.moc"
|
||||
|
|
@ -19,6 +19,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(int lookingAtScreenIndex READ lookingAtScreenIndex WRITE setLookingAtScreenIndex)
|
||||
Q_PROPERTY(bool imuResetState READ imuResetState NOTIFY imuResetStateChanged)
|
||||
Q_PROPERTY(QList<QQuaternion> imuRotations READ imuRotations)
|
||||
Q_PROPERTY(quint32 imuTimeElapsedMs READ imuTimeElapsedMs)
|
||||
|
|
@ -62,6 +63,8 @@ namespace KWin
|
|||
bool isEnabled() const;
|
||||
bool isZoomOnFocusEnabled() const;
|
||||
void setZoomOnFocusEnabled(bool enabled);
|
||||
int lookingAtScreenIndex() const { return m_lookingAtScreenIndex; }
|
||||
void setLookingAtScreenIndex(int index);
|
||||
QList<QQuaternion> imuRotations() const;
|
||||
quint32 imuTimeElapsedMs() const;
|
||||
quint64 imuTimestamp() const;
|
||||
|
|
@ -105,6 +108,7 @@ namespace KWin
|
|||
void updateCursorPos();
|
||||
QVariantList listVirtualDisplays() const;
|
||||
bool removeVirtualDisplay(const QString &id);
|
||||
void moveCursorToFocusedDisplay();
|
||||
|
||||
Q_SIGNALS:
|
||||
void lookAheadOverrideChanged();
|
||||
|
|
@ -138,12 +142,14 @@ namespace KWin
|
|||
void toggleSmoothFollow();
|
||||
void setSmoothFollowThreshold(float threshold);
|
||||
void updateDriverSmoothFollowSettings();
|
||||
void warpPointerToOutputCenter(Output *output);
|
||||
|
||||
QString m_cursorImageSource;
|
||||
QSize m_cursorImageSize;
|
||||
|
||||
bool m_enabled = false;
|
||||
bool m_zoomOnFocusEnabled = false;
|
||||
int m_lookingAtScreenIndex = -1; // -1 means disabled/unknown
|
||||
bool m_imuResetState;
|
||||
QList<QQuaternion> m_imuRotations;
|
||||
quint32 m_imuTimeElapsedMs;
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu
|
|||
addShortcutAction(actionCollection, BreezyShortcuts::RECENTER);
|
||||
addShortcutAction(actionCollection, BreezyShortcuts::TOGGLE_ZOOM_ON_FOCUS);
|
||||
addShortcutAction(actionCollection, BreezyShortcuts::TOGGLE_FOLLOW_MODE);
|
||||
addShortcutAction(actionCollection, BreezyShortcuts::CURSOR_TO_FOCUSED_DISPLAY);
|
||||
ui.shortcutsEditor->addCollection(actionCollection);
|
||||
connect(ui.shortcutsEditor, &KShortcutsEditor::keyChange, this, &BreezyDesktopEffectConfig::markAsChanged);
|
||||
connect(ui.EffectEnabled, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateDriverEnabled);
|
||||
|
|
|
|||
|
|
@ -34,4 +34,10 @@ namespace BreezyShortcuts {
|
|||
QStringLiteral("Toggle Follow Mode"),
|
||||
QStringLiteral("Toggle Follow Mode")
|
||||
};
|
||||
|
||||
const Shortcut CURSOR_TO_FOCUSED_DISPLAY = {
|
||||
Qt::CTRL | Qt::META | Qt::Key_Period,
|
||||
QStringLiteral("Move Cursor to Focused Display"),
|
||||
QStringLiteral("Move Cursor to Focused Display")
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Node {
|
|||
required property var fovDetails
|
||||
required property var monitorPlacements
|
||||
property int focusedMonitorIndex: -1
|
||||
property int lookingAtMonitorIndex: -1
|
||||
property var smoothFollowFocusedDisplay
|
||||
|
||||
Displays {
|
||||
|
|
@ -28,16 +29,24 @@ Node {
|
|||
const rotations = smoothFollowEnabled ? effect.smoothFollowOrigin : effect.imuRotations;
|
||||
if (rotations && rotations.length > 0) {
|
||||
let focusedIndex = -1;
|
||||
let lookingAtIndex = -1;
|
||||
|
||||
lookingAtIndex = displays.findFocusedMonitor(
|
||||
displays.eusToNwuQuat(rotations[0]),
|
||||
breezyDesktop.monitorPlacements.map(monitorVectors => monitorVectors.centerLook),
|
||||
breezyDesktop.focusedMonitorIndex,
|
||||
smoothFollowEnabled,
|
||||
breezyDesktop.fovDetails,
|
||||
breezyDesktop.screens.map(screen => screen.geometry)
|
||||
);
|
||||
|
||||
if (breezyDesktop.lookingAtMonitorIndex !== lookingAtIndex) {
|
||||
breezyDesktop.lookingAtMonitorIndex = lookingAtIndex;
|
||||
effect.lookingAtScreenIndex = lookingAtIndex;
|
||||
}
|
||||
|
||||
if (effect.zoomOnFocusEnabled || smoothFollowEnabled) {
|
||||
focusedIndex = displays.findFocusedMonitor(
|
||||
displays.eusToNwuQuat(rotations[0]),
|
||||
breezyDesktop.monitorPlacements.map(monitorVectors => monitorVectors.centerLook),
|
||||
breezyDesktop.focusedMonitorIndex,
|
||||
smoothFollowEnabled,
|
||||
breezyDesktop.fovDetails,
|
||||
breezyDesktop.screens.map(screen => screen.geometry)
|
||||
);
|
||||
focusedIndex = lookingAtIndex;
|
||||
}
|
||||
|
||||
let focusedDisplay;
|
||||
|
|
|
|||
Loading…
Reference in New Issue