Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly less crappy Nightmode #4871

Merged
merged 37 commits into from Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c43780
Add a toast to mention that toggling sleepcover requires a restart
NiLuJe Apr 3, 2019
6baa8dc
Use isTrue instead of a raw readSettings
NiLuJe Apr 3, 2019
ee45d0c
Flip those, too.
NiLuJe Apr 3, 2019
5588aff
Add a canHWInvert capa for devices
NiLuJe Apr 3, 2019
02952c2
Drop the redundant bits ;)
NiLuJe Apr 3, 2019
dc6880b
Not actually a color space, more of a pixel format, so this is slightly
NiLuJe Apr 3, 2019
24aeb3f
Those ovverrides are redundant
NiLuJe Apr 4, 2019
5b70446
Frontlight refinements...
NiLuJe Apr 5, 2019
3ee5b8d
Okay, on Kobo w/ only ioctl, need to sleep, ioctls are too fast
NiLuJe Apr 5, 2019
bae7690
Move the ramping FL toggle to Kobo-only
NiLuJe Apr 5, 2019
a3586a8
Fix setWarmth/setBrightness for non-mixer devices, too.
NiLuJe Apr 5, 2019
bdc39b6
Kill debug
NiLuJe Apr 5, 2019
b56ccb4
Revert that double-check from the generic code.
NiLuJe Apr 5, 2019
6a37c7c
Fix frontlight test
NiLuJe Apr 5, 2019
e4f6bce
Possibly fix AutofrontLight test
NiLuJe Apr 5, 2019
e72ff08
:?
NiLuJe Apr 5, 2019
0901e22
-_-"
NiLuJe Apr 5, 2019
98173f2
>_<"
NiLuJe Apr 5, 2019
967250d
This makes no sense, whooohoo.
NiLuJe Apr 5, 2019
4a810b2
Slightly less insane
NiLuJe Apr 5, 2019
b68a084
Okay, my bad.
NiLuJe Apr 5, 2019
ed06337
O_O
NiLuJe Apr 5, 2019
58ab66d
Okay, it's vaguely starting to make sense.
NiLuJe Apr 5, 2019
6811eab
Okay, better without magic numbers coming form wherever.
NiLuJe Apr 5, 2019
35df686
. -> :
NiLuJe Apr 5, 2019
3354ca2
Bis
NiLuJe Apr 5, 2019
f7c005d
Hulk. Smash.
NiLuJe Apr 5, 2019
71118f9
:!
NiLuJe Apr 5, 2019
1eaf58a
"#_#
NiLuJe Apr 5, 2019
08b22be
{X}_{x}
NiLuJe Apr 5, 2019
64d8d01
NiLuJe Apr 5, 2019
e3506d0
:|
NiLuJe Apr 5, 2019
9dea2d7
~_~
NiLuJe Apr 5, 2019
216742b
I'm going to go cry in a corner.
NiLuJe Apr 5, 2019
f107549
Unbreak Clippy
NiLuJe Apr 5, 2019
c80d075
Okay, this passes.
NiLuJe Apr 5, 2019
daec8cd
Bump base to pickup matching nightmode changes.
NiLuJe Apr 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/apps/reader/modules/readergesture.lua
Expand Up @@ -703,7 +703,7 @@ function ReaderGesture:gestureAction(action, ges)
elseif action == "toc" then
self.ui:handleEvent(Event:new("ShowToc"))
elseif action == "night_mode" then
local night_mode = G_reader_settings:readSetting("night_mode") or false
local night_mode = G_reader_settings:isTrue("night_mode") or false
NiLuJe marked this conversation as resolved.
Show resolved Hide resolved
Screen:toggleNightMode()
UIManager:setDirty("all", "full")
G_reader_settings:saveSetting("night_mode", not night_mode)
Expand Down
1 change: 1 addition & 0 deletions frontend/device/generic/device.lua
Expand Up @@ -31,6 +31,7 @@ local Device = {
hasClipboard = yes, -- generic internal clipboard on all devices
hasEinkScreen = yes,
canHWDither = no,
canHWInvert = no,
hasColorScreen = no,
hasBGRFrameBuffer = no,
canToggleGSensor = no,
Expand Down
6 changes: 6 additions & 0 deletions frontend/device/kindle/device.lua
Expand Up @@ -75,6 +75,8 @@ local Kindle = Generic:new{
-- NOTE: We can cheat by adding a platform-specific entry here, because the only code that will check for this is here.
isSpecialOffers = isSpecialOffers(),
hasOTAUpdates = yes,
-- NOTE: HW inversion is generally safe on mxcfb Kindles
canHWInvert = yes,
}

function Kindle:initNetworkManager(NetworkMgr)
Expand Down Expand Up @@ -206,26 +208,30 @@ local Kindle2 = Kindle:new{
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local KindleDXG = Kindle:new{
model = "KindleDXG",
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local Kindle3 = Kindle:new{
model = "Kindle3",
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local Kindle4 = Kindle:new{
model = "Kindle4",
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local KindleTouch = Kindle:new{
Expand Down
4 changes: 4 additions & 0 deletions frontend/device/kobo/device.lua
Expand Up @@ -38,6 +38,8 @@ local Kobo = Generic:new{
internal_storage_mount_point = "/mnt/onboard/",
-- currently only the Aura One and Forma have coloured frontlights
hasNaturalLight = no,
-- HW inversion is generally safe on Kobo, except on a few baords/kernels
canHWInvert = yes,
}

-- TODO: hasKeys for some devices?
Expand Down Expand Up @@ -114,6 +116,8 @@ local KoboPhoenix = Kobo:new{
display_dpi = 212,
-- the bezel covers 12 pixels at the bottom:
viewport = Geom:new{x=0, y=0, w=758, h=1012},
-- NOTE: May have a buggy kernel, according to the nightmode hack...
canHWInvert = no,
}

-- Kobo Aura H2O2:
Expand Down
7 changes: 5 additions & 2 deletions frontend/ui/elements/common_settings_menu_table.lua
Expand Up @@ -114,15 +114,18 @@ if Device:isKobo() then
end,
callback = function()
G_reader_settings:flipNilOrFalse("ignore_power_sleepcover")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
})
end
}
end

common_settings.night_mode = {
text = _("Night mode"),
checked_func = function() return G_reader_settings:readSetting("night_mode") end,
checked_func = function() return G_reader_settings:isTrue("night_mode") end,
callback = function()
local night_mode = G_reader_settings:readSetting("night_mode") or false
local night_mode = G_reader_settings:isTrue("night_mode") or false
Screen:toggleNightMode()
UIManager:setDirty(nil, "full")
G_reader_settings:saveSetting("night_mode", not night_mode)
Expand Down
2 changes: 1 addition & 1 deletion reader.lua
Expand Up @@ -170,7 +170,7 @@ elseif not QuickStart:isShown() then
last_file = QuickStart:getQuickStart()
end
-- night mode
if G_reader_settings:readSetting("night_mode") then
if G_reader_settings:isTrue("night_mode") then
Device.screen:toggleNightMode()
end

Expand Down