Repository navigation
Fix engine size not being changed on DPI changes - #12713
1 commit merged into
Conversation
| // Don't actually resize if viewport dimensions didn't change | ||
| if (vp.Height() == currentVP.Height() && vp.Width() == currentVP.Width()) | ||
| { | ||
| return; | ||
| } |
There was a problem hiding this comment.
This is the bug fix. The rest are "performance-restoration-refactorizations" to limit calls to _refreshSizeUnderLock.
| _actualFont = { fontFace, 0, fontWeight.Weight, { 0, fontHeight }, CP_UTF8, false }; | ||
| _actualFontFaceName = { fontFace }; | ||
| _desiredFont = { _actualFont }; | ||
| const auto sizeChanged = _setFontSizeUnderLock(_settings->FontSize()); |
There was a problem hiding this comment.
The previous code was a carbon copy of _setFontSize and I've deduplicated the code.
The new _setFontSizeUnderLock returns true if _refreshSizeUnderLock needs to be called. The old _setFontSize was missing that check, so this is a fix to limit calls to _refreshSizeUnderLock.
| cx = std::max(cx, _actualFont.GetSize().X); | ||
| cy = std::max(cy, _actualFont.GetSize().Y); |
There was a problem hiding this comment.
The previous code would just return early if the size was too small, but then we wouldn't call SetWindowSize... So I turned it into a std::max.
|
Dustin L. Howett (@DHowett) A minimal change for 1.12: release-1.12...dev/lhecker/11317-dpi-change-fix-1.12 |
| void ControlCore::_setFontSize(int fontSize) | ||
| // Return Value: | ||
| // - Returns true if you need to call _refreshSizeUnderLock(). | ||
| bool ControlCore::_setFontSizeUnderLock(int fontSize) |
There was a problem hiding this comment.
Oh. So it's not doing it "under lock". It's saying that you should call this only if you're under a lock.
There was a problem hiding this comment.
Yeah, there's another function with a similar name pattern.
|
Hello Dustin L. Howett (@DHowett)! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Previously we would only call `SetWindowSize` and `TriggerRedrawAll` if the viewport size in characters changed. This commit removes the limitation. Since the if-condition limiting full redraws is now gone, this commit moves the responsibility of limiting the calls up the call chain. With `_refreshSizeUnderLock` now being a heavier function call than before, some surrounding code was thus refactored. ## PR Checklist * [x] Closes #11317 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed Test relevant for #11317: * Print text, filling the entire window * Move the window from a 150% scale to a 300% scale monitor * The application works as expected ✅ Regression tests: * Text zoom with Ctrl+Plus/Minus/0 works as before ✅ * Resizing a window works as before ✅ * No deadlocks, etc. during settings updates ✅ (cherry picked from commit 9fa4169)
|
🎉 Handy links: |
|
🎉 Handy links: |
Previously we would only call
SetWindowSizeandTriggerRedrawAllif theviewport size in characters changed. This commit removes the limitation.
Since the if-condition limiting full redraws is now gone, this commit
moves the responsibility of limiting the calls up the call chain.
With
_refreshSizeUnderLocknow being a heavier function callthan before, some surrounding code was thus refactored.
PR Checklist
Validation Steps Performed
Test relevant for #11317:
Regression tests: