From a12015c0d1cabca9799564d4f17bb8dd737996b6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Nov 2014 16:48:16 +0100 Subject: [PATCH 01/18] Force the dictionary popup to do a partial update. It was done the other way around on purpose, so I probably broke some very specific use-case ;). Feel free to shout at me ^^. --- frontend/ui/widget/dictquicklookup.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index ec2e247fb..e3997e641 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -257,7 +257,7 @@ function DictQuickLookup:update() } } UIManager.repaint_all = true - UIManager.full_refresh = true + UIManager.partial_refresh = true end function DictQuickLookup:isPrevDictAvaiable() From 6b21057c35090642a276ed1a5ae0e2afe5461a2a Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Nov 2014 16:51:31 +0100 Subject: [PATCH 02/18] Do FULL updates when going in/out of ScreenSaver. Sounds a good idea in general, and helps in particular on REAGL-aware devices. --- frontend/device/generic/device.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index 0e5f718f1..aef2bc734 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -74,7 +74,7 @@ function Device:outofScreenSaver() -- Blitbuffer. util.usleep(1500000) self.screen:restoreFromSavedBB() - self.screen:refresh(0) + self.screen:refresh(1) self.survive_screen_saver = true end self.screen_saver_mode = false @@ -105,7 +105,7 @@ function Device:prepareSuspend() -- in no case should the frontlight be turned on in suspend mode self.powerd.fl:sleep() end - self.screen:refresh(0) + self.screen:refresh(1) self.screen_saver_mode = true end From a2f107075de2e87577bbb9f0b6cb1e88fea9035f Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Nov 2014 20:04:34 +0100 Subject: [PATCH 03/18] Shot in the dark at matching the H2O's behavior... --- frontend/ui/uimanager.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 9291d4f66..39fe6dc68 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -43,6 +43,7 @@ local UIManager = { full_refresh_waveform_mode = WAVEFORM_MODE_GC16, partial_refresh_waveform_mode = WAVEFORM_MODE_GC16, wait_for_every_marker = false, + regal_always_full = true, -- force to repaint all the widget is stack, will be reset to false -- after each ui loop repaint_all = false, @@ -109,6 +110,13 @@ function UIManager:init() self.partial_refresh_waveform_mode = WAVEFORM_MODE_KOBO_REGAL -- Since Kobo doesn't have MXCFB_WAIT_FOR_UPDATE_SUBMISSION, enabling this currently has no effect :). self.wait_for_every_marker = true + -- The H2O appears to be the odd duck... Nickel uses AUTO for PARTIAL updates instead of asking for REGAL specifically... + -- Unfortunately, since we might start before nickel, and it might be doing something tricky w/ MXCFB_SET_WAVEFORM_MODES, try something else... + -- Namely, ask for REGAL, but don't switch them to FULL + if Device.model == "Kobo_dahlia" then + self.regal_always_full = false + --self.partial_refresh_waveform_mode = WAVEFORM_MODE_AUTO + end else -- See the note in the Kindle code path later, the stock reader might be using AUTO self.partial_refresh_waveform_mode = WAVEFORM_MODE_GC16 @@ -442,8 +450,8 @@ function UIManager:run() if force_fast_refresh then waveform_mode = self.fast_waveform_mode end - -- If the device is REAGL-aware, and we're doing a reader refresh (i.e., PARTIAL, but not regional), apply some trickery to match the stock reader's behavior (REAGL updates are always FULL, but there's no black flash) - if not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == WAVEFORM_MODE_KOBO_REGAL) then + -- If the device is REAGL-aware, and we're doing a reader refresh (i.e., PARTIAL, but not regional), apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) + if self.regal_always_full and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == WAVEFORM_MODE_KOBO_REGAL) then refresh_type = UPDATE_MODE_FULL end -- If we truly asked for a PARTIAL, regional update, it's likely for an UI element, so fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate than the one we use in the reader From 8f3598bec3afa02d6cb552232460c1ba7760e6c9 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Nov 2014 20:27:35 +0100 Subject: [PATCH 04/18] Make IconButton updates regional Beginning of the quest to make menu refreshes slightly smoother ;). --- frontend/ui/widget/iconbutton.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/ui/widget/iconbutton.lua b/frontend/ui/widget/iconbutton.lua index 33e0d167b..936ca1e0c 100644 --- a/frontend/ui/widget/iconbutton.lua +++ b/frontend/ui/widget/iconbutton.lua @@ -2,6 +2,7 @@ local InputContainer = require("ui/widget/container/inputcontainer") local ImageWidget = require("ui/widget/imagewidget") local GestureRange = require("ui/gesturerange") local UIManager = require("ui/uimanager") +local DEBUG = require("dbg") --[[ Button with a big icon image! Designed for touch device @@ -40,6 +41,11 @@ end function IconButton:onTapClickButton() self.image.invert = true + UIManager.update_regions_func = function() + DEBUG("update iconbutton region", self[1].dimen) + return {self[1].dimen} + end + UIManager:setDirty(self.show_parent, "partial") -- make sure button reacts before doing callback UIManager:scheduleIn(0.1, function() From e2e99e5d99bb61c7c5d99c48cfc26188ae39847c Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 10 Nov 2014 21:08:34 +0100 Subject: [PATCH 05/18] make RedaerFooter updates regional --- frontend/apps/reader/modules/readerfooter.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index f91c80abb..0e9b8ab56 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -273,6 +273,16 @@ function ReaderFooter:onTapFooter(arg, ges) else self:updateFooterPos() end + local region = Geom:new{ + x = 0, + y = Screen:getHeight() - self.height, + w = Screen:getWidth(), + h = self.height + } + UIManager.update_regions_func = function() + DEBUG("update readerfooter region", region) + return {region} + end UIManager:setDirty(self.view.dialog, "partial") G_reader_settings:saveSetting("reader_footer_mode", self.mode) return true From a44c5e99d170eff3856916c8b671e105ee1b29c7 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 00:48:19 +0100 Subject: [PATCH 06/18] Use the proper constants for Kobo's waveform modes --- frontend/ui/uimanager.lua | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 39fe6dc68..e9d6128ea 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -10,7 +10,7 @@ local _ = require("gettext") local UPDATE_MODE_PARTIAL = 0x0 local UPDATE_MODE_FULL = 0x1 --- NOTE: Those have been confirmed on Kindle devices. Might be completely different on Kobo (except for AUTO)! +-- Kindle waveform update modes local WAVEFORM_MODE_INIT = 0x0 -- Screen goes to white (clears) local WAVEFORM_MODE_DU = 0x1 -- Grey->white/grey->black local WAVEFORM_MODE_GC16 = 0x2 -- High fidelity (flashing) @@ -29,17 +29,25 @@ local WAVEFORM_MODE_GL4 = 0xA -- 2-bit from white transition -- TODO: Use me in night mode on those devices? local WAVEFORM_MODE_GL16_INV = 0xB -- High fidelity for black transition -local WAVEFORM_MODE_AUTO = 0x101 +-- Kobo waveform update modes +local NTX_WFM_MODE_INIT = 0x0 -- WAVEFORM_MODE_INIT +local NTX_WFM_MODE_DU = 0x1 -- WAVEFORM_MODE_DU +local NTX_WFM_MODE_GC16 = 0x2 -- WAVEFORM_MODE_GC16 +local NTX_WFM_MODE_GC4 = 0x3 -- WAVEFORM_MODE_GC4 +local NTX_WFM_MODE_A2 = 0x4 -- WAVEFORM_MODE_A2 +local NTX_WFM_MODE_GL16 = 0x5 -- WAVEFORM_MODE_GL16 +local NTX_WFM_MODE_GLR16 = 0x6 -- WAVEFORM_MODE_REAGL +local NTX_WFM_MODE_GLD16 = 0x7 -- WAVEFORM_MODE_REAGLD --- Kobo's headers suck, so invent something to avoid magic numbers... -local WAVEFORM_MODE_KOBO_REGAL = 0x7 +-- Common +local WAVEFORM_MODE_AUTO = 0x101 -- there is only one instance of this local UIManager = { default_refresh_type = UPDATE_MODE_PARTIAL, default_waveform_mode = WAVEFORM_MODE_GC16, -- high fidelity waveform - fast_waveform_mode = WAVEFORM_MODE_A2, -- FIXME: Is this OK on Kobo? + fast_waveform_mode = WAVEFORM_MODE_A2, full_refresh_waveform_mode = WAVEFORM_MODE_GC16, partial_refresh_waveform_mode = WAVEFORM_MODE_GC16, wait_for_every_marker = false, @@ -104,22 +112,21 @@ function UIManager:init() Device:getPowerDevice():setIntensity( math.max( math.min(KOBO_LIGHT_ON_START,100) ,0) ) end -- Emulate the stock reader's refresh behavior... - self.full_refresh_waveform_mode = WAVEFORM_MODE_GC16 - -- Request REGAL waveform mode on devices that support it (Aura & H2O) + self.full_refresh_waveform_mode = NTX_WFM_MODE_GC16 + -- Request REAGLD waveform mode on devices that support it (Aura & H2O) if Device.model == "Kobo_phoenix" or Device.model == "Kobo_dahlia" then - self.partial_refresh_waveform_mode = WAVEFORM_MODE_KOBO_REGAL + self.partial_refresh_waveform_mode = NTX_WFM_MODE_GLD16 -- Since Kobo doesn't have MXCFB_WAIT_FOR_UPDATE_SUBMISSION, enabling this currently has no effect :). self.wait_for_every_marker = true - -- The H2O appears to be the odd duck... Nickel uses AUTO for PARTIAL updates instead of asking for REGAL specifically... - -- Unfortunately, since we might start before nickel, and it might be doing something tricky w/ MXCFB_SET_WAVEFORM_MODES, try something else... - -- Namely, ask for REGAL, but don't switch them to FULL + -- The H2O appears to be the odd duck... Nickel uses AUTO for PARTIAL updates instead of asking for REAGLD specifically... + -- For now, try asking for REAGLD, but don't switch them to FULL, since that triggers a black flash on the H2O... if Device.model == "Kobo_dahlia" then self.regal_always_full = false --self.partial_refresh_waveform_mode = WAVEFORM_MODE_AUTO end else -- See the note in the Kindle code path later, the stock reader might be using AUTO - self.partial_refresh_waveform_mode = WAVEFORM_MODE_GC16 + self.partial_refresh_waveform_mode = NTX_WFM_MODE_GL16 self.wait_for_every_marker = false end -- Let the driver decide what to do with PARTIAL, regional updates... @@ -451,7 +458,7 @@ function UIManager:run() waveform_mode = self.fast_waveform_mode end -- If the device is REAGL-aware, and we're doing a reader refresh (i.e., PARTIAL, but not regional), apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) - if self.regal_always_full and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == WAVEFORM_MODE_KOBO_REGAL) then + if self.regal_always_full and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then refresh_type = UPDATE_MODE_FULL end -- If we truly asked for a PARTIAL, regional update, it's likely for an UI element, so fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate than the one we use in the reader @@ -472,7 +479,7 @@ function UIManager:run() Screen:refresh(refresh_type, waveform_mode, wait_for_marker) end -- REAGL refreshes are always FULL (but without a black flash), but we want to keep our black flash timeout working, so don't reset the counter on FULL REAGL refreshes... - if refresh_type == UPDATE_MODE_FULL and waveform_mode ~= WAVEFORM_MODE_REAGL and waveform_mode ~= WAVEFORM_MODE_KOBO_REGAL then + if refresh_type == UPDATE_MODE_FULL and waveform_mode ~= WAVEFORM_MODE_REAGL and waveform_mode ~= NTX_WFM_MODE_GLD16 then self.refresh_count = 0 elseif not force_partial_refresh and not force_full_refresh then self.refresh_count = (self.refresh_count + 1)%self.FULL_REFRESH_COUNT From 8cfbcca7c542ba0ed60195bf2d533ecbe4066642 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 01:25:44 +0100 Subject: [PATCH 07/18] More comments on the H2O weirdness... --- frontend/ui/uimanager.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index e9d6128ea..aad5ca061 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -120,6 +120,10 @@ function UIManager:init() self.wait_for_every_marker = true -- The H2O appears to be the odd duck... Nickel uses AUTO for PARTIAL updates instead of asking for REAGLD specifically... -- For now, try asking for REAGLD, but don't switch them to FULL, since that triggers a black flash on the H2O... + -- Strangely enough, if I follow the kernel sources correctly, and they aren't using dirty tricks (like enabling some switches at compile time...), + -- PARTIAL, AUTO updates should default to NTX_WFM_MODE_GL16 on the H2O, which isn't REAGL at all, so, err, WTF? + -- FIXME: Either live like this, or try switchng to NTX_WFM_MODE_GLR16, which appears to be the right thing for PARTIAL REAGL, + -- or simply stop trying to figure it out and go AUTO... if Device.model == "Kobo_dahlia" then self.regal_always_full = false --self.partial_refresh_waveform_mode = WAVEFORM_MODE_AUTO From 3ce10b697a0392c2d7fd47429c746b15146a09e5 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 01:27:44 +0100 Subject: [PATCH 08/18] Moar comments! --- frontend/ui/uimanager.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index aad5ca061..a5103dd71 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -172,7 +172,8 @@ function UIManager:init() self.wait_for_every_marker = true else self.partial_refresh_waveform_mode = WAVEFORM_MODE_GL16_FAST - -- NOTE: Or we could go back to what KOReader did before fa55acc in koreader-base, which was also to use AUTO ;). I have *no* idea how the driver makes its choice though... + -- NOTE: Or we could go back to what KOReader did before fa55acc in koreader-base, which was also to use AUTO ;). + -- That said, we *should* be making more or less the same decisions as AUTO on our own, if I followed things correctly... --self.partial_refresh_waveform_mode = WAVEFORM_MODE_AUTO -- Only wait for update markers on FULL updates self.wait_for_every_marker = false From 656a2c7cb6b7875ed81e3b14993a738b0e497c83 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 02:15:08 +0100 Subject: [PATCH 09/18] Actually do what the comment says. Don't hijack forced partial updates (i.e., from UI elements) on always FULL REAGL devices. It doesn't implode if we don't, and it makes for a snappier UI. --- frontend/apps/reader/modules/readerhighlight.lua | 6 ++++++ frontend/ui/uimanager.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 37d1b073e..ec3482de0 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -240,6 +240,12 @@ function ReaderHighlight:onHold(arg, ges) table.insert(boxes, self.selected_word.sbox) self.view.highlight.temp[self.hold_pos.page] = boxes end + --[[ + UIManager.update_regions_func = function() + DEBUG("update ReaderHighlight onHold region", self.selected_word.sbox) + return {self.selected_word.sbox} + end + --]] UIManager:setDirty(self.dialog, "partial") end return true diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index a5103dd71..0bed54024 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -463,7 +463,7 @@ function UIManager:run() waveform_mode = self.fast_waveform_mode end -- If the device is REAGL-aware, and we're doing a reader refresh (i.e., PARTIAL, but not regional), apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) - if self.regal_always_full and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then + if self.regal_always_full and not force_partial_refresh and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then refresh_type = UPDATE_MODE_FULL end -- If we truly asked for a PARTIAL, regional update, it's likely for an UI element, so fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate than the one we use in the reader From a4a50b3d0d90593811644e2fe8c75325dee02412 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 02:28:41 +0100 Subject: [PATCH 10/18] Fix the REAGL logic. Never use REAGL to handle UI elements. It makes for a much smoother experience. --- frontend/ui/uimanager.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 0bed54024..7f3cc26aa 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -462,14 +462,14 @@ function UIManager:run() if force_fast_refresh then waveform_mode = self.fast_waveform_mode end - -- If the device is REAGL-aware, and we're doing a reader refresh (i.e., PARTIAL, but not regional), apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) - if self.regal_always_full and not force_partial_refresh and not self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then + -- If the device is REAGL-aware, and we're doing a PARTIAL *reader* refresh, apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) + if not force_partial_refresh and refresh_type == UPDATE_MODE_PARTIAL and self.regal_always_full and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then refresh_type = UPDATE_MODE_FULL end - -- If we truly asked for a PARTIAL, regional update, it's likely for an UI element, so fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate than the one we use in the reader - if self.update_regions_func and refresh_type == UPDATE_MODE_PARTIAL and not force_fast_refresh then + -- On the other hand, if we asked for a PARTIAL *UI* refresh, fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate in this instance than the one we use in the reader. + if force_partial_refresh then -- NOTE: Using default_waveform_mode might seem counter-intuitive when we have partial_refresh_waveform_mode, but partial_refresh_waveform_mode is mostly there as a means to flag REAGL-aware devices ;). - -- Here, we're actually interested in handling regional updates (which happen to be PARTIAL by definition), and not 'PARTIAL' updates that actually refresh the whole screen. + -- Here, we're actually interested in handling PARTIAL, regional (be it properly flagged or not) updates, and not the PARTIAL updates from the reader that actually refresh the whole screen (i.e., those between black flashes). waveform_mode = self.default_waveform_mode end if self.update_regions_func then From 041f11cba0334ec7a660948ac12f58bcfa9ea11d Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 02:42:07 +0100 Subject: [PATCH 11/18] Tweak some comments --- frontend/apps/reader/modules/readerfooter.lua | 1 - frontend/ui/uimanager.lua | 2 +- frontend/ui/widget/iconbutton.lua | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 0e9b8ab56..fc82b6649 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -280,7 +280,6 @@ function ReaderFooter:onTapFooter(arg, ges) h = self.height } UIManager.update_regions_func = function() - DEBUG("update readerfooter region", region) return {region} end UIManager:setDirty(self.view.dialog, "partial") diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 7f3cc26aa..9dc6a9c0c 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -118,7 +118,7 @@ function UIManager:init() self.partial_refresh_waveform_mode = NTX_WFM_MODE_GLD16 -- Since Kobo doesn't have MXCFB_WAIT_FOR_UPDATE_SUBMISSION, enabling this currently has no effect :). self.wait_for_every_marker = true - -- The H2O appears to be the odd duck... Nickel uses AUTO for PARTIAL updates instead of asking for REAGLD specifically... + -- The H2O appears to be the odd duck out... Nickel uses AUTO for PARTIAL updates instead of asking for REAGLD specifically... -- For now, try asking for REAGLD, but don't switch them to FULL, since that triggers a black flash on the H2O... -- Strangely enough, if I follow the kernel sources correctly, and they aren't using dirty tricks (like enabling some switches at compile time...), -- PARTIAL, AUTO updates should default to NTX_WFM_MODE_GL16 on the H2O, which isn't REAGL at all, so, err, WTF? diff --git a/frontend/ui/widget/iconbutton.lua b/frontend/ui/widget/iconbutton.lua index 936ca1e0c..1079acf24 100644 --- a/frontend/ui/widget/iconbutton.lua +++ b/frontend/ui/widget/iconbutton.lua @@ -2,7 +2,6 @@ local InputContainer = require("ui/widget/container/inputcontainer") local ImageWidget = require("ui/widget/imagewidget") local GestureRange = require("ui/gesturerange") local UIManager = require("ui/uimanager") -local DEBUG = require("dbg") --[[ Button with a big icon image! Designed for touch device @@ -42,7 +41,6 @@ end function IconButton:onTapClickButton() self.image.invert = true UIManager.update_regions_func = function() - DEBUG("update iconbutton region", self[1].dimen) return {self[1].dimen} end From 39244aa0cbca1f20615b940b6ccccf1224277e97 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 02:52:47 +0100 Subject: [PATCH 12/18] Make ToggleSwitch updates regional --- frontend/ui/widget/toggleswitch.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/ui/widget/toggleswitch.lua b/frontend/ui/widget/toggleswitch.lua index bef4ccf19..2e033e1b7 100644 --- a/frontend/ui/widget/toggleswitch.lua +++ b/frontend/ui/widget/toggleswitch.lua @@ -145,6 +145,9 @@ function ToggleSwitch:onTapSelect(arg, gev) --]] self.config:onConfigChoose(self.values, self.name, self.event, self.args, self.events, self.position) + UIManager.update_regions_func = function() + return {self.dimen} + end UIManager:setDirty(self.config, "partial") return true end From 7a812ff86d8f6f3e6fe121bb78046e23642456d6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:03:25 +0100 Subject: [PATCH 13/18] Make Button update regional --- frontend/ui/widget/button.lua | 3 +++ frontend/ui/widget/iconbutton.lua | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index 66f2cbb06..ef47ea604 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -153,6 +153,9 @@ end function Button:onTapSelectButton() if self.enabled and self.callback then self[1].invert = true + UIManager.update_regions_func = function() + return {self[1].dimen} + end UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.1, function() self.callback() diff --git a/frontend/ui/widget/iconbutton.lua b/frontend/ui/widget/iconbutton.lua index 1079acf24..808752b72 100644 --- a/frontend/ui/widget/iconbutton.lua +++ b/frontend/ui/widget/iconbutton.lua @@ -43,7 +43,6 @@ function IconButton:onTapClickButton() UIManager.update_regions_func = function() return {self[1].dimen} end - UIManager:setDirty(self.show_parent, "partial") -- make sure button reacts before doing callback UIManager:scheduleIn(0.1, function() From 88c26b411248b605e5c78e2dafa43d326e7fdd03 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:10:03 +0100 Subject: [PATCH 14/18] Make ConfigDialog updates regional --- frontend/ui/widget/configdialog.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/ui/widget/configdialog.lua b/frontend/ui/widget/configdialog.lua index 503d1bb9b..5dd500614 100644 --- a/frontend/ui/widget/configdialog.lua +++ b/frontend/ui/widget/configdialog.lua @@ -58,6 +58,9 @@ end function MenuBarItem:invert(invert) self[1].invert = invert + UIManager.update_regions_func = function() + return {self[1].dimen} + end UIManager:setDirty(self.config, "partial") end @@ -104,6 +107,9 @@ function OptionTextItem:onTapSelect() self.config:onConfigChoose(self.values, self.name, self.event, self.args, self.events, self.current_item) + UIManager.update_regions_func = function() + return {self[1].dimen} + end UIManager:setDirty(self.config, "partial") return true end @@ -156,6 +162,9 @@ function OptionIconItem:onTapSelect() self.config:onConfigChoose(self.values, self.name, self.event, self.args, self.events, self.current_item) + UIManager.update_regions_func = function() + return {self[1].dimen} + end UIManager:setDirty(self.config, "partial") return true end From b88e304845747f8fc0be33cb5caff9e2fb457d3b Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:17:15 +0100 Subject: [PATCH 15/18] Make TouchMenu updates regional --- frontend/ui/widget/touchmenu.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/ui/widget/touchmenu.lua b/frontend/ui/widget/touchmenu.lua index 501ccc557..0935ac1c0 100644 --- a/frontend/ui/widget/touchmenu.lua +++ b/frontend/ui/widget/touchmenu.lua @@ -97,6 +97,9 @@ function TouchMenuItem:onTapSelect(arg, ges) if enabled == false then return end self.item_frame.invert = true + UIManager.update_regions_func = function() + return {self.dimen} + end UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.5, function() self.item_frame.invert = false @@ -114,6 +117,9 @@ function TouchMenuItem:onHoldSelect(arg, ges) if enabled == false then return end self.item_frame.invert = true + UIManager.update_regions_func = function() + return {self.dimen} + end UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.5, function() self.item_frame.invert = false From c3274a9d5ed018b6bb444f35ba69adfd8993a58b Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:24:56 +0100 Subject: [PATCH 16/18] Unbreak FM by reverting 7a812f :D --- frontend/ui/widget/button.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index ef47ea604..b954346d2 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -153,9 +153,12 @@ end function Button:onTapSelectButton() if self.enabled and self.callback then self[1].invert = true + -- NOTE: Nope, this breaks the FM, by only refreshing the buttons themselves :D. + --[[ UIManager.update_regions_func = function() return {self[1].dimen} end + --]] UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.1, function() self.callback() From dbe816062bca70bd0bde78bcfc6e79f205474c03 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:39:47 +0100 Subject: [PATCH 17/18] Be consistent in how we refer to stuff --- frontend/ui/uimanager.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 9dc6a9c0c..b01030f7a 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -51,7 +51,7 @@ local UIManager = { full_refresh_waveform_mode = WAVEFORM_MODE_GC16, partial_refresh_waveform_mode = WAVEFORM_MODE_GC16, wait_for_every_marker = false, - regal_always_full = true, + reagl_always_full = true, -- force to repaint all the widget is stack, will be reset to false -- after each ui loop repaint_all = false, @@ -125,7 +125,7 @@ function UIManager:init() -- FIXME: Either live like this, or try switchng to NTX_WFM_MODE_GLR16, which appears to be the right thing for PARTIAL REAGL, -- or simply stop trying to figure it out and go AUTO... if Device.model == "Kobo_dahlia" then - self.regal_always_full = false + self.reagl_always_full = false --self.partial_refresh_waveform_mode = WAVEFORM_MODE_AUTO end else @@ -463,7 +463,7 @@ function UIManager:run() waveform_mode = self.fast_waveform_mode end -- If the device is REAGL-aware, and we're doing a PARTIAL *reader* refresh, apply some trickery to match the stock reader's behavior if needed (On *some* devices, REAGL updates are always FULL, but there's no black flash) - if not force_partial_refresh and refresh_type == UPDATE_MODE_PARTIAL and self.regal_always_full and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then + if not force_partial_refresh and refresh_type == UPDATE_MODE_PARTIAL and self.reagl_always_full and (waveform_mode == WAVEFORM_MODE_REAGL or waveform_mode == NTX_WFM_MODE_GLD16) then refresh_type = UPDATE_MODE_FULL end -- On the other hand, if we asked for a PARTIAL *UI* refresh, fall back to the default waveform mode, which is tailored per-device to hopefully be more appropriate in this instance than the one we use in the reader. From d018a31b0a60b7e588c21a275e59b265b252af30 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 11 Nov 2014 03:58:57 +0100 Subject: [PATCH 18/18] Me speak english good. ya! --- frontend/ui/uimanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index b01030f7a..7d4cdc647 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -122,7 +122,7 @@ function UIManager:init() -- For now, try asking for REAGLD, but don't switch them to FULL, since that triggers a black flash on the H2O... -- Strangely enough, if I follow the kernel sources correctly, and they aren't using dirty tricks (like enabling some switches at compile time...), -- PARTIAL, AUTO updates should default to NTX_WFM_MODE_GL16 on the H2O, which isn't REAGL at all, so, err, WTF? - -- FIXME: Either live like this, or try switchng to NTX_WFM_MODE_GLR16, which appears to be the right thing for PARTIAL REAGL, + -- FIXME: Either live with it, or try switchng to NTX_WFM_MODE_GLR16, which appears to be the right thing for PARTIAL REAGL, -- or simply stop trying to figure it out and go AUTO... if Device.model == "Kobo_dahlia" then self.reagl_always_full = false