Repository navigation
Make the BodyCaptcha editor window scale and resize - #143
Merged
Merged
Conversation
The editor called set_mode((W, H)) with no flags, so it opened a fixed 1060x700 window with no resize grip. Those constants assume a ~1080p display; on a HiDPI panel under Wayland/XWayland with no compositor upscaling, that is 1060x700 physical pixels — roughly a third of a 3072x1920 screen — and the window manager has nothing to drag. Adding SCALED lets SDL open the window at a device-appropriate size while the code keeps drawing into the 1060x700 surface all the layout math depends on (_cell_size, _grid_origin, _thumb_rects). RESIZABLE makes it draggable. Mouse positions from both ev.pos and pygame.mouse.get_pos() are translated back to surface coordinates, so grid and thumbnail hit-testing is unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
bodycaptcha_editor.pyopened a fixed, non-resizable window that renders very small on a HiDPI display.Why
Two separate causes, both at
set_mode:W, H = 1060, 700assumes a ~1080p display. On a 3072x1920 panel under Wayland/XWayland withxwayland-native-scalingenabled, SDL reports the desktop at full native resolution and nothing upscales the window — so it is 1060x700 physical pixels, about a third of the screen width.RESIZABLEflag, so the window manager has no resize handle.SCALEDis the right lever rather thanRESIZABLEalone: the layout is computed from theW/H/GRID_Wconstants throughout (_cell_size,_grid_origin,_thumb_rects), so a bare resizable window would leave a 1060x700 image in the corner of a larger frame.SCALEDkeeps that math intact and lets SDL scale the result.The two sibling tools (
app.py,body_grid_tester.py) avoid this by runningFULLSCREEN | NOFRAME; the editor was the only one showing a fixed windowed size.Testing
ev.posandpygame.mouse.get_pos();SCALEDtranslates both back into surface space, so hit-testing is unaffected.test_bodycaptcha_levels.pypasses (7 tests). Note it covers level data, not the display layer — there is no automated coverage of this line.No open issue tracks this; found while running the editor locally.
🤖 Generated with Claude Code