aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/RootSubWindow.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-07-20 17:17:54 -0400
committerKen Moore <ken@ixsystems.com>2017-07-20 17:17:54 -0400
commit334bb3d2ebb26ea518c0f2c98490d79d6b3e77ef (patch)
treec211f9cbb2ca6a03d75fe1b95abb71d82bf99b10 /src-qt5/core/libLumina/RootSubWindow.cpp
parentAdd a window animation framework, with 7 visibility animations for starters. (diff)
downloadlumina-334bb3d2ebb26ea518c0f2c98490d79d6b3e77ef.tar.gz
lumina-334bb3d2ebb26ea518c0f2c98490d79d6b3e77ef.tar.bz2
lumina-334bb3d2ebb26ea518c0f2c98490d79d6b3e77ef.zip
Get the compositing and window interactions all cleaned up. Seems to work great now.
Diffstat (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp')
-rw-r--r--src-qt5/core/libLumina/RootSubWindow.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp
index 55b6bd2e..46599003 100644
--- a/src-qt5/core/libLumina/RootSubWindow.cpp
+++ b/src-qt5/core/libLumina/RootSubWindow.cpp
@@ -14,6 +14,7 @@
#define WIN_BORDER 5
#include <LIconCache.h>
+#include <DesktopSettings.h>
// === PUBLIC ===
RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){
@@ -304,6 +305,7 @@ void RootSubWindow::startMoving(){
activeState = Move;
offset = this->mapFromGlobal(curpt);
setMouseCursor(activeState, true); //this one is an override cursor
+ WinWidget->pause();
//Also need to capture the mouse
this->grabMouse();
}
@@ -320,25 +322,8 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList
switch(props[i]){
case NativeWindow::Visible:
//qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry();
- loadAnimation( "random", NativeWindow::Visible, vals[i]);
- /*if(vals[i].toBool()){
- if(lastGeom.isNull()){ animResetProp = this->geometry(); }
- else{ animResetProp = lastGeom; }
- anim->setPropertyName("geometry");
- anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) );
- anim->setEndValue(animResetProp);
- this->setGeometry( anim->startValue().toRect() ); //ensure the window is the initial geom before it becomes visible
- anim->start();
- this->show();
- }else{
- animResetProp = this->geometry(); //hide event - should already be the right geom
- lastGeom = this->geometry();
- anim->setPropertyName("geometry");
- anim->setStartValue(this->geometry());
- anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) );
- anim->start();
- QTimer::singleShot(anim->duration(), this, SLOT(hide()) );
- }*/
+ if(vals[i].toBool()){ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/appear", "random").toString(), NativeWindow::Visible, vals[i]); }
+ else{ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/disappear", "random").toString(), NativeWindow::Visible, vals[i]); }
break;
case NativeWindow::Title:
titleLabel->setText(vals[i].toString());
@@ -396,7 +381,7 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){
//qDebug() << "Frame Mouse Press Event";
offset.setX(0); offset.setY(0);
if(activeState != Normal){ return; } // do nothing - already in a state of grabbed mouse
- this->activate();
+ //this->activate();
if(this->childAt(ev->pos())!=0){
//Check for any non-left-click event and skip it
if(ev->button()!=Qt::LeftButton){ return; }
@@ -407,6 +392,7 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){
activeState = getStateAtPoint(ev->pos(), true); //also have it set the offset variable
}
setMouseCursor(activeState, true); //this one is an override cursor
+ if(activeState!=Normal){WinWidget->pause(); }
QFrame::mousePressEvent(ev);
}
@@ -500,6 +486,7 @@ void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){
otherM->popup(ev->globalPos());
return;
}
+ if(activeState!=Normal){ WinWidget->resume(); }
activeState = Normal;
QApplication::restoreOverrideCursor();
setMouseCursor( getStateAtPoint(ev->pos()) );
@@ -519,5 +506,4 @@ void RootSubWindow::moveEvent(QMoveEvent *ev){
if(!closing && anim->state()!=QAbstractAnimation::Running){
moveTimer->start();
}
-
}
bgstack15