Small terminal control fixes

This commit is contained in:
crschnick 2024-11-09 12:59:33 +00:00
parent eb2f0d0730
commit 977ad2483f
3 changed files with 22 additions and 1 deletions

View file

@ -78,6 +78,10 @@ public class NativeWinWindowControl {
return (User32.INSTANCE.GetWindowLong(windowHandle, User32.GWL_STYLE) & User32.WS_MINIMIZE) != 0;
}
public boolean isVisible() {
return User32.INSTANCE.IsWindowVisible(windowHandle);
}
public void alwaysInFront() {
orderRelative(new WinDef.HWND(new Pointer(0xFFFFFFFFFFFFFFFFL)));
}

View file

@ -34,7 +34,7 @@ public abstract class ControllableTerminalSession extends TerminalView.TerminalS
public abstract Rect queryBounds();
public final void updateBoundsState() {
public void updateBoundsState() {
if (!isActive()) {
return;
}

View file

@ -71,4 +71,21 @@ public final class WindowsTerminalSession extends ControllableTerminalSession {
public Rect queryBounds() {
return control.getBounds();
}
public void updateBoundsState() {
if (!control.isIconified() || !control.isVisible()) {
return;
}
var bounds = queryBounds();
if (bounds.getX() == -32000 || bounds.getY() == -32000) {
return;
}
if (lastBounds != null && !lastBounds.equals(bounds)) {
customBounds = true;
}
lastBounds = bounds;
}
}