diff options
author | Sebastian Geerken <devnull@localhost> | 2014-12-09 14:52:06 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-12-09 14:52:06 +0100 |
commit | 16d44971c6cba5ee542ef6a7621eb54b4b9286a2 (patch) | |
tree | ccb25d9fa60f9bdef5bb007fcece34d78be37ac0 /dw | |
parent | ee9f68d31180573847761cea82bea9454076b297 (diff) |
Fix related to absolute positions.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/oofawarewidget.cc | 55 | ||||
-rw-r--r-- | dw/oofawarewidget.hh | 1 | ||||
-rw-r--r-- | dw/oofpositionedmgr.cc | 6 |
3 files changed, 49 insertions, 13 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc index 2c7afd1f..2bcdce7b 100644 --- a/dw/oofawarewidget.cc +++ b/dw/oofawarewidget.cc @@ -33,6 +33,10 @@ namespace dw { namespace oof { +const char *OOFAwareWidget::OOFM_NAME[NUM_OOFM] = { + "FLOATS", "ABSOLUTE", "FIXED" +}; + OOFAwareWidget::OOFStackingIterator::OOFStackingIterator (OOFAwareWidget *widget, bool atEnd) { @@ -110,6 +114,7 @@ OOFAwareWidget::OOFAwareWidget () for (int i = 0; i < NUM_OOFM; i++) { oofContainer[i] = NULL; + DBG_OBJ_ARRSET_PTR ("oofContainer", i, oofContainer[i]); outOfFlowMgr[i] = NULL; } } @@ -132,8 +137,10 @@ OOFAwareWidget::~OOFAwareWidget () void OOFAwareWidget::notifySetAsTopLevel () { - oofContainer[OOFM_FLOATS] = oofContainer[OOFM_ABSOLUTE] - = oofContainer[OOFM_FIXED] = this; + for (int i = 0; i < NUM_OOFM; i++) { + oofContainer[i] = this; + DBG_OBJ_ARRSET_PTR ("oofContainer", i, oofContainer[i]); + } } bool OOFAwareWidget::getOOFMIndex (Widget *widget) @@ -258,15 +265,19 @@ void OOFAwareWidget::correctRequisitionByOOF (Requisition *requisition, void (*splitHeightFun) (int, int*, int*)) { + DBG_OBJ_ENTER ("resize", 0, "correctRequisitionByOOF", "%d * (%d + %d), ...", + requisition->width, requisition->ascent, + requisition->descent); + for (int i = 0; i < NUM_OOFM; i++) { if (outOfFlowMgr[i]) { + DBG_OBJ_MSGF ("resize", 1, "OOFM for %s", OOFM_NAME[i]); + DBG_OBJ_MSG_START (); + int oofWidth, oofHeight; - DBG_OBJ_MSGF ("resize", 1, - "before considering widgets by OOFM #%d: %d * (%d + %d)", - i, requisition->width, requisition->ascent, - requisition->descent); outOfFlowMgr[i]->getSize (requisition, &oofWidth, &oofHeight); + DBG_OBJ_MSGF ("resize", 1, "result: %d * %d", oofWidth, oofHeight); if (oofWidth > requisition->width) { if (outOfFlowMgr[i]->containerMustAdjustExtraSpace () && @@ -291,19 +302,33 @@ void OOFAwareWidget::correctRequisitionByOOF (Requisition *requisition, splitHeightFun (oofHeight, &requisition->ascent, &requisition->descent); } - } + + DBG_OBJ_MSGF ("resize", 1, "after correction: %d * (%d + %d)", + requisition->width, requisition->ascent, + requisition->descent); + DBG_OBJ_MSG_END (); + } else + DBG_OBJ_MSGF ("resize", 1, "no OOFM for %s", OOFM_NAME[i]); } + + DBG_OBJ_LEAVE (); } void OOFAwareWidget::correctExtremesByOOF (Extremes *extremes) { + DBG_OBJ_ENTER ("resize", 0, "correctExtremesByOOF", "%d (%d) / %d (%d)", + extremes->minWidth, extremes->minWidthIntrinsic, + extremes->maxWidth, extremes->maxWidthIntrinsic); + for (int i = 0; i < NUM_OOFM; i++) { if (outOfFlowMgr[i]) { + DBG_OBJ_MSGF ("resize", 1, "OOFM for %s", OOFM_NAME[i]); + DBG_OBJ_MSG_START (); + int oofMinWidth, oofMaxWidth; outOfFlowMgr[i]->getExtremes (extremes, &oofMinWidth, &oofMaxWidth); - - DBG_OBJ_MSGF ("resize", 1, "OOFM (#%d) correction: %d / %d", - i, oofMinWidth, oofMaxWidth); + DBG_OBJ_MSGF ("resize", 1, "result: %d / %d", + oofMinWidth, oofMaxWidth); extremes->minWidth = max (extremes->minWidth, oofMinWidth); extremes->minWidthIntrinsic = max (extremes->minWidthIntrinsic, @@ -311,8 +336,16 @@ void OOFAwareWidget::correctExtremesByOOF (Extremes *extremes) extremes->maxWidth = max (extremes->maxWidth, oofMaxWidth); extremes->maxWidthIntrinsic = max (extremes->maxWidthIntrinsic, oofMinWidth); - } + + DBG_OBJ_MSGF ("resize", 1, "after correction: %d (%d) / %d (%d)", + extremes->minWidth, extremes->minWidthIntrinsic, + extremes->maxWidth, extremes->maxWidthIntrinsic); + DBG_OBJ_MSG_END (); + } else + DBG_OBJ_MSGF ("resize", 1, "no OOFM for %s", OOFM_NAME[i]); } + + DBG_OBJ_LEAVE (); } void OOFAwareWidget::sizeAllocateStart (Allocation *allocation) diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh index 8fb32716..ba686913 100644 --- a/dw/oofawarewidget.hh +++ b/dw/oofawarewidget.hh @@ -66,6 +66,7 @@ class OOFAwareWidget: public core::Widget { protected: enum { OOFM_FLOATS, OOFM_ABSOLUTE, OOFM_FIXED, NUM_OOFM }; + static const char *OOFM_NAME[NUM_OOFM]; enum { PARENT_REF_OOFM_BITS = 2, PARENT_REF_OOFM_MASK = (1 << PARENT_REF_OOFM_BITS) - 1 }; diff --git a/dw/oofpositionedmgr.cc b/dw/oofpositionedmgr.cc index bcc7e12d..7a5dcd5b 100644 --- a/dw/oofpositionedmgr.cc +++ b/dw/oofpositionedmgr.cc @@ -528,7 +528,8 @@ void OOFPositionedMgr::calcPosAndSizeChildOfChild (Child *child, int refWidth, left, right, *width, widthDefined ? "true" : "false"); if (left == -1 && right == -1) - *x = child->generator->getAllocation()->x + child->x; + *x = child->x + (child->generator->getAllocation()->x + - (containerAllocation.x + containerBoxOffsetX ())); else if (left == -1 && right != -1) *x = refWidth - *width - right; else if (left != -1 && right == -1) @@ -572,7 +573,8 @@ void OOFPositionedMgr::calcPosAndSizeChildOfChild (Child *child, int refWidth, heightDefined ? "true" : "false"); if (top == -1 && bottom == -1) - *y = child->generator->getAllocation()->y + child->y; + *y = child->y + (child->generator->getAllocation()->y + - (containerAllocation.y + containerBoxOffsetY ())); else if (top == -1 && bottom != -1) *y = refHeight - (*ascent + *descent) - bottom; else if (top != -1 && bottom == -1) |