From cfd42254acd341609d0927af0cf48c8fcec08fa0 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Aug 2024 05:05:38 +0200 Subject: [PATCH] SortWidget: Preserve the cancel's button highlight when changing its icon setIcon recreates the frame without preserving the current frame's invert status (which is arguably a bug, but button is so ubuquitous that I dare not touch that behavior...). So, instead, rely on the rarely used preselect flag to preserve it. --- frontend/ui/widget/sortwidget.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/ui/widget/sortwidget.lua b/frontend/ui/widget/sortwidget.lua index 3d0a9c8b9..b76f8b86b 100644 --- a/frontend/ui/widget/sortwidget.lua +++ b/frontend/ui/widget/sortwidget.lua @@ -438,11 +438,14 @@ function SortWidget:_populateItems() chevron_first, chevron_last = chevron_last, chevron_first end if self.marked > 0 then + -- setIcon will recreate the frame, but we want to preserve the focus inversion + self.footer_cancel.preselect = self.footer_cancel.frame.invert self.footer_cancel:setIcon("cancel", self.footer_button_width) self.footer_cancel.callback = function() self:onCancel() end self.footer_first_up:setIcon("move.up", self.footer_button_width) self.footer_last_down:setIcon("move.down", self.footer_button_width) else + self.footer_cancel.preselect = self.footer_cancel.frame.invert self.footer_cancel:setIcon("exit", self.footer_button_width) self.footer_cancel.callback = function() self:onClose() end self.footer_first_up:setIcon(chevron_first, self.footer_button_width)