Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kindle Scribe: Fix KindleUI L and R orientations when restarting KOReader book in landscape #11780

Merged

Conversation

mergen3107
Copy link
Contributor

@mergen3107 mergen3107 commented May 8, 2024

Fixes #11743

It turns out that KOReader can only digest U or D orientations.
These are 0 and 2 in the list below:

self.screen.DEVICE_ROTATED_UPRIGHT =  0 
self.screen.DEVICE_ROTATED_CLOCKWISE =  1 
self.screen.DEVICE_ROTATED_UPSIDE_DOWN =  2 
self.screen.DEVICE_ROTATED_COUNTER_CLOCKWISE =  3

1 and 3 cause the touch to be misaligned with the visible rendered UI by 90 degrees if a KOReader book has been exited in KOReader's "landscape" orientation, and I don't really know why. Probably, because KOReader "rotates" the UI (or touch layer?) by 90 degrees when it is in "landscape" mode.

Having U/L and D/R in the same groups worked well.
If Kindle is started in L, KOREader will greet the user in the same orientation, if the KOReader book has been left in that "landscape" orientation.


This change is Reviewable

@mergen3107
Copy link
Contributor Author

Tested well in Kindle Scribe.

I don't know if Kindle Oasis 1, 2, 3 are victims of the same trap.

If so, let me know, and I can make another PR.

Thanks!

@mergen3107 mergen3107 changed the title Kindle Scribe: Fix KindleUI L and R orientations when starting KOReader Kindle Scribe: Fix KindleUI L and R orientations when restarting KOReader book in landscape May 8, 2024
@mergen3107
Copy link
Contributor Author

@Frenzie
If @NiLuJe approves, it is ready to merge.

@Frenzie Frenzie added this to the 2024.05 milestone May 8, 2024
@Frenzie Frenzie added the Kindle label May 8, 2024
@Frenzie
Copy link
Member

Frenzie commented May 8, 2024

I'm not sure I quite understand. This means the system is transparently turning everything around and the problem lies in trying to handle it?

@mergen3107
Copy link
Contributor Author

I don't know exactly, but it seems system doesn't like when KOReader rotates it to 1 or 3.

There are two weird things I still don't understand:

  1. When I open Kindle UI book from U, and make it landscape, the book rotates to R physically, but the lipc still reports U.
    Then if I rotate by gyro back and forth, it rotates and reports L/R respectively.

  2. If I then quit to Kindle UI, it physically only stays in U. It reports the old L or R. This is exactly when KOReader was broken if I tried to start it here.

If I rotate to U/D in Kindle UI, it reports U/D respectively.

So I found a very narrow use case when KOReader broke.

This PR fixed it.

@mergen3107
Copy link
Contributor Author

Regular modes (U/D) didn't break, so all good.

@NiLuJe
Copy link
Member

NiLuJe commented May 9, 2024

Sounds.... weird, but whatever ^^.

It does make some mild sort of sense that they'd be handling the orientation swap somehow :?

@mergen3107
Copy link
Contributor Author

Yeah, I am still confused every time I try to implement hardware rotation as suggested in #11269 (see my comments in the end).

It seems like system is trying to override the orientation at least upon exit.

I'll try to iron out these issues later too

@mergen3107
Copy link
Contributor Author

Should I wait until #11807 and co. are merge and update my PR?

Or do you guys want to merge this first?

@NiLuJe
Copy link
Member

NiLuJe commented May 12, 2024

That shouldn't conflict, I think?

@mergen3107
Copy link
Contributor Author

Yes, they don't conflict.
I just needed to manually apply my PR again after successful tests with your PRs.

I don't know whether it needs to be rebased for this PR, for example, after applying your PRs. And vice versa

@NiLuJe
Copy link
Member

NiLuJe commented May 12, 2024

Yep, I meant "conflict" in those very git merge terms ;p.

The patch hunks look separate enough that it shouldn't be a problem either way ;).

(If in doubt, merge this one first, I'll rebase; the other needs a base bump anyway).

@mergen3107
Copy link
Contributor Author

Thanks!
@Frenzie could you please merge this PR?

@Frenzie Frenzie merged commit 8a316f9 into koreader:master May 14, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kindle Scribe: Orientation broken if launched after Kindle Reader's Landscape
3 participants