Fix case where window overlaps two displays, attempt to fix mouse placement off-by-pixels, fix setup issue with the bin directory, apply adjustment that puts the camera in the middle of screens by default

This commit is contained in:
wheaney 2025-08-25 22:02:04 -07:00
parent fbdd5e14bb
commit 0d8fb02388
5 changed files with 63 additions and 33 deletions

View File

@ -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

View File

@ -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();

View File

@ -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
}

View File

@ -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

View File

@ -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 {