Kobo: Refactor various aspects of the Kaleido/MTK support (#12221)

* UIManager: Let the fb backend deal with Kaleido wfm promotion. This fixes a number of quirks that poisoned the refresh queue with spurious full-screen refreshes. See https://github.com/koreader/koreader-base/pull/1865 for more details.
* This also means we now disable Kaleido waveform modes when color rendering is disabled (remember to trash your thumbnail cache if you don't want to mix color w/ grayscale thumbnails, though).
* UIManager: Merge refreshes that share an edge, because that was driving me nuts (and would have most likely been merged by the kernel anyway). A perfect test-case is the FM, which trips two separate refreshes because of its title bar.
* ReaderFlipping: Use sensible dimensions, so that we only refresh the icon's region.
* ReaderBookmark: Only refresh the dogear instead of the whole page when toggling bookmarks.
* NetworkSetting: Make it a real boy, so it consistently refreshes properly on dismiss instead of relying on UIManager saving the day.
* Kobo: Aggressively prevent *both* suspend & standby while MTK devices are plugged-in, as both will horribly implode the kernel (we previously only prevent standby while charging).
* Kobo: Switch to 8bpp on B&W MTK devices (or when color rendering is disabled on Kaleido panels).
This commit is contained in:
NiLuJe
2024-07-28 01:19:40 +02:00
committed by GitHub
parent 761cf18222
commit d59c837714
21 changed files with 149 additions and 87 deletions

View File

@@ -20,6 +20,7 @@ function ReaderDogear:init()
self.dogear_min_size = math.ceil(math.min(Screen:getWidth(), Screen:getHeight()) * (1/40))
self.dogear_max_size = math.ceil(math.min(Screen:getWidth(), Screen:getHeight()) * (1/32))
self.dogear_size = nil
self.icon = nil
self.dogear_y_offset = 0
self.top_pad = nil
self:setupDogear()
@@ -35,16 +36,17 @@ function ReaderDogear:setupDogear(new_dogear_size)
if self[1] then
self[1]:free()
end
self.icon = IconWidget:new{
icon = "dogear.alpha",
rotation_angle = BD.mirroredUILayout() and 90 or 0,
width = self.dogear_size,
height = self.dogear_size,
alpha = true, -- Keep the alpha layer intact
}
self.top_pad = VerticalSpan:new{width = self.dogear_y_offset}
self.vgroup = VerticalGroup:new{
self.top_pad,
IconWidget:new{
icon = "dogear.alpha",
rotation_angle = BD.mirroredUILayout() and 90 or 0,
width = self.dogear_size,
height = self.dogear_size,
alpha = true, -- Keep the alpha layer intact
}
self.icon,
}
self[1] = RightContainer:new{
dimen = Geom:new{w = Screen:getWidth(), h = self.dogear_y_offset + self.dogear_size},
@@ -111,11 +113,13 @@ function ReaderDogear:onChangeViewMode()
end
function ReaderDogear:resetLayout()
local new_screen_width = Screen:getWidth()
if new_screen_width == self._last_screen_width then return end
self._last_screen_width = new_screen_width
-- NOTE: RightContainer aligns to the right of its *own* width...
self[1].dimen.w = Screen:getWidth()
end
self[1].dimen.w = new_screen_width
function ReaderDogear:getRefreshRegion()
-- We can't use self.dimen because of the width/height quirks of Left/RightContainer, so use the IconWidget's...
return self.icon.dimen
end
function ReaderDogear:onSetDogearVisibility(visible)