Skip to content

[Readtimer] bug fix: fix focus when setting a timer.#14420

Merged
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:readtimer
Oct 14, 2025
Merged

[Readtimer] bug fix: fix focus when setting a timer.#14420
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:readtimer

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Oct 5, 2025

Copy link
Copy Markdown
Member

bug fix

  • Added a non_touch_with_action_dpad property to both DateTimeWidget and SpinWidget to simplify device capability checks and reuse the logic throughout the widget lifecycle.
  • Updated addWidget methods in both widgets to reset focus after a new widget is added, ensuring the FocusManager correctly tracks the UI and D-pad navigation remains functional.

related issues


This change is Reviewable

@hius07

hius07 commented Oct 6, 2025

Copy link
Copy Markdown
Member

Do we have the same problem in SpinWidget and others with addWidget()?

@Commodore64user

Commodore64user commented Oct 6, 2025

Copy link
Copy Markdown
Member Author

I don't know, I don't think there are any spin widgets that add other buttons after creation, or are they?

@hius07

hius07 commented Oct 6, 2025

Copy link
Copy Markdown
Member

warmth_spinner:addWidget(self.night_mode_check_box)

@Commodore64user

Copy link
Copy Markdown
Member Author

regular non-touch devices don't have front lights so not a problem there, however, yes, technically speaking it is a problem there as well.

@Frenzie

Frenzie commented Oct 6, 2025

Copy link
Copy Markdown
Member

Is the issue about non-touch or is it about FocusManager in general?

Edit: already asked and answered #14236 (comment)

In that case I suppose it should work with a regular touch device and a BT keyboard without this patch?

@hius07

hius07 commented Oct 6, 2025

Copy link
Copy Markdown
Member

So can it be fixed generally in SpinWidget?
What about other widgets supporting addWidget()? Like InputDialog. If it is good, can we use the similar solution?

@Commodore64user

Copy link
Copy Markdown
Member Author

the issue stems from those widgets not knowing what to do when during init, focus is set on the Ok button and later on, new buttons are added to them, I believe is the widgets who are at fault here not Focus Manager as this patch demonstrates that a simple refocus snaps it back into place.

this is only a problem on hasDPad and useDPadAsActionKey and not isTouch so, yes, BT + touch device should be fine.

@Commodore64user

Copy link
Copy Markdown
Member Author

So can it be fixed generally in SpinWidget? What about other widgets supporting addWidget()? Like InputDialog. If it is good, can we use the similar solution?

we only move focus to the ok button on SpinWidgets, so again, not a problem elsewhere. although technically speaking, if that where to change, then probably it would be an issue...

@hius07

hius07 commented Oct 6, 2025

Copy link
Copy Markdown
Member

Can you move the focus right after

function DateTimeWidget:addWidget(widget)
table.insert(self.layout, #self.layout, {widget})

The same in SpinWidget.

@Commodore64user

Commodore64user commented Oct 6, 2025

Copy link
Copy Markdown
Member Author

I... ( [slow motion] logic slaps me in the face) hadn't thought about that, that actually might be a better way.

@Commodore64user

Copy link
Copy Markdown
Member Author

@Frenzie do you know why the mouse suddenly works in the emulator when running the -t flag?

@Frenzie

Frenzie commented Oct 7, 2025

Copy link
Copy Markdown
Member

Hasn't it always, with the caveat that it depends what you click on? The point is to have the same menus and focus/keyboard behavior, not to painstakingly prevent anything that "shouldn't" happen that wouldn't happen if you didn't do it. (It is to a small extent in the sense of not wasting a little bit of memory; if you're thinking of something specific I'd say you're the most likely culprit since who else has been playing with the conditions. ;-)

@Commodore64user

Copy link
Copy Markdown
Member Author

I remember it not working (the mouse) at all with -t, but then again my mouse experience hasn't been quite exemplary thus far, hence my asking. I haven't changed anything regarding mice though. I certainly don't remember being able to access books from FM with it though

@Frenzie

Frenzie commented Oct 7, 2025

Copy link
Copy Markdown
Member

That's just one of the places that's never put any isTouchDevice() conditions around Tap and Hold gestures afaik. It'll waste a few dozen bytes of memory and that's about it. I doubt you'd gain more than a few kilobytes at most if you went around trying to prevent all that, maybe not even a kilobyte, but I suppose it could work as a micro-optimization if @poire-z's okay with it. Nothing wrong with saving a few kB after all, just extremely low hanging fruit.

@poire-z

poire-z commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

No real idea what you're talking about :)
Too many "it" in these last messages for me to guess what "it" could be :/

@Commodore64user

Copy link
Copy Markdown
Member Author

it could be that it was that way that it worked before or it could be that it was not that way it worked before?

@Commodore64user

Copy link
Copy Markdown
Member Author

🤓

@Frenzie

Frenzie commented Oct 14, 2025

Copy link
Copy Markdown
Member

No real idea what you're talking about :) Too many "it" in these last messages for me to guess what "it" could be :/

Oh, I missed this. I meant I see no particular value in preventing being able to tap on things in non-touch mode occasionally but I'm fine if someone wishes to do it to micro-optimize a few kB of memory.

@Frenzie Frenzie merged commit 4557ee9 into koreader:master Oct 14, 2025
4 checks passed
@Frenzie Frenzie added this to the 2025.10 milestone Oct 14, 2025
@Commodore64user Commodore64user deleted the readtimer branch October 14, 2025 12:39
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read timer unresponsive on kindlt NT.

4 participants