From fdc3884633b14ae5e06030002fd3b95352715595 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 28 Sep 2024 17:55:58 -0700 Subject: [PATCH 1/2] prevent mouse clicks over ZScreen windows from bleeding through --- docs/changelog.txt | 1 + library/lua/gui.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index ce6a297b5e..0e9ab46156 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -57,6 +57,7 @@ Template for new versions: - `tweak`: ``realistic-melting``: change melting return for inorganic armor parts, shields, weapons, trap components and tools to stop smelters from creating metal, bring melt return for adamantine in line with other metals to ~95% of forging cost. wear reduces melt return by 10% per level ## Fixes +- Fix mouse clicks bleeding through DFHack windows when clicking in the space between the frame and the window content in resizable windows ## Misc Improvements - DFHack text edit fields now delete the character at the cursor when you hit the Delete key diff --git a/library/lua/gui.lua b/library/lua/gui.lua index 8b40c34012..bca0bba256 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -1127,7 +1127,7 @@ function ZScreen:onInput(keys) self:dismiss() else local passit = self.pass_pause and keys.D_PAUSE - if not passit and self.pass_mouse_clicks then + if not passit and self.pass_mouse_clicks and not has_mouse then if keys.CONTEXT_SCROLL_UP or keys.CONTEXT_SCROLL_DOWN or keys.CONTEXT_SCROLL_PAGEUP or keys.CONTEXT_SCROLL_PAGEDOWN then passit = true @@ -1164,7 +1164,7 @@ end function ZScreen:isMouseOver() for _,sv in ipairs(self.subviews) do - if sv.visible and sv:getMouseFramePos() then return true end + if utils.getval(sv.visible) and sv:getMouseFramePos() then return true end end end From b2163e9718e2a47f35cba4b0e60400543f782d83 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 28 Sep 2024 17:56:55 -0700 Subject: [PATCH 2/2] allow draggable resizable windows to be dragged by the inset area by default --- library/lua/gui/widgets/containers/panel.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/gui/widgets/containers/panel.lua b/library/lua/gui/widgets/containers/panel.lua index 29822b3ce6..df73e4025c 100644 --- a/library/lua/gui/widgets/containers/panel.lua +++ b/library/lua/gui/widgets/containers/panel.lua @@ -71,7 +71,7 @@ Panel.ATTRS { ---@param args widgets.Panel.initTable function Panel:init(args) if not self.drag_anchors then - self.drag_anchors = {title=true, frame=not self.resizable, body=true} + self.drag_anchors = {title=true, frame=true, body=true} end if not self.resize_anchors then self.resize_anchors = {t=false, l=true, r=true, b=true}