diff --git a/kwin/bin/setup b/kwin/bin/setup index 5c70ae1..270e559 100755 --- a/kwin/bin/setup +++ b/kwin/bin/setup @@ -59,6 +59,7 @@ cp -r . "$USER_HOME/.local/" popd > /dev/null +mkdir -p $XDG_BIN_HOME cp bin/breezy_kwin_uninstall $XDG_BIN_HOME # Install QT_PLUGIN_PATH snippet into ~/.bash_profile if not present diff --git a/kwin/src/breezydesktopeffect.cpp b/kwin/src/breezydesktopeffect.cpp index 0399437..3ef6549 100644 --- a/kwin/src/breezydesktopeffect.cpp +++ b/kwin/src/breezydesktopeffect.cpp @@ -561,7 +561,8 @@ void BreezyDesktopEffect::updateCursorImage() void BreezyDesktopEffect::updateCursorPos() { // Update cursor position from effects - QPointF newPos = effects->cursorPos(); + const auto cursor = effects->cursorImage(); + QPointF newPos = effects->cursorPos() - cursor.hotSpot(); if (m_cursorPos != newPos) { m_cursorPos = newPos; Q_EMIT cursorPosChanged(); diff --git a/kwin/src/qml/BreezyDesktop.qml b/kwin/src/qml/BreezyDesktop.qml index d5e26c9..a566edb 100644 --- a/kwin/src/qml/BreezyDesktop.qml +++ b/kwin/src/qml/BreezyDesktop.qml @@ -12,34 +12,6 @@ Node { property var imuRotations: effect.imuRotations property int focusedMonitorIndex: -1 - // x value for placing the viewport in the middle of all screens - property real screensXMid: { - let xMin = Number.MAX_VALUE; - let xMax = Number.MIN_VALUE; - - for (let i = 0; i < screens.length; i++) { - const geometry = screens[i].geometry; - xMin = Math.min(xMin, geometry.x); - xMax = Math.max(xMax, geometry.x + geometry.width); - } - - return (xMin + xMax) / 2 - (viewportResolution[0] / 2); - } - - // y value for placing the viewport in the middle of all screens - property real screensYMid: { - let yMin = Number.MAX_VALUE; - let yMax = Number.MIN_VALUE; - - for (let i = 0; i < screens.length; i++) { - const geometry = screens[i].geometry; - yMin = Math.min(yMin, geometry.y); - yMax = Math.max(yMax, geometry.y + geometry.height); - } - - return (yMin + yMax) / 2 - (viewportResolution[1] / 2); - } - Displays { id: displays } diff --git a/kwin/src/qml/DesktopView.qml b/kwin/src/qml/DesktopView.qml index d0124a7..d6f333b 100644 --- a/kwin/src/qml/DesktopView.qml +++ b/kwin/src/qml/DesktopView.qml @@ -6,23 +6,42 @@ Item { required property QtObject screen + function overlapsScreen(win, screenGeom) { + if (!win) return false + const winLeft = win.x + const winTop = win.y + const winRight = winLeft + win.width + const winBottom = winTop + win.height + + const scrLeft = screenGeom.x + const scrTop = screenGeom.y + const scrRight = scrLeft + screenGeom.width + const scrBottom = scrTop + screenGeom.height + + return winLeft < scrRight && + winRight > scrLeft && + winTop < scrBottom && + winBottom > scrTop + } + Repeater { model: KWinComponents.WindowFilterModel { activity: KWinComponents.Workspace.currentActivity desktop: KWinComponents.Workspace.currentDesktop - screenName: desktopView.screen.name windowModel: KWinComponents.WindowModel {} } KWinComponents.WindowThumbnail { + // Only show if window overlaps this screen (any amount) and not minimized. + readonly property bool onThisScreen: desktopView.overlapsScreen(model.window, desktopView.screen.geometry) + wId: model.window.internalId x: model.window.x - desktopView.screen.geometry.x y: model.window.y - desktopView.screen.geometry.y z: model.window.stackingOrder - visible: !model.window.minimized + visible: onThisScreen && !model.window.minimized } } - Image { id: cursorImg source: effect.cursorImageSource diff --git a/kwin/src/qml/main.qml b/kwin/src/qml/main.qml index 6f27755..2b1a241 100644 --- a/kwin/src/qml/main.qml +++ b/kwin/src/qml/main.qml @@ -29,6 +29,34 @@ Item { // return supportedModels.includes(screen.model); // }) + // x value for placing the viewport in the middle of all screens + property real screensXMid: { + let xMin = Number.MAX_VALUE; + let xMax = Number.MIN_VALUE; + + for (let i = 0; i < screens.length; i++) { + const geometry = screens[i].geometry; + xMin = Math.min(xMin, geometry.x); + xMax = Math.max(xMax, geometry.x + geometry.width); + } + + return (xMin + xMax) / 2 - (viewportResolution[0] / 2); + } + + // y value for placing the viewport in the middle of all screens + property real screensYMid: { + let yMin = Number.MAX_VALUE; + let yMax = Number.MIN_VALUE; + + for (let i = 0; i < screens.length; i++) { + const geometry = screens[i].geometry; + yMin = Math.min(yMin, geometry.y); + yMax = Math.max(yMax, geometry.y + geometry.height); + } + + return (yMin + yMax) / 2 - (viewportResolution[1] / 2); + } + Displays { id: displays } @@ -37,7 +65,16 @@ Item { property var monitorPlacements: { const monitorSpacing = 0.0; - return displays.monitorsToPlacements(fovDetails, screens.map(screen => screen.geometry), monitorSpacing); + const adjustedGeometries = screens.map(screen => { + const g = screen.geometry; + return { + x: g.x - screensXMid, + y: g.y - screensYMid, + width: g.width, + height: g.height + }; + }); + return displays.monitorsToPlacements(fovDetails, adjustedGeometries, monitorSpacing); } Component {