Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add window rect check #177

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,12 @@ var Tree = GObject.registerClass(
.filter((t) => t.nodeType === NODE_TYPES.WINDOW);
tiledChildren.forEach((w) => {
if (w.renderRect) {
let metaWin = w.nodeValue;
this.extWm.move(metaWin, w.renderRect);
if (w.renderRect.width > 0 && w.renderRect.height > 0) {
let metaWin = w.nodeValue;
this.extWm.move(metaWin, w.renderRect);
} else {
Logger.debug(`ignoring apply for ${w.renderRect.width}x${w.renderRect.height}`);
}
}

if (w.nodeValue.firstRender) w.nodeValue.firstRender = false;
Expand Down Expand Up @@ -1351,13 +1355,15 @@ var Tree = GObject.registerClass(
let nodeY = node.rect.y;
let gap = this.extWm.calculateGaps();

nodeX += gap;
nodeY += gap;
if ((nodeWidth > (gap * 2)) && (nodeHeight > (gap * 2))) {
nodeX += gap;
nodeY += gap;

// TODO - detect inbetween windows and adjust accordingly
// Also adjust depending on display scaling
nodeWidth -= gap * 2;
nodeHeight -= gap * 2;
// TODO - detect inbetween windows and adjust accordingly
// Also adjust depending on display scaling
nodeWidth -= gap * 2;
nodeHeight -= gap * 2;
}
return { x: nodeX, y: nodeY, width: nodeWidth, height: nodeHeight };
}

Expand Down Expand Up @@ -1557,6 +1563,10 @@ var Tree = GObject.registerClass(
}
}

if (node.rect) {
attributes += `,rect:${node.rect.width}x${node.rect.height}+${node.rect.x}+${node.rect.y}`;
}

if (level !== 0) Logger.debug(`${spacing}|`);
Logger.debug(
`${spacing}${rootSpacing}${dashes} ${node.nodeType}#${
Expand Down