Commit Graph

215 Commits (510ea5963cfffbc97aa527e6ae5de2624ff8da20)

Author SHA1 Message Date
poire-z 71553a5190 Change a logger.warn() back to .dbg() as it used to be 7 years ago
Frans de Jonge cfaa119c35 [fix, UX] Allow modal widget on top of modal widget (#3170)
Fixes #2653.
7 years ago
poire-z d4fd0b9428 frontlight on kobo: a few fixes (#3163)
* frontlight on kobo: a few fixes

Rewritten to not update NickelConf on every change, and never
if KOBO_SYNC_BRIGHTNESS_WITH_NICKEL = false.
Reintroduce global settings frontlight_intensity and
is_frontlight_on to keep level and state across koreader
sessions.
Fix a few of the remaining issues on kobo light.
Ensure settings are saved when rebooting/powering off from
File browser.

* Ensure untoggle works when starting with light off
7 years ago
Hzj_jie 7d2ed4c3d0 Move kobo auto-suspension logic out of UIManager (#2933) 7 years ago
Hzj_jie 53eb4dee50 AutoFrontlight plugin (#2941)
* Add AutoFrontlight plugin

* Add configuration to control autofrontlight feature
7 years ago
Hzj_jie 30378eb2a8 Add restart koreader function and ensure FlushSettings event can be delivered to all widgets (#2772) 7 years ago
Martín Fernández 474c011f21 [kobo]: add reboot and poweroff menu actions (#2888) 7 years ago
Qingping Hou f2671a3e20 plugin(fix): catch crash in addToMainMenu 7 years ago
Frans de Jonge f1c0b4b3bb UIManager docs & lang: add some docs and correct "quiting" to "quitting" 7 years ago
Hzj_jie 3ad3452d1a System Stat plugin (#2699) 7 years ago
Hzj_jie 1a2e4f5b55 Force Kobo to suspend (#2691)
Without this change, the device resumed randomly. With this change, the device had not resumed randomly anymore. (Technically speaking, it still randomly resumed, but got suspended immediately.)
7 years ago
Hzj_jie 0b29e73e2e BatteryStat plugin and instruction of KoboLight plugin (#2643)
* Start battery stat plugin

* BatteryStat & kobolight

* Several minor improvements

* Remove a useless function

* flush settings

* Some review feedbacks

* Resolve review comments

* Remaining Minutes -> Remaining Hours

* Add dump_file

* typo

* realpath

* realpath on folder

* Remove useless os.time()

* Resolve review comments

* warning

* Add BatteryStat.debugging flag

* treat log as txt

* Minor improvement

* Charging hour should be positive

* Use warn instead of info

* onSuspend in Kobo

* Charging events for kobo and kindle

* More events

* dumpOrLog

* Warnings

* Typo

* More space

* Singleton

* slightly format change

* BatteryStat singleton

* Init

* Remove debugging flag

* sleeping percentage is still negative

* Read settings

* Do not need to change was_suspending and was_charging

* Typo

* Remove debugging flag

* Not charging should happen before suspend

* Resolve review comments

* was_suspend and was_charging should be updated each time in onCallback()
7 years ago
Qingping Hou f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 7 years ago
poire-z adbe76c156 Reset refresh rate counter on explicit full refreshs (#2394) 8 years ago
Bastien Dejean 64bc5cd63c Make the powered off state customizable
This changes the behavior of the powered off transition phase for the
Kobo devices: instead of displaying a confirmation dialog, a screensaver
is used after a 2 seconds press delay.

Users can specify separate directories/files/messages for the powered
off and sleeping states through the `path` and `message` attributes of
the `{poweroff,suspend}_screensaver` settings.

Fixes #2327 and closes #2306.
8 years ago
Qingping Hou 816d0a551a kobo: handle charging/uncharging event 8 years ago
Zijie He f36f8cb464 KOSync plugin should respect onNetworkConnected and onFlushSettings events 8 years ago
Qingping Hou 902403bf0a kobo(fix): prevent usb plug events from interrupting sleep 8 years ago
Qingping Hou 71afe3606c kobo(fix): set suspend wait timeout to 15 seconds
Otherwise, suspend might fail and the device will ended up in a false
sleep state and drain the battery.
8 years ago
Qingping Hou 4036e2c460 kobo(fix): do not wake up device when cover is closed 8 years ago
Qingping Hou 93b3262db7 kobo(fix): make sure sleep cover is not interrupting sleeping when ignore_power_sleepcover is set 8 years ago
Qingping Hou 22964a77a0 kobo(fix): always put device to suspend state when cover is closed 8 years ago
Qingping Hou ebc7055b43 chore: move kobo specific code into kobo/device.lua 8 years ago
chrox b0498ec9b9 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.
8 years ago
chrox 166aa52a24 move painting and drawing debug log to verbose 8 years ago
chrox 9ab005a1d3 fix unit test of readerlink and readerpaging
and have more confidence with the unit testing framework.

Now `make testfront` won't retry on failure and testing files are
ordered in each run so that it's possible to reproduce testing failure.

And this patch also fix flush settings not working before suspend issue:
at some point the `FlushSettings` event is sent to `UIManager` instead
of `ReaderUI`, but `UIManager` only delegated events to active widgets
and `ReaderUI` is actually not an active widgets thus will miss the event.

This patch also add a verbose debug mode with "-v" as a switch to turn
on this mode. With verbose mode on, event handling will be logged.
8 years ago
bingo619 43797ed813 Oasis orientation 8 years ago
chrox 41c79407b9 diable double tap by default in the widget stack
This should fix #2141 and fix #2130.
8 years ago
chrox 551857ce6e fix some luacheck warnings 8 years ago
chrox 03fda94562 fix #2110 by adding disable double tap option in screen options 8 years ago
chrox 3d7fe1002c we should disable double tap by default
Currently only column-zoom mode in PDF uses double tap gesture.
8 years ago
Qingping Hou 7d13d00eff uimanager(fix): honor second when calling Input:waitEvent 8 years ago
Qingping Hou fadad90447 uimanager(fix): handle stack change in close 8 years ago
Qingping Hou af2f3c30c7 uimanager(fix): handle last widget in broadcast event properly 8 years ago
chrox 5983050d79 PDF free zoom mode revisit
this should implement feature request of zoom mode for multi-columns
page in #501
This PR depends on koreader/koreader-base#435

How to use?
1. Tap the top left corner of a PDF/Djvu page to get into the flipping
mode
2. Double-tap on text block will zoom in to that column
3. Double-tap on any area will zoom out to an overview of the page
4. repeat step 2 to focus to another page block

How does it work?
1. We first find the mask of text blocks in the page. (Pic 1)
2. Then we intersect page boxes with user tap to form a page block. (Pic 2)
3. Finally we zoom the page to the page block and center current view to
that block. (Pic 3)
8 years ago
Qingping Hou ce7ae2dfac uimanager(fix): handle edge case where second widget in stack is ignored 8 years ago
Qingping Hou 8268d8d32c test(fix): clean up after screenshot test 8 years ago
Qingping Hou a92a88e063 uimanager(fix): check active widgets in the correct order 8 years ago
Qingping Hou 42dde82c43 uimanager(minor): simplify suspend event handler's signature 8 years ago
Cosmin Gorgovan 19338cb439 Kobo: Offer to power off if the power button is held for at least 3 seconds 8 years ago
Cosmin Gorgovan 18c0cee18f UIManager: add method for broadcasting an event to all widgets 8 years ago
Qingping Hou eb71d29716 kodev(minor): fix arg test 8 years ago
Qingping Hou 0166ff8add reader(fix): force draw info message before loading document
Since the doShowReader will run in nextTick, it will get picked up by
checkTask, which is in the beginning of next UI loop and blocks
UIManager from redrawing the screen for the info popup.
8 years ago
Qingping Hou 144fd170f1 uimanager(refactor): replace autosuspend if check with noop 8 years ago
Qingping Hou e3137134f8 dbg(add): guard method to toggle assert at based at runtimemode 8 years ago
Zijie He b86aa5a02b Implement auto-suspend function for Kobo. Add test case for UIManager:_checkTasks, which should not clear _task_queue_dirty bit before looping. 8 years ago
Qingping Hou e52c74afcc test: more uimanager scheduler test 8 years ago
NiLuJe a82fe3ac44 is_fl_on -> is_frontlight_on outside of powerd
Matches the reader setting we're reading/writing at that point,
and avoids confusion related to scoping because it doesn't necessarily
match powerd.is_fl_on at that point.

Well, at least I had to wrap my mind around it ^^
8 years ago
Qingping Hou 399d676cf0 kobo: rename frontlight_state config to is_frontlight_on 8 years ago
Qingping Hou cf3b97537b kobo: build fl_state based on fl_intensity if model does not support toggle 8 years ago
zijiehe e84093c414 Add a flState in Kobo, and KoboPowerD:toggleFrontlight uses flState to control the light instead of intensity. 8 years ago
Qingping Hou b63ddb8736 fix: kill in fly hinting event on document close 8 years ago
Qingping Hou 1f082d7f5c build: fix travis build 8 years ago
Qingping Hou e422842256 minor: a lot of luacheck fixes 8 years ago
Qingping Hou 1609becd61 Merge pull request #1772 from dset0x/frontlight-sync
WIP Synchronise frontlight level with nickel config
8 years ago
Qingping Hou 5a3b9c6856 style: make staick-check happier 8 years ago
Dimitrios Semitsoglou-Tsiapos 699781de68 nickel_conf: handle missing file/key/section 8 years ago
Dimitrios Semitsoglou-Tsiapos eb47c5a39f Synchronise frontlight level with nickel config
* Drops support for mocking the frontlight setting internally which may
  cause incorrect in-memory values.

* Adds new supported value for `KOBO_LIGHT_ON_START` (-2), which sets
  'Kobo eReader.conf' as the source to update `settings.reader.lua`'s
  brightness setting on startup, thus using the value from it
  indirectly.

* Adds the `KOBO_SYNC_BRIGHTNESS_WITH_NICKEL` configuration variable
  which updates 'Kobo eReader.conf' every time the brightness setting is
  changed within koreader.

* Fixes missing call to save brightness when modifying via two-finger
  swipe.

Closes #1523.
8 years ago
Qingping Hou 6fe9f7870b chore: more luacheck fixes 9 years ago
Qingping Hou b1a1aeca0a fix(task scheduler): many race conditions
_checkTasks first get number of tasks in the stack and does a numeric
for loop to go through each task. The problem is a task might call
schedule or unschedule, which will reorder tasks in the stack. This will
invalidate many of the table indexes used in the for loop.

This patch turns the task stack into an ordered queue, so _checkTasks
only pops one item out of the queue each time instead of setting up a
for loop at the beginning. This should avoid the race condition
mentioned above.
9 years ago
chrox c7cac7b333 disable turbo lib by default 9 years ago
chrox d468b05567 Use turbo looper on Android 9 years ago
chrox 8836225cec fix freeze when register for KOSync on Kindle 9 years ago
chrox d3bb0d159a disable Turbo on Android to save precious mcode
This is a workaround to fix #1456.
9 years ago
chrox 9299b9a5e8 add async http client
it uses non-blocking turbo I/O looper to process http request
so that multiple http request can be handled simultaneously and http request
won't block user input, and most importantly, in Lua's way.
9 years ago
chrox 6a06cfaea5 refactor out flush settings when device goes into screensaver 9 years ago
chrox 8555f24c45 make sure refresh_count is incremented by only once at most for each repaint 10 years ago
Hans-Werner Hilse 844c1babf7 UIManager:_refresh(): no more default refresh
If no refresh type is specified, don't do a refresh.
There should be now refresh types specified in all relevant places.
10 years ago
Hans-Werner Hilse 9c4088a3ac small change of UIManager:show(): No more automatic refresh
This eliminates the API difference between the extra parameters of
UIManager:show() and setDirty(). They work the same now.
Note that this also eliminates the automatic refresh that took place
before when using show() without refresh options. It always refreshed
the full screen, which led to too big refresh regions all over the
place. Thus, refresh has now explicitly to be asked for, hopefully
encouraging to implement it in the widget that gets shown (and is
aware about the screen region it covers).

Also add an event that is triggered when a widget is closed:
CloseWidget. So a widget can implement "onCloseWidget()" to trigger
actions upon closing - most commonly, this is a refresh for the area
previously taken by the widget. That way, the widget's user does not
have to take measures to ensure that the area is refreshed later.
10 years ago
Hans-Werner Hilse 1091a8a3b9 add refresh control to UIManager:close() 10 years ago
Hans-Werner Hilse afb59667c0 allow for more control on refreshes when show()ing widgets
for now, we have show() automatically call setDirty() for the new
widget, as before. However, now show() takes two arguments for
refresh configuration that will get passed on to setDirty().

For compatibility, the default is here in show() to do a partial
refresh. So if you want no refresh triggered (via this show() call),
add a function that doesn't return anything.
10 years ago
Hans-Werner Hilse 229c5ad61c change setDirty/refresh API
See documentation in the code.
In short: There is now one single method, setDirty(), that triggers
repaints and/or refreshes.
All variables in UIManager are gone - at least from an external
perspective. Everything is done through setDirty().
This also allows for easier debugging, since all requests come
in via function calls.
10 years ago
Hans-Werner Hilse 2f9386cd69 move refresh menu table out of UIManager
no need to clutter a core file of the whole UI concept with definitions
of UI elements
10 years ago
Frans de Jonge 66f04af8fb Various applications of util.template
This is the first bunch for #1276. I'd like to resolve #1281 before doing more.
10 years ago
Hans-Werner Hilse 21ded080dd fix refactor bug: invalidate update_regions_func 10 years ago
Hans-Werner Hilse 8696ca1fa1 fix old (pre-refactor) refresh call syntax 10 years ago
Hans-Werner Hilse 63af71188a refactor refresh
Lots of the device-related distinction wandered into
base/ffi/framebuffer_<driver>. This eases the refresh logic in
UI manager, which basically only decides what kind of refresh
to trigger. The device specific configuration in the framebuffer
driver decides how to realize that whish.

screen.lua is gone, in its place is now the framebuffer driver.
The device abstraction decides what framebuffer driver to load.
10 years ago
NiLuJe 9bd089812b Tweaks and fixes for refresh logic
Don't increase counter for regional updates
Also some workarounds for Kobos

Try to avoid update_regions_func poisoning

Reset it at the end of repaint() even if nothing was found dirty

Ensure regional updates are always PARTIAL, in
case we get a region attached to an automatically triggered refresh, not
marked force_partial [which, hey, shouldn't happen, but apparently does
sometimes ^^]
10 years ago
Hans-Werner Hilse 45cf927ee8 Fix double-check of task list
Since commit 12a76fee33, we had a potential
bug on the event mechanism:

It introduced (besides the checkTasks method itself) a second run of the
checkTasks() method. In the second run, however, scheduled events were
not taken into consideration in how long to wait for input events
afterwards.

So when the after the first run of checkTasks() there were new scheduled
tasks added to the task queue, they were not properly scheduled and
and depended on an already existing scheduled event or an input event
to trigger.

This might have led to unexpected order of execution (though the order
is not guaranteed by the task scheduling anyway!) or to events triggering
not at all until the next input event.
10 years ago
Hans-Werner Hilse c22dbbe3ae factor out repaint to its own method
it's gotten complex enough to isolate it
10 years ago
NiLuJe 13cbed8ea5 Fix partial refreshes on older Kobo devices
Fix #1146 (regression).
10 years ago
NiLuJe 3d5dd44a4c Don't hijack "fast" UI refresh w/ the REAGL stuff 10 years ago
NiLuJe 859031222e Simplify the H2O special-casing
re #1119

AUTO appears to be doing the right thing...
(even if that baffles me, given the state of the Kernel sources,
unless they flip some switches at compile time
[NTX_WFM_MODE_OPTIMIZED_REAGL / NO_AUTO_REAGL_MODE] ...)

Anyway, that's what nickel does, so follow its lead ;).
10 years ago
NiLuJe d018a31b0a Me speak english good. ya! 10 years ago
NiLuJe dbe816062b Be consistent in how we refer to stuff 10 years ago
NiLuJe 041f11cba0 Tweak some comments 10 years ago
NiLuJe a4a50b3d0d Fix the REAGL logic.
Never use REAGL to handle UI elements. It makes for a much smoother
experience.
10 years ago
NiLuJe 656a2c7cb6 Actually do what the comment says.
Don't hijack forced partial updates (i.e., from UI elements) on always
FULL REAGL devices. It doesn't implode if we don't, and it makes for a
snappier UI.
10 years ago
NiLuJe 3ce10b697a Moar comments! 10 years ago
NiLuJe 8cfbcca7c5 More comments on the H2O weirdness... 10 years ago
NiLuJe a44c5e99d1 Use the proper constants for Kobo's waveform modes 10 years ago
NiLuJe a2f107075d Shot in the dark at matching the H2O's behavior... 10 years ago
Frans de Jonge ca75b7a030 Add usage note to unschedule 10 years ago
NiLuJe d340159de8 Simplify the whole wait_for_marker commit.
Companion commit to the same stuff in base ;).
10 years ago
NiLuJe cd7e9c3257 First stab at revamping the wait for marker stuff
WIP, untested, can probably simplified some more.
Good news is, it should be smarter, and thus provide a smoother user
experience :).
Relies on the relevant changes in base.
10 years ago
NiLuJe d488ca43fa Some potentially fun stuff TODO :) 10 years ago
NiLuJe ed6f027d68 Whee, the eink driver was updated for the KT2/KV! 10 years ago
NiLuJe 76c3a3aa44 Minor comment tweaks 10 years ago
NiLuJe b3137736c8 Don't highjack regional updates on REAGL devices
We wouldn't want those to become full updates ;).
Also apply an optionally different waveform mode for such partial,
regional updates (right now, only Kindle devices make use of this finer
grained control).
10 years ago
NiLuJe 25adccbcd6 More notes for tomorrow 10 years ago