mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:55:08 +00:00
GWidget: Fix accidentally ignored set_relative_rect() with empty size
To protect the layout system from negative input values, we were using an empty Rect() whenever an empty rect (width/height <= 0) was provided to set_relative_rect(). This caused Terminal's scrollbar code to fail, since it relies on first setting only the scrollbar width on startup, and then setting up the proper geometry in response to the initial resize event. Fixes #753.
This commit is contained in:
parent
f92e0f7d80
commit
3a01df9fb1
1 changed files with 7 additions and 1 deletions
|
@ -101,7 +101,13 @@ void GWidget::child_event(CChildEvent& event)
|
|||
|
||||
void GWidget::set_relative_rect(const Rect& a_rect)
|
||||
{
|
||||
Rect rect = a_rect.is_empty() ? Rect() : a_rect;
|
||||
// Get rid of negative width/height values.
|
||||
Rect rect = {
|
||||
a_rect.x(),
|
||||
a_rect.y(),
|
||||
max(a_rect.width(), 0),
|
||||
max(a_rect.height(), 0)
|
||||
};
|
||||
|
||||
if (rect == m_relative_rect)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue