aboutsummaryrefslogtreecommitdiff
path: root/dw/widget.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-09-15 21:43:20 +0200
committerSebastian Geerken <devnull@localhost>2014-09-15 21:43:20 +0200
commite1c93c6553f9330c8414c3f4b8e51529b5abc610 (patch)
tree38e308a29b60df15e1507cce42d3f9e5ecf82c55 /dw/widget.cc
parenta4d92f6ec2a1bf92c1f0bc408a7060a774bd027d (diff)
Z-Index and stacking contexts: start.
Diffstat (limited to 'dw/widget.cc')
-rw-r--r--dw/widget.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/dw/widget.cc b/dw/widget.cc
index 68875158..054ad7bf 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -91,6 +91,8 @@ Widget::Widget ()
deleteCallbackFunc = NULL;
widgetImgRenderer = NULL;
+
+ stackingContextMgr = NULL;
}
Widget::~Widget ()
@@ -104,6 +106,9 @@ Widget::~Widget ()
delete widgetImgRenderer;
}
+ if (stackingContextMgr)
+ delete stackingContextMgr;
+
if (style)
style->unref ();
@@ -170,6 +175,17 @@ void Widget::setParent (Widget *parent)
// Textblock.
DBG_OBJ_SET_PTR ("container", container);
+ // If at all, stackingContextMgr should have set *before*, see also
+ // Widget::setStyle() and Layout::addWidget().
+ if (stackingContextMgr) {
+ Widget *stackingContextWidget = parent;
+ while (stackingContextWidget &&
+ stackingContextWidget->stackingContextMgr == NULL)
+ stackingContextWidget = stackingContextWidget->parent;
+ assert (stackingContextWidget);
+ stackingContextWidget->stackingContextMgr->addChildSCWidget (this);
+ }
+
notifySetParent();
}
@@ -1078,6 +1094,15 @@ void Widget::setStyle (style::Style *style)
layout->updateCursor ();
}
+ // After Layout::addWidget() (as toplevel widget) or Widget::setParent()
+ // (which also sets layout), changes of the style cannot be considered
+ // anymore. (Should print a warning?)
+ if (layout == NULL &&
+ StackingContextMgr::isEstablishingStackingContext (this)) {
+ stackingContextMgr = new StackingContextMgr (this);
+ DBG_OBJ_ASSOC_CHILD (stackingContextMgr);
+ }
+
if (sizeChanged)
queueResize (0, true);
else