If using SHIFT and navigator button reset to screen center

This commit is contained in:
Klaus Basan
2019-09-03 00:43:59 +02:00
committed by Mat Sutcliffe
parent f20855b613
commit 2e6eac45bd
3 changed files with 13 additions and 3 deletions

View File

@@ -267,6 +267,15 @@ namespace BlackGui
}
if (shift && floating) { this->resetPosition(); }
if (floating)
{
// check where we are, otherwise reset if NOT appropriate
const QPoint p = this->rect().topLeft();
if (p.x() < 1 || p.y() < 1)
{
this->resetPosition();
}
}
}
void CDockWidget::toggleVisibility()
@@ -685,7 +694,8 @@ namespace BlackGui
if (!sGui) { return; }
// pos can be null during init
QPoint pos = CGuiUtility::mainWidgetGlobalPosition();
QWidget *mw = CGuiUtility::mainApplicationWidget();
QPoint pos = mw && mw->isVisible() ? CGuiUtility::mainWidgetGlobalPosition() : QPoint();
if (pos.isNull())
{
pos = CGuiApplication::currentScreen()->geometry().center() - this->rect().center();