X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/7eab308715ea1130166915574e3b691e08eb4482..55d519c26e9124873ca8be529066df184bd416f1:/lib/gui/ewidget.cpp diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp index 6f7fa91b..7c50f4af 100644 --- a/lib/gui/ewidget.cpp +++ b/lib/gui/ewidget.cpp @@ -100,16 +100,25 @@ void eWidget::show() { if (m_vis & wVisShow) return; - - m_vis |= wVisShow; + m_vis |= wVisShow; + /* TODO: optimize here to only recalc what's required. possibly merge with hide. */ eWidget *root = this; ePoint abspos = position(); while (root && !root->m_desktop) { root = root->m_parent; - assert(root); + if (!root) + { + /* oops: our root widget does not have a desktop associated. + probably somebody already erased the root, but tries some + operations on a child window. + + ignore them for now. */ + /* assert(root); */ + return; + } abspos += root->position(); } @@ -140,6 +149,8 @@ void eWidget::hide() while (root && !root->m_desktop) { root = root->m_parent; + if (!root) + return; abspos += root->position(); } assert(root->m_desktop); @@ -188,6 +199,21 @@ void eWidget::setTransparent(int transp) m_vis &=~wVisTransparent; } +ePoint eWidget::getAbsolutePosition() +{ + eWidget *root = this; + ePoint abspos = position(); + + while (root && !root->m_desktop) + { + root = root->m_parent; + assert(root); + abspos += root->position(); + } + + return abspos; +} + void eWidget::mayKillFocus() { setFocus(0);