diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
4 files changed, 25 insertions, 7 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index a17ed060..c29ac9da 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2012-2017, Ken Moore +// Copyright (c) 2012-2018, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h index 73f4e908..24579308 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h @@ -28,6 +28,7 @@ public: NativeEmbedWidget(QWidget *parent, NativeWindowObject *obj) : QObject(parent){ WIN = obj; _window = QWindow::fromWinId(WIN->id()); + //embedW = new QWidget(parent); embedW = QWidget::createWindowContainer(_window, parent); //Setup all the internal connections connect(_window, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool)) ); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp index 60bb0b9c..0296d592 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp @@ -19,6 +19,11 @@ NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Q moveTimer->setSingleShot(true); moveTimer->setInterval(100); //1/10 second connect(moveTimer, SIGNAL(timeout()), this, SLOT(submitLocationChange()) ); //Let the window system know the window has moved + resizeTimer = new QTimer(this); + resizeTimer->setSingleShot(true); + resizeTimer->setInterval(10); //1/10 second + connect(resizeTimer, SIGNAL(timeout()), this, SLOT(submitSizeChange()) ); //Let the window system know the window has moved + //WIN->addFrameWinID(this->winId()); } @@ -32,7 +37,7 @@ QPoint NativeWindow::relativeOrigin(){ QList<int> frame = WIN->property(NativeWindowObject::FrameExtents).value<QList<int> >(); //QList<int> : [Left, Right, Top, Bottom] in pixels QPoint containerCorner(frame[0], frame[2]); - qDebug() << "Got Container Corner:" << containerCorner << "L,R,T,B:" << frame; + //qDebug() << "Got Container Corner:" << containerCorner << "L,R,T,B:" << frame; return containerCorner; //return QPoint(0,0); } @@ -299,6 +304,13 @@ void NativeWindow::submitLocationChange(){ emit windowMoved(WIN); } +void NativeWindow::submitSizeChange(){ + if(!pending_geom.isNull()){ + this->setGeometry(pending_geom); + pending_geom = QRect(); + } +} + // === PROTECTED === void NativeWindow::mousePressEvent(QMouseEvent *ev){ container->activateWindow(); @@ -320,6 +332,7 @@ void NativeWindow::mousePressEvent(QMouseEvent *ev){ } void NativeWindow::mouseMoveEvent(QMouseEvent *ev){ + //qDebug() << "Got Mouse Move Event:" << ev->pos(); QFrame::mouseMoveEvent(ev); if(activeState == Normal){ setMouseCursor( getStateAtPoint(ev->pos()) ); //just update the mouse cursor @@ -400,9 +413,12 @@ void NativeWindow::mouseMoveEvent(QMouseEvent *ev){ //qDebug() << " Change Window:" << this->geometry() << geom; if(activeState==Move){ this->setGeometry(geom); } else if(this->geometry()!=geom){ - qDebug() << " Change Window Dimensions:" << this->geometry() << geom; - qDebug() << " - Mouse Pos:" << ev->globalPos() << ev->pos() << "Offset" << offset; - this->setGeometry(geom); + pending_geom = geom; + if(!resizeTimer->isActive()){ QTimer::singleShot(0,resizeTimer, SLOT(start()) ); } + /*qDebug() << " Change Window Dimensions:" << this->geometry() << geom; + qDebug() << " - Mouse Pos:" << ev->globalPos() << ev->pos() << "Offset" << offset; + this->setGeometry(geom); + qDebug() << " - Done setting geom";*/ } //} } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h index 71f6e701..094623a5 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.h @@ -34,7 +34,7 @@ private: //Functions for getting/setting state ModState getStateAtPoint(QPoint pt, bool setoffset = false); //generally used for mouse location detection void setMouseCursor(ModState, bool override = false); //Update the mouse cursor based on state - QTimer *moveTimer; + QTimer *moveTimer, *resizeTimer; //Core object NativeWindowObject *WIN; @@ -49,7 +49,7 @@ private: NativeEmbedWidget *container; // Info cache variables - QRect oldgeom; + QRect oldgeom, pending_geom; private slots: @@ -63,6 +63,7 @@ private slots: void syncWinType(); void syncGeom(); void submitLocationChange(); + void submitSizeChange(); protected: void mousePressEvent(QMouseEvent*); |