fix #116, update screen in screengeometry changes

--when the screengeometry was called the dockview screen
hadnt changed to primaryscreen, that had as a
consequence the dock to go to the primary screen
but because that was out of the boundaries of
its own screen to return again to first place
pull/1/head
Michail Vourlakos 8 years ago
parent d4da25e2e6
commit c468353407

@ -112,7 +112,8 @@ DockView::~DockView()
void DockView::init() void DockView::init()
{ {
connect(this, &DockView::screenChanged, this, &DockView::adaptToScreen); //connect(this, &DockView::screenChanged, this, &DockView::syncGeometry);
connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, &DockView::syncGeometry, Qt::UniqueConnection);
connect(this, &DockView::screenGeometryChanged, this, &DockView::syncGeometry); connect(this, &DockView::screenGeometryChanged, this, &DockView::syncGeometry);
connect(this, &QQuickWindow::widthChanged, this, &DockView::widthChanged); connect(this, &QQuickWindow::widthChanged, this, &DockView::widthChanged);
connect(this, &QQuickWindow::heightChanged, this, &DockView::heightChanged); connect(this, &QQuickWindow::heightChanged, this, &DockView::heightChanged);
@ -142,6 +143,8 @@ void DockView::adaptToScreen(QScreen *screen)
return; return;
} }
qDebug() << "adapting to screen...";
setScreen(screen); setScreen(screen);
//FIXME:: This code in a multi-screen environment that //FIXME:: This code in a multi-screen environment that
@ -313,6 +316,7 @@ void DockView::updatePosition()
case Plasma::Types::BottomEdge: case Plasma::Types::BottomEdge:
screenGeometry = this->screen()->geometry(); screenGeometry = this->screen()->geometry();
qDebug() << "screen geometry: "<<screenGeometry;
if (m_drawShadows) { if (m_drawShadows) {
position = {screenGeometry.x() + length(screenGeometry.width()), position = {screenGeometry.x() + length(screenGeometry.width()),
@ -361,6 +365,10 @@ inline void DockView::syncGeometry()
if (!(this->screen() && this->containment())) if (!(this->screen() && this->containment()))
return; return;
if (qGuiApp->primaryScreen() && screen() != qGuiApp->primaryScreen()){
setScreen(qGuiApp->primaryScreen());
}
updateEnabledBorders(); updateEnabledBorders();
resizeWindow(); resizeWindow();
updatePosition(); updatePosition();

Loading…
Cancel
Save