revert 9ab005a changes to UIManager:sendEvent

which would make readerui handle swipe event twice.

And use broadcastEvent to emit `FlushSettings` event.

This should fix #2225 and fix #2226.
pull/2227/head
chrox 8 years ago
parent e80b62a535
commit b0498ec9b9

@ -90,7 +90,7 @@ function Device:intoScreenSaver()
os.execute("killall -cont awesome")
end
end
UIManager:sendEvent(Event:new("FlushSettings"))
UIManager:broadcastEvent(Event:new("FlushSettings"))
end
-- ONLY used for Kindle devices
@ -121,7 +121,7 @@ function Device:onPowerEvent(ev)
local UIManager = require("ui/uimanager")
-- flushing settings first in case the screensaver takes too long time
-- that flushing has no chance to run
UIManager:sendEvent(Event:new("FlushSettings"))
UIManager:broadcastEvent(Event:new("FlushSettings"))
DEBUG("Suspending...")
-- always suspend in portrait mode
self.orig_rotation_mode = self.screen:getRotationMode()

@ -402,7 +402,7 @@ function UIManager:sendEvent(event)
end
end
-- if the event is not consumed, widgets (from top to bottom) can
-- if the event is not consumed, active widgets (from top to bottom) can
-- access it. NOTE: _window_stack can shrink on close event
local checked_widgets = {top_widget}
for i = #self._window_stack, 1, -1 do
@ -416,11 +416,13 @@ function UIManager:sendEvent(event)
if active_widget:handleEvent(event) then return end
end
end
-- ordinary widgets will handle this event
-- Note: is_always_active widgets currently are vitualkeyboard and
-- readerconfig
checked_widgets[widget] = true
if widget.widget:handleEvent(event) then return end
if widget.widget.is_always_active then
-- active widgets will handle this event
-- Note: is_always_active widgets currently are vitualkeyboard and
-- readerconfig
checked_widgets[widget] = true
if widget.widget:handleEvent(event) then return end
end
end
end
end

Loading…
Cancel
Save