aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-06-05 20:58:21 -0400
committerKen Moore <ken@ixsystems.com>2018-06-05 20:58:21 -0400
commit77317cd60701a0bc4231dd6aabba5b0c9dcdd99a (patch)
tree2df0e5e110e14ddd14d18748e5bcab690ccc5310 /src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
parentTry to get the window resizes working. (diff)
downloadlumina-77317cd60701a0bc4231dd6aabba5b0c9dcdd99a.tar.gz
lumina-77317cd60701a0bc4231dd6aabba5b0c9dcdd99a.tar.bz2
lumina-77317cd60701a0bc4231dd6aabba5b0c9dcdd99a.zip
Fix up the crash on resize.
Turns out Qt will crash if you send multiple resize requests really quickly. Add a 10ms cache/delay to the resize and that fixes it.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp24
1 files changed, 20 insertions, 4 deletions
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";*/
}
//}
}
bgstack15