Clamp popout to both screen width and height on aspect change
This commit is contained in:
parent
09dbf5e586
commit
f295e51d59
@ -256,13 +256,16 @@ 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
|
# Clamp to screen bounds if content would overspill
|
||||||
screen = self.screen()
|
screen = self.screen()
|
||||||
if screen:
|
if screen:
|
||||||
max_h = screen.availableGeometry().height()
|
avail = screen.availableGeometry()
|
||||||
if new_h > max_h:
|
if new_h > avail.height():
|
||||||
new_h = max_h
|
new_h = avail.height()
|
||||||
w = int(new_h * aspect)
|
w = int(new_h * aspect)
|
||||||
|
if w > avail.width():
|
||||||
|
w = avail.width()
|
||||||
|
new_h = int(w / aspect)
|
||||||
self.resize(w, new_h)
|
self.resize(w, new_h)
|
||||||
self._hyprctl_resize(w, new_h)
|
self._hyprctl_resize(w, new_h)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user