refactor/gtk4: fix scaling issues#43
Open
fufexan wants to merge 4 commits intoStremio:refactor/gtk4from
Open
Conversation
Replace GLArea with Widget + GdkMemoryTexture for sharp rendering at fractional scales. CEF OSR doesn't apply device_scale_factor to paint buffers, so we bypass it entirely: give CEF device pixel dimensions as view_rect with device_scale_factor=1, and use zoom level for DPI compensation. Mouse coordinates are scaled to device pixels before forwarding to CEF. Listen for GdkSurface 'scale' property changes (fractional) instead of widget 'scale-factor' (integer) to properly handle cross-monitor moves. Queue widget allocate on scale change to recompute device pixel dimensions. Remove debug logging added during investigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3413145 to
0b83716
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I've been experiencing scaling issues such as:
I have no idea how to debug and fix all these issues on my own so I used Claude Opus 4.6. Here's its summary:
Root cause: CEF's OSR mode ignores
device_scale_factorfor paint buffer size — it always renders at 1×view_rectdimensions. The oldGLAreacode upscaled this via GL, and fractional scaling made it worse.Solution (across all commits):
GdkMemoryTexturereplacesGLArea— CPU frame buffer with dirty rect blitting, rendered via GTK's snapshot pipeline at exact fractional scaleview_rect= device pixels withdevice_scale_factor=1— CEF renders at native resolutionln(scale)/ln(1.2)— compensates DPI so content layouts at correct CSS sizescaleproperty listener — detects fractional scale changes when moving between monitorsqueue_allocate()on scale change — forces recomputation of device pixel dimensionsI don't know whether this code is robust or pragmatic, and some of the changes feel intrusive. Feel free to change in any way necessary.