diff options
author | Sebastian Geerken <devnull@localhost> | 2015-12-28 23:57:09 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-12-28 23:57:09 +0100 |
commit | 6211c25f5528bf4a3e660f94de459b83bdd5c2e9 (patch) | |
tree | ce9c465e09284db1c5b2ad04b37f6e5ac7b5923d | |
parent | e37c0bba9f08a5a8ac6e9a68ac6515702485bef7 (diff) |
SRDOP: Fix endless recursion.
-rw-r--r-- | dw/textblock.cc | 20 | ||||
-rw-r--r-- | dw/textblock.hh | 2 | ||||
-rw-r--r-- | dw/widget.cc | 23 | ||||
-rw-r--r-- | dw/widget.hh | 4 |
4 files changed, 30 insertions, 19 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 7a208581..46bd213d 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -737,20 +737,22 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) DBG_OBJ_LEAVE (); } -void Textblock::calcExtraSpaceImpl () +void Textblock::calcExtraSpaceImpl (bool vertical) { DBG_OBJ_ENTER0 ("resize", 0, "Textblock::calcExtraSpaceImpl"); - OOFAwareWidget::calcExtraSpaceImpl (); + OOFAwareWidget::calcExtraSpaceImpl (vertical); - int clearPosition = 0; - for (int i = 0; i < NUM_OOFM; i++) - if (searchOutOfFlowMgr (i)) - clearPosition = - misc::max (clearPosition, - searchOutOfFlowMgr(i)->getClearPosition (this)); + if (vertical) { + int clearPosition = 0; + for (int i = 0; i < NUM_OOFM; i++) + if (searchOutOfFlowMgr (i)) + clearPosition = + misc::max (clearPosition, + searchOutOfFlowMgr(i)->getClearPosition (this)); - extraSpace.top = misc::max (extraSpace.top, clearPosition); + extraSpace.top = misc::max (extraSpace.top, clearPosition); + } DBG_OBJ_LEAVE (); } diff --git a/dw/textblock.hh b/dw/textblock.hh index 562528b9..532e1f84 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -833,7 +833,7 @@ protected: void sizeAllocateImpl (core::Allocation *allocation); - void calcExtraSpaceImpl (); + void calcExtraSpaceImpl (bool vertical); int getAvailWidthOfChild (core::Widget *child, bool forceValue); int getAvailHeightOfChild (core::Widget *child, bool forceValue); diff --git a/dw/widget.cc b/dw/widget.cc index 202e6556..d63d1edc 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -586,7 +586,7 @@ void Widget::sizeRequest (Requisition *requisition, int numPos, } if (needsResize ()) { - calcExtraSpace (); + calcExtraSpace (true); /** \todo Check requisition == &(this->requisition) and do what? */ sizeRequestImpl (requisition, numPos, references, x, y); this->requisition = *requisition; @@ -1007,7 +1007,7 @@ void Widget::getExtremes (Extremes *extremes, int numPos, Widget **references, } if (extremesChanged ()) { - calcExtraSpace (); + calcExtraSpace (false); // For backward compatibility (part 1/2): extremes->minWidthIntrinsic = extremes->maxWidthIntrinsic = -1; @@ -1043,16 +1043,22 @@ void Widget::getExtremes (Extremes *extremes, int numPos, Widget **references, * * Delegated to dw::core::Widget::calcExtraSpaceImpl. Called both from * dw::core::Widget::sizeRequest and dw::core::Widget::getExtremes. + * + * If `vertical` is false, only horizontal dimensions are calculated. (This is + * used for extremes.) */ -void Widget::calcExtraSpace () +void Widget::calcExtraSpace (bool vertical) { DBG_OBJ_ENTER0 ("resize", 0, "calcExtraSpace"); extraSpace.top = extraSpace.right = extraSpace.bottom = extraSpace.left = 0; - calcExtraSpaceImpl (); + calcExtraSpaceImpl (vertical); - DBG_OBJ_SET_NUM ("extraSpace.top", extraSpace.top); - DBG_OBJ_SET_NUM ("extraSpace.bottom", extraSpace.bottom); + if (vertical) { + DBG_OBJ_SET_NUM ("extraSpace.top", extraSpace.top); + DBG_OBJ_SET_NUM ("extraSpace.bottom", extraSpace.bottom); + } + DBG_OBJ_SET_NUM ("extraSpace.left", extraSpace.left); DBG_OBJ_SET_NUM ("extraSpace.right", extraSpace.right); @@ -1602,8 +1608,11 @@ void Widget::sizeAllocateImpl (Allocation *allocation) * dw::core::Widget::extraSpace, which is only corrected. To make sure * all possible influences are considered, the implementation of the * base class should be called, too. + * + * If `vertical` is false, only horizontal dimensions are calculated. (This is + * used for extremes.) */ -void Widget::calcExtraSpaceImpl () +void Widget::calcExtraSpaceImpl (bool vertical) { } diff --git a/dw/widget.hh b/dw/widget.hh index 5db9aa33..d21b2697 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -301,7 +301,7 @@ protected: */ virtual void getExtremesSimpl (Extremes *extremes); - virtual void calcExtraSpaceImpl (); + virtual void calcExtraSpaceImpl (bool vertical); /** * \brief See \ref dw-widget-sizes. @@ -483,7 +483,7 @@ public: Widget **references = NULL, int *x = NULL, int *y = NULL); void sizeAllocate (Allocation *allocation); - void calcExtraSpace (); + void calcExtraSpace (bool vertical); int getAvailWidth (bool forceValue); int getAvailHeight (bool forceValue); |