Clamp popout height to screen bounds on landscape-to-portrait transition

This commit is contained in:
pax 2026-04-06 14:00:32 -05:00
parent f58e7e3649
commit 84726f9677

View File

@ -256,6 +256,13 @@ class FullscreenPreview(QMainWindow):
aspect = content_w / content_h aspect = content_w / content_h
w = self.width() w = self.width()
new_h = int(w / aspect) new_h = int(w / aspect)
# Clamp to screen bounds if portrait content would overspill
screen = self.screen()
if screen:
max_h = screen.availableGeometry().height()
if new_h > max_h:
new_h = max_h
w = int(new_h * aspect)
self.resize(w, new_h) self.resize(w, new_h)
self._hyprctl_resize(w, new_h) self._hyprctl_resize(w, new_h)