make parents dirty when a widget resizes
save the fixed_width/fixed_height when doing an internalResize
This commit is contained in:
parent
3b39804835
commit
38345bf32e
1 changed files with 16 additions and 5 deletions
|
@ -154,6 +154,13 @@ void Widget::setGeometry(int x, int y, int width, int height)
|
||||||
_rect = Rect(x, y, width, height);
|
_rect = Rect(x, y, width, height);
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
|
||||||
|
// make all parents dirty too
|
||||||
|
Widget *p = _parent;
|
||||||
|
while (p) {
|
||||||
|
p->_dirty = true;
|
||||||
|
p = p->_parent;
|
||||||
|
}
|
||||||
|
|
||||||
// don't use an XMoveResizeWindow here, because it doesn't seem to move
|
// don't use an XMoveResizeWindow here, because it doesn't seem to move
|
||||||
// windows with StaticGravity? This works, that didn't.
|
// windows with StaticGravity? This works, that didn't.
|
||||||
XResizeWindow(**display, _window, width, height);
|
XResizeWindow(**display, _window, width, height);
|
||||||
|
@ -331,7 +338,6 @@ void Widget::adjustHorz(void)
|
||||||
|
|
||||||
prev_widget = tmp;
|
prev_widget = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
internalResize(width, tallest + _bevel_width * 2);
|
internalResize(width, tallest + _bevel_width * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +398,7 @@ void Widget::adjustVert(void)
|
||||||
internalResize(widest + _bevel_width * 2, height);
|
internalResize(widest + _bevel_width * 2, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::update(void)
|
void Widget::update()
|
||||||
{
|
{
|
||||||
if (_dirty) {
|
if (_dirty) {
|
||||||
adjust();
|
adjust();
|
||||||
|
@ -411,12 +417,17 @@ void Widget::internalResize(int w, int h)
|
||||||
{
|
{
|
||||||
assert(w > 0 && h > 0);
|
assert(w > 0 && h > 0);
|
||||||
|
|
||||||
if (! _fixed_width && ! _fixed_height)
|
bool fw = _fixed_width, fh = _fixed_height;
|
||||||
|
|
||||||
|
if (! fw && ! fh)
|
||||||
resize(w, h);
|
resize(w, h);
|
||||||
else if (! _fixed_width)
|
else if (! fw)
|
||||||
resize(w, _rect.height());
|
resize(w, _rect.height());
|
||||||
else if (! _fixed_height)
|
else if (! fh)
|
||||||
resize(_rect.width(), h);
|
resize(_rect.width(), h);
|
||||||
|
|
||||||
|
_fixed_width = fw;
|
||||||
|
_fixed_height = fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::addChild(Widget *child, bool front)
|
void Widget::addChild(Widget *child, bool front)
|
||||||
|
|
Loading…
Reference in a new issue