mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Misc. minor fixes (#4080)
* Unbreak dropbear after #4077 * Move the Kindle SO check to init * Various virtual keyboard fixes to eradicate the remaining refresh conflicts (i.e., tearing artifacts), no matter the user's settings. (re #4069, re #3130).
This commit is contained in:
@@ -16,22 +16,6 @@ local function kindleEnableWifi(toggle)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local Kindle = Generic:new{
|
||||
model = "Kindle",
|
||||
isKindle = yes,
|
||||
}
|
||||
|
||||
function Kindle:initNetworkManager(NetworkMgr)
|
||||
NetworkMgr.turnOnWifi = function()
|
||||
kindleEnableWifi(1)
|
||||
end
|
||||
|
||||
NetworkMgr.turnOffWifi = function()
|
||||
kindleEnableWifi(0)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
Test if a kindle device has Special Offers
|
||||
--]]
|
||||
@@ -49,6 +33,10 @@ local function isSpecialOffers()
|
||||
end
|
||||
local is_so
|
||||
local loaded_blanket_modules = lipc_handle:get_string_property("com.lab126.blanket", "load")
|
||||
if not loaded_blanket_modules then
|
||||
logger.warn("could not get lipc property")
|
||||
return true
|
||||
end
|
||||
if string.find(loaded_blanket_modules, "ad_screensaver") then
|
||||
is_so = true
|
||||
else
|
||||
@@ -58,8 +46,25 @@ local function isSpecialOffers()
|
||||
return is_so
|
||||
end
|
||||
|
||||
local Kindle = Generic:new{
|
||||
model = "Kindle",
|
||||
isKindle = yes,
|
||||
-- NOTE: We can cheat by adding a platform-specific entry here, because the only code that will check for this is here.
|
||||
isSpecialOffers = isSpecialOffers(),
|
||||
}
|
||||
|
||||
function Kindle:initNetworkManager(NetworkMgr)
|
||||
NetworkMgr.turnOnWifi = function()
|
||||
kindleEnableWifi(1)
|
||||
end
|
||||
|
||||
NetworkMgr.turnOffWifi = function()
|
||||
kindleEnableWifi(0)
|
||||
end
|
||||
end
|
||||
|
||||
function Kindle:supportsScreensaver()
|
||||
if isSpecialOffers() then
|
||||
if self.isSpecialOffers then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@@ -619,7 +624,11 @@ end
|
||||
|
||||
function KindleTouch:exit()
|
||||
Generic.exit(self)
|
||||
if isSpecialOffers() then
|
||||
if self.isSpecialOffers then
|
||||
-- Wakey wakey...
|
||||
if os.getenv("AWESOME_STOPPED") == "yes" then
|
||||
os.execute("killall -cont awesome")
|
||||
end
|
||||
-- fake a touch event
|
||||
if self.touch_dev then
|
||||
local width, height = self.screen:getScreenWidth(), self.screen:getScreenHeight()
|
||||
|
||||
@@ -27,6 +27,9 @@ local VirtualKey = InputContainer:new{
|
||||
|
||||
keyboard = nil,
|
||||
callback = nil,
|
||||
-- This is to inhibit the key's own refresh (useful to avoid conflicts on Layout changing keys)
|
||||
skiptap = nil,
|
||||
skiphold = nil,
|
||||
|
||||
width = nil,
|
||||
height = math.max(Screen:getWidth(), Screen:getHeight())*0.33,
|
||||
@@ -37,15 +40,20 @@ local VirtualKey = InputContainer:new{
|
||||
function VirtualKey:init()
|
||||
if self.keyboard.symbolmode_keys[self.label] ~= nil then
|
||||
self.callback = function () self.keyboard:setLayout("Sym") end
|
||||
self.skiptap = true
|
||||
elseif self.keyboard.shiftmode_keys[self.label] ~= nil then
|
||||
self.callback = function () self.keyboard:setLayout("Shift") end
|
||||
self.skiptap = true
|
||||
elseif self.keyboard.utf8mode_keys[self.label] ~= nil then
|
||||
self.callback = function () self.keyboard:setLayout("IM") end
|
||||
self.skiptap = true
|
||||
elseif self.keyboard.umlautmode_keys[self.label] ~= nil then
|
||||
self.callback = function () self.keyboard:setLayout("Äéß") end
|
||||
self.skiptap = true
|
||||
elseif self.label == "Backspace" then
|
||||
self.callback = function () self.keyboard:delChar() end
|
||||
self.hold_callback = function () self.keyboard:clear() end
|
||||
--self.skiphold = true
|
||||
elseif self.label =="←" then
|
||||
self.callback = function() self.keyboard:leftChar() end
|
||||
elseif self.label == "→" then
|
||||
@@ -113,13 +121,23 @@ function VirtualKey:init()
|
||||
self.flash_keyboard = G_reader_settings:readSetting("flash_keyboard") ~= false
|
||||
end
|
||||
|
||||
function VirtualKey:update_keyboard()
|
||||
-- NOTE: We could arguably use "fast" when inverted & "ui" when not, but it doesn't change much,
|
||||
-- and doesn't help with the graphics quirks of repeated "fast" updates on some devices.
|
||||
UIManager:setDirty(self.keyboard, function()
|
||||
logger.dbg("update key region", self[1].dimen)
|
||||
return "fast", self[1].dimen
|
||||
end)
|
||||
function VirtualKey:update_keyboard(want_flash, want_fast)
|
||||
-- NOTE: We mainly use "fast" when inverted & "ui" when not, with a cherry on top:
|
||||
-- we flash the *full* keyboard instead when we release a hold.
|
||||
if want_flash then
|
||||
UIManager:setDirty(self.keyboard, function()
|
||||
return "flashui", self.keyboard[1][1].dimen
|
||||
end)
|
||||
else
|
||||
local refresh_type = "ui"
|
||||
if want_fast then
|
||||
refresh_type = "fast"
|
||||
end
|
||||
UIManager:setDirty(self.keyboard, function()
|
||||
logger.dbg("update key region", self[1].dimen)
|
||||
return refresh_type, self[1].dimen
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function VirtualKey:onFocus()
|
||||
@@ -131,9 +149,9 @@ function VirtualKey:onUnfocus()
|
||||
end
|
||||
|
||||
function VirtualKey:onTapSelect()
|
||||
if self.flash_keyboard then
|
||||
if self.flash_keyboard and not self.skiptap then
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
self:update_keyboard(false, true)
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
@@ -147,13 +165,13 @@ function VirtualKey:onTapSelect()
|
||||
end
|
||||
|
||||
function VirtualKey:onHoldSelect()
|
||||
if self.flash_keyboard then
|
||||
if self.flash_keyboard and not self.skiphold then
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
self:update_keyboard(false, true)
|
||||
if self.hold_callback then
|
||||
self.hold_callback()
|
||||
end
|
||||
UIManager:tickAfterNext(function() self:invert(false) end)
|
||||
UIManager:tickAfterNext(function() self:invert(false, true) end)
|
||||
else
|
||||
if self.hold_callback then
|
||||
self.hold_callback()
|
||||
@@ -162,9 +180,9 @@ function VirtualKey:onHoldSelect()
|
||||
return true
|
||||
end
|
||||
|
||||
function VirtualKey:invert(invert)
|
||||
function VirtualKey:invert(invert, hold)
|
||||
self[1].invert = invert
|
||||
self:update_keyboard()
|
||||
self:update_keyboard(hold, false)
|
||||
end
|
||||
|
||||
local VirtualKeyboard = FocusManager:new{
|
||||
|
||||
@@ -30,7 +30,7 @@ function SSH:init()
|
||||
end
|
||||
|
||||
function SSH:start()
|
||||
local cmd = string.format("%s %s %s %s%s %s %s %s",
|
||||
local cmd = string.format("%s %s %s %s%s %s",
|
||||
"./dropbearmulti dropbear",
|
||||
"-E",
|
||||
"-R",
|
||||
@@ -141,8 +141,8 @@ function SSH:addToMainMenu(menu_items)
|
||||
},
|
||||
{
|
||||
text = _("Stop SSH server"),
|
||||
callback = self.stop,
|
||||
enabled_func = self.isRunning,
|
||||
callback = function() return self:stop() end,
|
||||
enabled_func = function() return self:isRunning() end,
|
||||
},
|
||||
{
|
||||
text = _("Change SSH port"),
|
||||
|
||||
Reference in New Issue
Block a user