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,
line_space_percent = 100,
default_font = "FreeSerif",
header_font = "FreeSans",
fallback_font = "Droid Sans Fallback",
default_font = G_reader_settings:readSetting("cre_font") or "FreeSerif",
header_font = G_reader_settings:readSetting("header_font") or "FreeSans",
fallback_font = G_reader_settings:readSetting("fallback_font") or "Droid Sans Fallback",
default_css = "./data/cr3.css",
options = CreOptions,
}
@ -56,16 +56,6 @@ function CreDocument:engineInit()
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
end
end

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

Loading…
Cancel
Save