[Scummvm-git-logs] scummvm master -> 8fcfb7e5850ec7c4b56c0b9fd61cee552836ef0e
lotharsm
noreply at scummvm.org
Sun Mar 6 08:01:53 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8fcfb7e585 GUI: Fix bad EditTextWidget rect at low window widths
Commit: 8fcfb7e5850ec7c4b56c0b9fd61cee552836ef0e
https://github.com/scummvm/scummvm/commit/8fcfb7e5850ec7c4b56c0b9fd61cee552836ef0e
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-03-06T09:01:50+01:00
Commit Message:
GUI: Fix bad EditTextWidget rect at low window widths
Fix bug https://bugs.scummvm.org/ticket/13339
Solution is taken from our ListWidget (gui/widgets/list.cpp) which performs a similar check in its ListWidget::getEditRect()
Changed paths:
gui/widgets/edittext.cpp
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index 4a1e6005773..7af1d4225d4 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -112,7 +112,14 @@ void EditTextWidget::drawWidget() {
}
Common::Rect EditTextWidget::getEditRect() const {
- Common::Rect r(2 + _leftPadding, 1, _w - 1 - _rightPadding, _h);
+ // Calculate (right - left) difference for editRect's X-axis coordinates:
+ // (_w - 1 - _rightPadding) - (2 + _leftPadding)
+ int editWidth = _w - _rightPadding - _leftPadding - 3;
+ // Ensure r will always be a valid rect
+ if (editWidth < 0) {
+ editWidth = 0;
+ }
+ Common::Rect r(2 + _leftPadding, 1, 2 + _leftPadding + editWidth, _h);
return r;
}
More information about the Scummvm-git-logs
mailing list