-
Notifications
You must be signed in to change notification settings - Fork 40
[SWM-202][fix] GUI toolbar incorrect positionning when screen has High DPI scaling #3299
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
[SWM-202][fix] GUI toolbar incorrect positionning when screen has High DPI scaling #3299
Conversation
…ling When the scaling of the scaling is not 100%, the bitmap size is automatically adjusted (ie, rescaled proportionally). However, the toolbar used this information to adjust the toolbar size, which is in "DIP" (Device Independent Pixel), meaning the value should be passed assuming it's not scaled. This caused the toolbar to be shown too large when the scaling > 100%. Mostly noticeable on Ubuntu 24.04, with multiple screens, where the scaling is automatically adjusted based on the screen DPI.
📝 WalkthroughWalkthroughThe changes refactor how bitmap controls are created and added to the toolbar in Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a GUI toolbar positioning issue that occurs when the display uses High DPI scaling (scaling > 100%). The problem was that bitmap sizes were being accessed after they were scaled by the display, but the toolbar sizing logic required Device Independent Pixel (DIP) values.
Key Changes:
- Refactored bitmap loading to store
wx.Bitmapobjects directly instead of immediately wrapping them inwx.StaticBitmap - Changed size calculations to use bitmap dimensions directly (
first_bmp.Width/Height) to get unscaled DIP values - Simplified orientation check logic using bitwise AND operator
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@pieleric I don't see how this PR relates to the Jira issue, could you add some screenshots here on in Jira to show what this fix does? https://delmic.atlassian.net/browse/SWM-202 |
Yes, it's the middle (vertically) of the tool bar which was too wide. I've added screenshots in the description. |
When the scaling of the scaling is not 100%, the bitmap size is
automatically adjusted (ie, rescaled proportionally). However, the
toolbar used this information to adjust the toolbar size, which is in
"DIP" (Device Independent Pixel), meaning the value should be passed
assuming it's not scaled.
This caused the toolbar to be shown too large when the scaling > 100%.
Mostly noticeable on Ubuntu 24.04, with multiple screens,
where the scaling is automatically adjusted based on the screen DPI.
Before:


After: