fix get-header-position deletion on windowmanger
This commit is contained in:
parent
2ce82a7edc
commit
ffcc1cb9a3
@ -946,56 +946,56 @@ function setupIpcHandlers(movementManager) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ipcMain.handle('get-header-position', () => {
|
ipcMain.handle('get-header-position', () => {
|
||||||
// const header = windowPool.get('header');
|
const header = windowPool.get('header');
|
||||||
// if (header) {
|
if (header) {
|
||||||
// const [x, y] = header.getPosition();
|
const [x, y] = header.getPosition();
|
||||||
// return { x, y };
|
return { x, y };
|
||||||
// }
|
}
|
||||||
// return { x: 0, y: 0 };
|
return { x: 0, y: 0 };
|
||||||
// });
|
});
|
||||||
|
|
||||||
// ipcMain.handle('move-header', (event, newX, newY) => {
|
ipcMain.handle('move-header', (event, newX, newY) => {
|
||||||
// const header = windowPool.get('header');
|
const header = windowPool.get('header');
|
||||||
// if (header) {
|
if (header) {
|
||||||
// const currentY = newY !== undefined ? newY : header.getBounds().y;
|
const currentY = newY !== undefined ? newY : header.getBounds().y;
|
||||||
// header.setPosition(newX, currentY, false);
|
header.setPosition(newX, currentY, false);
|
||||||
|
|
||||||
// updateLayout();
|
updateLayout();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// ipcMain.handle('move-header-to', (event, newX, newY) => {
|
ipcMain.handle('move-header-to', (event, newX, newY) => {
|
||||||
// const header = windowPool.get('header');
|
const header = windowPool.get('header');
|
||||||
// if (header) {
|
if (header) {
|
||||||
// const targetDisplay = screen.getDisplayNearestPoint({ x: newX, y: newY });
|
const targetDisplay = screen.getDisplayNearestPoint({ x: newX, y: newY });
|
||||||
// const { x: workAreaX, y: workAreaY, width, height } = targetDisplay.workArea;
|
const { x: workAreaX, y: workAreaY, width, height } = targetDisplay.workArea;
|
||||||
// const headerBounds = header.getBounds();
|
const headerBounds = header.getBounds();
|
||||||
|
|
||||||
// // Only clamp if the new position would actually go out of bounds
|
// Only clamp if the new position would actually go out of bounds
|
||||||
// // This prevents progressive restriction of movement
|
// This prevents progressive restriction of movement
|
||||||
// let clampedX = newX;
|
let clampedX = newX;
|
||||||
// let clampedY = newY;
|
let clampedY = newY;
|
||||||
|
|
||||||
// // Check if we need to clamp X position
|
// Check if we need to clamp X position
|
||||||
// if (newX < workAreaX) {
|
if (newX < workAreaX) {
|
||||||
// clampedX = workAreaX;
|
clampedX = workAreaX;
|
||||||
// } else if (newX + headerBounds.width > workAreaX + width) {
|
} else if (newX + headerBounds.width > workAreaX + width) {
|
||||||
// clampedX = workAreaX + width - headerBounds.width;
|
clampedX = workAreaX + width - headerBounds.width;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Check if we need to clamp Y position
|
// Check if we need to clamp Y position
|
||||||
// if (newY < workAreaY) {
|
if (newY < workAreaY) {
|
||||||
// clampedY = workAreaY;
|
clampedY = workAreaY;
|
||||||
// } else if (newY + headerBounds.height > workAreaY + height) {
|
} else if (newY + headerBounds.height > workAreaY + height) {
|
||||||
// clampedY = workAreaY + height - headerBounds.height;
|
clampedY = workAreaY + height - headerBounds.height;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// header.setPosition(clampedX, clampedY, false);
|
header.setPosition(clampedX, clampedY, false);
|
||||||
|
|
||||||
// updateLayout();
|
updateLayout();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
|
|
||||||
ipcMain.handle('move-window-step', (event, direction) => {
|
ipcMain.handle('move-window-step', (event, direction) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user