Merge pull request #525 from chrox/master

fix input timer queue
pull/527/head
Qingping Hou 10 years ago
commit a5d76d416a

@ -18,9 +18,9 @@ local CreDocument = Document:new{
engine_initilized = false, engine_initilized = false,
line_space_percent = 100, line_space_percent = 100,
default_font = "FreeSerif", default_font = G_reader_settings:readSetting("cre_font") or "FreeSerif",
header_font = "FreeSans", header_font = G_reader_settings:readSetting("header_font") or "FreeSans",
fallback_font = "Droid Sans Fallback", fallback_font = G_reader_settings:readSetting("fallback_font") or "Droid Sans Fallback",
default_css = "./data/cr3.css", default_css = "./data/cr3.css",
options = CreOptions, options = CreOptions,
} }
@ -56,16 +56,6 @@ function CreDocument:engineInit()
end end
end end
local default_font = G_reader_settings:readSetting("cre_font")
if default_font then
self.default_font = default_font
end
local header_font = G_reader_settings:readSetting("header_font")
if header_font then
self.header_font = header_font
end
engine_initilized = true engine_initilized = true
end end
end end

@ -433,15 +433,10 @@ function Input:setTimeout(cb, tv_out)
callback = cb, callback = cb,
deadline = tv_out, deadline = tv_out,
} }
for k,v in ipairs(self.timer_callbacks) do table.insert(self.timer_callbacks, item)
if v.deadline > tv_out then table.sort(self.timer_callbacks, function(v1,v2)
table.insert(self.timer_callbacks, k, item) return v1.deadline < v2.deadline
break end)
end
end
if #self.timer_callbacks <= 0 then
self.timer_callbacks[1] = item
end
end end
function Input:handleKeyBoardEv(ev) function Input:handleKeyBoardEv(ev)

Loading…
Cancel
Save