diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-29 14:25:50 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-29 14:25:50 -0400 |
commit | a512f8b35b20fe2c1ab8f1c26a2261b22dc0a253 (patch) | |
tree | f1ae417798278ea3b73bdbb686a2be694e3ec543 /src-qt5 | |
parent | Add some window close debugging, and change the setVisible animation to a win... (diff) | |
download | lumina-a512f8b35b20fe2c1ab8f1c26a2261b22dc0a253.tar.gz lumina-a512f8b35b20fe2c1ab8f1c26a2261b22dc0a253.tar.bz2 lumina-a512f8b35b20fe2c1ab8f1c26a2261b22dc0a253.zip |
Clean up a bunch of debugging, and add a "closing" animation to the rootSubWindow as well.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 6 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 14 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.h | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 20 |
4 files changed, 25 insertions, 17 deletions
diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index 754bdb8f..74402690 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -177,7 +177,7 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, break; //============================== case XCB_MAP_NOTIFY: - qDebug() << "Window Map Event:" << ((xcb_map_notify_event_t *)ev)->window; + //qDebug() << "Window Map Event:" << ((xcb_map_notify_event_t *)ev)->window; obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible, true); break; //This is just a notification that a window was mapped - nothing needs to change here case XCB_MAP_REQUEST: @@ -186,11 +186,11 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, break; //============================== case XCB_CREATE_NOTIFY: - qDebug() << "Window Create Event"; + //qDebug() << "Window Create Event"; break; //============================== case XCB_UNMAP_NOTIFY: - qDebug() << "Window Unmap Event:" << ((xcb_unmap_notify_event_t *)ev)->window; + //qDebug() << "Window Unmap Event:" << ((xcb_unmap_notify_event_t *)ev)->window; obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible, false); break; //============================== diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index ad5c969c..82ce8d1f 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -263,15 +263,17 @@ NativeWindowSystem::MouseButton NativeWindowSystem::MouseToQt(int keycode){ } // === PRIVATE === -NativeWindow* NativeWindowSystem::findWindow(WId id){ +NativeWindow* NativeWindowSystem::findWindow(WId id, bool checkRelated){ //qDebug() << "Find Window:" << id; for(int i=0; i<NWindows.length(); i++){ - if(NWindows[i]->isRelatedTo(id)){ qDebug() << " -- Got Window Match!" << id; return NWindows[i]; } + if(NWindows[i]->isRelatedTo(id)){ return NWindows[i]; } } //Check to see if this is a transient for some other window - WId tid = obj->getTransientFor(id); - if(tid!=id){ return findWindow(tid); } //call it recursively as needed - //qDebug() << " -- Could not find Window!"; + if(checkRelated){ + WId tid = obj->getTransientFor(id); + if(tid!=id){ return findWindow(tid, checkRelated); } //call it recursively as needed + //qDebug() << " -- Could not find Window!"; + } return 0; } @@ -718,7 +720,7 @@ void NativeWindowSystem::NewTrayWindowDetected(WId id){ } void NativeWindowSystem::WindowCloseDetected(WId id){ - NativeWindow *win = findWindow(id); + NativeWindow *win = findWindow(id, false); qDebug() << "Got Window Closed" << id << win; if(win!=0){ qDebug() << "Old Window List:" << NWindows.length(); diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 7786c87d..008a204f 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -23,7 +23,7 @@ private: QList<NativeWindow*> TWindows; //Simplifications to find an already-created window object - NativeWindow* findWindow(WId id); + NativeWindow* findWindow(WId id, bool checkRelated = true); NativeWindow* findTrayWindow(WId id); diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 0aa97c54..eae5aa39 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -138,7 +138,7 @@ void RootSubWindow::initWindowFrame(){ otherB = new QToolButton(this); anim = new QPropertyAnimation(this); anim->setTargetObject(this); - anim->setDuration(300); //1/3 second (appx) + anim->setDuration(200); //1/5 second (appx) titleLabel = new QLabel(this); titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); otherM = new QMenu(this); //menu of other actions @@ -165,7 +165,7 @@ void RootSubWindow::initWindowFrame(){ maxB->setObjectName("Button_Maximize"); otherM->setObjectName("Menu_Actions"); titleLabel->setObjectName("Label_Title"); - this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; } QToolButton::hover{border-color: white;} QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); + this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; border-radius: 3px; } QToolButton::hover{background-color: rgba(255,255,255,150); } QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); //And adjust the margins mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); @@ -266,12 +266,18 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList if(vals[i].toBool()){ WinWidget->setVisible(true); anim->setPropertyName("geometry"); - anim->setStartValue( QRect(this->geometry().center(), QSize(0,0)) ); + anim->setStartValue( QRect(this->geometry().center(), QSize(0,0)) ); anim->setEndValue(this->geometry()); anim->start(); this->show(); + }else{ + 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()) ); + //this->hide(); } - else{ this->hide(); } break; case NativeWindow::Title: titleLabel->setText(vals[i].toString()); @@ -282,12 +288,12 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList else{ otherB->setIcon(vals[i].value<QIcon>()); } break; case NativeWindow::GlobalPos: - qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); + //qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); break; case NativeWindow::Size: if(WinWidget->size() != vals[i].toSize()){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize(); + //qDebug() << "Got Widget Size Change:" << vals[i].toSize(); WinWidget->resize(vals[i].toSize()); this->resize( WIN->geometry().size() ); qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); @@ -454,7 +460,7 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ }*/ void RootSubWindow::moveEvent(QMoveEvent *ev){ - qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); + //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); QFrame::moveEvent(ev); } |