allow right click exit when search is focused

but screen isn't a search-enabled screen
develop
Myk Taylor 2023-10-09 02:32:26 -07:00
parent 9f9d8ff74b
commit 98b44ea8f0
No known key found for this signature in database
1 changed files with 10 additions and 2 deletions

@ -319,7 +319,7 @@ local function on_update(self)
end
local function on_input(self, clazz, keys)
if keys._MOUSE_R and self.subviews.search.focus then
if keys._MOUSE_R and self.subviews.search.focus and self:get_handled_key() then
self.subviews.search:setFocus(false)
return true
end
@ -350,7 +350,7 @@ function InfoOverlay:init()
widgets.BannerPanel{
view_id='panel',
frame={l=0, t=0, r=0, h=1},
visible=function() return get_key() and not is_interrogate_or_convict() end,
visible=self:callback('get_handled_key'),
subviews={
widgets.EditField{
view_id='search',
@ -368,6 +368,10 @@ function InfoOverlay:overlay_onupdate()
on_update(self)
end
function InfoOverlay:get_handled_key()
return not is_interrogate_or_convict() and get_key() or nil
end
local function resize_overlay(self)
local sw = dfhack.screen.getWindowSize()
local overlay_width = math.min(40, sw-(self.frame_rect.x1 + 30))
@ -445,6 +449,10 @@ function InterrogationOverlay:overlay_onupdate()
on_update(self)
end
function InterrogationOverlay:get_handled_key()
return is_interrogate_or_convict() and get_key() or nil
end
function InterrogationOverlay:init()
self:addviews{
widgets.Panel{