diff options
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.cpp | 10 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.h | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 8 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 68610ce2..8853c48e 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -75,6 +75,16 @@ void NativeWindow::requestProperties(QList<NativeWindow::Property> props, QList< emit RequestPropertiesChange(winid, props, vals); } +QRect NativeWindow::geometry(){ + //Calculate the "full" geometry of the window + frame (if any) + QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), hash.value(NativeWindow::Size).toSize() ); + //Now adjust the window geom by the frame margins + QList<int> frame = hash.value(NativeWindow::FrameExtents).value< QList<int> >(); //Left,Right,Top,Bottom + if(frame.length()==4){ + geom = geom.adjusted( -frame[0], -frame[2], frame[1], frame[3] ); + } + return geom; +} // ==== PUBLIC SLOTS === void NativeWindow::requestClose(){ emit RequestClose(winid); diff --git a/src-qt5/core/libLumina/NativeWindow.h b/src-qt5/core/libLumina/NativeWindow.h index a1cb7c1a..c87ccb2d 100644 --- a/src-qt5/core/libLumina/NativeWindow.h +++ b/src-qt5/core/libLumina/NativeWindow.h @@ -71,6 +71,8 @@ public: void requestProperty(NativeWindow::Property, QVariant); void requestProperties(QList<NativeWindow::Property>, QList<QVariant>); + QRect geometry(); //this returns the "full" geometry of the window (window + frame) + public slots: void requestClose(); //ask the app to close the window (may/not depending on activity) void requestKill(); //ask the WM to kill the app associated with this window (harsh - only use if not responding) diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 59cfc662..f17ee9a1 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -254,17 +254,17 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList break; case NativeWindow::Icon: //qDebug() << "Got Icon Change:" << vals[i]; - otherB->setIcon(vals[i].value< QIcon>()); + otherB->setIcon(vals[i].value<QIcon>()); break; case NativeWindow::GlobalPos: //qDebug() << "Got Global Pos:" << vals[i].toPoint(); - this->move( vals[i].toPoint() ); + this->move( WIN->geometry().topLeft() ); break; case NativeWindow::Size: qDebug() << "Got Widget Size:" << vals[i].toSize(); //WinWidget->setSizeHint( vals[i].toSize() ); //WinWidget->resize(vals[i].toSize() ); - this->resize( vals[i].toSize()+QSize( this->width()-WinWidget->width(), this->height()-WinWidget->height() ) ); + this->resize( WIN->geometry().size() ); qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; case NativeWindow::MinSize: @@ -305,7 +305,7 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){ } void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ - //ev->accept(); + activate(); //make sure this window is "Active" if(activeState == Normal){ setMouseCursor( getStateAtPoint(ev->pos()) ); //just update the mouse cursor }else{ |