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

SDL: distinguish between window size and screen size #1610

Merged
merged 2 commits into from
May 13, 2023

Conversation

hrdl-github
Copy link
Contributor

@hrdl-github hrdl-github commented May 12, 2023

Pointer input and window resize events use window coordinates. Fixes
koreader/koreader#10420.

I've tested this using SDL's wayland and x11 backends on both sway and plasma-wayland using no scaling, 150% and 200% output scaling. Scaling produces bad results on sway with the x11 backend, but it has done so before. I don't have access to macOS or a Windows system for testing.


This change is Reviewable

@hrdl-github
Copy link
Contributor Author

It looks like the wrong render size is used at start-up when using ["start_with"] = "last", configured in settings.reader.lua. I'll look into this later today.

SDL_GetWindowSize can be used to obtain the window size in logical
points
@hrdl-github hrdl-github force-pushed the fix_wayland_scaling branch from 7b64096 to b837ce2 Compare May 12, 2023 11:46
@hrdl-github
Copy link
Contributor Author

I've created a new issue for the issue I described: koreader/koreader#10427, as it was already present before my modifications. I'm also not entirely sure how to go about it.

hrdl-github added a commit to hrdl-github/koreader that referenced this pull request May 12, 2023
Related to koreader/koreader-base#1610. Not sure if this is actually
needed, but for consistency the render buffer size should be used.
Frenzie pushed a commit to koreader/koreader that referenced this pull request May 12, 2023
Related to koreader/koreader-base#1610. Not sure if this is actually
needed, but for consistency the render buffer size should be used.
ffi/SDL2_0.lua Outdated Show resolved Hide resolved
@Frenzie
Copy link
Member

Frenzie commented May 12, 2023

I don't have access to macOS or a Windows system for testing.

No surprise really, but it works on macOS. 👍

The Windows build is unmaintained, so no one can test that without a time investment to fix it up.

Pointer input and window resize events use window coordinates. Fixes
koreader#10420.
@hrdl-github hrdl-github force-pushed the fix_wayland_scaling branch from ea83968 to c8252a8 Compare May 12, 2023 22:23
@Frenzie Frenzie merged commit 0f59e6a into koreader:master May 13, 2023
@Frenzie
Copy link
Member

Frenzie commented May 13, 2023

Thanks!

@hrdl-github hrdl-github deleted the fix_wayland_scaling branch May 13, 2023 08:55
NiLuJe added a commit to koreader/koreader that referenced this pull request May 14, 2023
Frenzie pushed a commit that referenced this pull request Jun 29, 2023
Fix koreader/koreader#10502, regression since #1610

Well, only the size is a regression (plus, it was sortof an ffi/framebuffer API break, even if SDL is quirky in that fb.h / fb.w might not match fb.bb's dimensions because HiDPI shenanigans).

The position one is a bit of a mystery, we get an initial move event no matter what, for some reason, and without the explicit set, it's at the top left despite passing the right stuff to CreateWindow o_O.

Also dropped a duplicate openGameController call, as we handle it via an SDL_CONTROLLERDEVICEADDED event already.
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.

2 participants