Merge pull request #2620 from myk002/myk_screen_resize

keep windows on the screen when the DF window is resized
develop
Myk 2023-01-16 11:02:44 -08:00 committed by GitHub
commit af76ed671e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

@ -456,6 +456,20 @@ end
function Panel:computeFrame(parent_rect) function Panel:computeFrame(parent_rect)
local sw, sh = parent_rect.width, parent_rect.height local sw, sh = parent_rect.width, parent_rect.height
if self.frame then
if self.frame.t and self.frame.h and self.frame.t + self.frame.h > sh then
self.frame.t = math.max(0, sh - self.frame.h)
end
if self.frame.b and self.frame.h and self.frame.b + self.frame.h > sh then
self.frame.b = math.max(0, sh - self.frame.h)
end
if self.frame.l and self.frame.w and self.frame.l + self.frame.w > sw then
self.frame.l = math.max(0, sw - self.frame.w)
end
if self.frame.r and self.frame.w and self.frame.r + self.frame.w > sw then
self.frame.r = math.max(0, sw - self.frame.w)
end
end
return gui.compute_frame_body(sw, sh, self.frame, self.frame_inset, return gui.compute_frame_body(sw, sh, self.frame, self.frame_inset,
self.frame_style and 1 or 0) self.frame_style and 1 or 0)
end end