From 3285fabf539aa136c20fba6902d3927f684b901b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 27 Jun 2017 10:06:00 -0400 Subject: Add some more debugging. --- src-qt5/core/libLumina/RootSubWindow.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 41c04ee1..d00a3a75 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -41,34 +41,34 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset //above the frame itself - need to figure out which quadrant it is in (8-directions) if(pt.y() < WIN_BORDER){ //One of the top options - if(pt.x() < WIN_BORDER){ + if(pt.x() < WIN_BORDER){ if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner return ResizeTopLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()-WIN_BORDER)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(pt.y()); } //difference from top-right corner return ResizeTopRight; - }else{ + }else{ if(setoffset){ offset.setX(0); offset.setY(pt.y()); } //difference from top edge (X does not matter) - return ResizeTop; - } + return ResizeTop; + } }else if(pt.y() > (this->height()-WIN_BORDER) ){ //One of the bottom options - if(pt.x() < WIN_BORDER){ + if(pt.x() < WIN_BORDER){ if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner return ResizeBottomLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()-WIN_BORDER)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-right corner return ResizeBottomRight; - }else{ + }else{ if(setoffset){ offset.setX(0); offset.setY(this->height() - pt.y()); } //difference from bottom edge (X does not matter) - return ResizeBottom; - } + return ResizeBottom; + } }else{ //One of the side options - if(pt.x() < WIN_BORDER){ + if(pt.x() < WIN_BORDER){ if(setoffset){ offset.setX(pt.x()); offset.setY(0); } //difference from left edge (Y does not matter) return ResizeLeft; - }else if(pt.x() > (this->width()-WIN_BORDER) ){ + }else if(pt.x() > (this->width()-WIN_BORDER) ){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(0); } //difference from right edge (Y does not matter) return ResizeRight; }else{ @@ -112,7 +112,7 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ break; case ResizeTopLeft: shape = Qt::SizeFDiagCursor; - break; + break; } if(override){ QApplication::setOverrideCursor(QCursor(shape)); @@ -123,6 +123,7 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ } void RootSubWindow::initWindowFrame(){ + qDebug() << "Create RootSubWindow Frame"; mainLayout = new QVBoxLayout(this); titleBar = new QHBoxLayout(this); closeB = new QToolButton(this); @@ -139,7 +140,6 @@ void RootSubWindow::initWindowFrame(){ connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); //Now assemble the frame layout based on the current settings - this->setLayout(mainLayout); titleBar->addWidget(otherB); titleBar->addWidget(titleLabel); titleBar->addWidget(minB); @@ -161,6 +161,8 @@ void RootSubWindow::initWindowFrame(){ mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); + this->setLayout(mainLayout); + qDebug() << " - Done"; } void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ -- cgit From 91c9e6f4c7b5aad491d5f8fdd892e038b2cd9656 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 27 Jun 2017 10:21:41 -0400 Subject: Start working on the RootSubWindow interactions. --- src-qt5/core/libLumina/RootSubWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index d00a3a75..3c8e5b97 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -155,7 +155,7 @@ void RootSubWindow::initWindowFrame(){ maxB->setObjectName("Button_Maximize"); otherM->setObjectName("Menu_Actions"); titleLabel->setObjectName("Label_Title"); - this->setStyleSheet("QWidget#WindowFrame{background-color: darkblue;} QWidget#Label_Title{background-color: transparent; color: white; }"); + this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; }"); //And adjust the margins mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); mainLayout->setSpacing(0); @@ -227,7 +227,7 @@ void RootSubWindow::startResizing(){ void RootSubWindow::propertiesChanged(QList props, QList vals){ for(int i=0; ishow(); } -- cgit From 5de759a52a3339741bff176d47efb9d9399d7c0d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 27 Jun 2017 12:21:43 -0400 Subject: Commit some more debugging and changes to the event systems for Lumina2. --- src-qt5/core/libLumina/RootSubWindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 3c8e5b97..fdb9ac76 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -10,7 +10,7 @@ #include #include -#define WIN_BORDER 3 +#define WIN_BORDER 5 // === PUBLIC === RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ @@ -24,6 +24,7 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ LoadProperties( NativeWindow::allProperties() ); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); + WIN->addFrameWinID(this->winId()); } RootSubWindow::~RootSubWindow(){ @@ -123,7 +124,7 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ } void RootSubWindow::initWindowFrame(){ - qDebug() << "Create RootSubWindow Frame"; + //qDebug() << "Create RootSubWindow Frame"; mainLayout = new QVBoxLayout(this); titleBar = new QHBoxLayout(this); closeB = new QToolButton(this); @@ -161,8 +162,8 @@ void RootSubWindow::initWindowFrame(){ mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); - this->setLayout(mainLayout); - qDebug() << " - Done"; + //this->setLayout(mainLayout); + //qDebug() << " - Done"; } void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ -- cgit From 431e837ead4e8fd7f7aef6b7d198dac50156c2b2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 28 Jun 2017 17:18:57 -0400 Subject: Get a lot more of the Lumina2 window-management functionality working. --- src-qt5/core/libLumina/RootSubWindow.cpp | 60 ++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 10 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index fdb9ac76..04deacf9 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -8,7 +8,8 @@ #include #include #include -#include +#include +#include #define WIN_BORDER 5 @@ -19,12 +20,14 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ //Create the QWindow and QWidget containers for the window WIN = win; closing = false; - WinWidget = QWidget::createWindowContainer( WIN->window(), this); + //WinWidget = QWidget::createWindowContainer( WIN->window(), this); initWindowFrame(); - LoadProperties( NativeWindow::allProperties() ); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); - WIN->addFrameWinID(this->winId()); + WIN->addFrameWinID(WinWidget->winId()); + WIN->emit RequestReparent(WIN->id(), WinWidget->winId(), QPoint(0,0)); + LoadAllProperties(); + //QTimer::singleShot(20, this, SLOT(LoadAllProperties()) ); } RootSubWindow::~RootSubWindow(){ @@ -126,7 +129,7 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ void RootSubWindow::initWindowFrame(){ //qDebug() << "Create RootSubWindow Frame"; mainLayout = new QVBoxLayout(this); - titleBar = new QHBoxLayout(this); + titleBar = new QHBoxLayout(); closeB = new QToolButton(this); maxB = new QToolButton(this); minB = new QToolButton(this); @@ -137,6 +140,7 @@ void RootSubWindow::initWindowFrame(){ otherB->setMenu(otherM); otherB->setPopupMode(QToolButton::InstantPopup); otherB->setAutoRaise(true); + WinWidget = new QWidget(this); connect(closeB, SIGNAL(clicked()), this, SLOT(triggerClose()) ); connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); @@ -169,9 +173,12 @@ void RootSubWindow::initWindowFrame(){ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList vals; for(int i=0; iproperty(list[i]); + qDebug() << "Property:" << list[i] << vals[i]; } propertiesChanged(list, vals); + WIN->requestProperty(NativeWindow::Visible, true); } // === PUBLIC SLOTS === @@ -181,6 +188,13 @@ void RootSubWindow::clientClosed(){ this->close(); } +void RootSubWindow::LoadAllProperties(){ + QList< NativeWindow::Property> list = WIN->allProperties(); + /*list.removeAll(NativeWindow::Visible); + list << NativeWindow::Visible;*/ + LoadProperties(list); +} + //Button Actions - public so they can be tied to key shortcuts and stuff as well void RootSubWindow::toggleMinimize(){ @@ -227,21 +241,31 @@ void RootSubWindow::startResizing(){ // === PRIVATE SLOTS === void RootSubWindow::propertiesChanged(QList props, QList vals){ for(int i=0; ishow(); } + qDebug() << "Got Visibility Change:" << vals[i]; + if(vals[i].toBool()){ WinWidget->setVisible(true); this->show(); } else{ this->hide(); } break; case NativeWindow::Title: titleLabel->setText(vals[i].toString()); break; case NativeWindow::Icon: + //qDebug() << "Got Icon Change:" << vals[i]; otherB->setIcon(vals[i].value< QIcon>()); break; + case NativeWindow::GlobalPos: + //qDebug() << "Got Global Pos:" << vals[i].toPoint(); + this->move( vals[i].toPoint() ); + break; case NativeWindow::Size: - WinWidget->resize(vals[i].toSize()); + //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() ) ); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); @@ -250,7 +274,7 @@ void RootSubWindow::propertiesChanged(QList props, QList WinWidget->setMaximumSize(vals[i].toSize()); break; case NativeWindow::Active: - if(vals[i].toBool()){ WinWidget->setFocus(); } + //if(vals[i].toBool()){ WinWidget->setFocus(); } break; /*case NativeWindow::WindowFlags: this->setWindowFlags( val.value< Qt::WindowFlags >() ); @@ -380,3 +404,19 @@ void RootSubWindow::leaveEvent(QEvent *ev){ setMouseCursor(Normal); } } + +/*void RootSubWindow::hideEvent(QHideEvent *ev){ + WIN->requestProperty(NativeWindow::Visible, false); + QFrame::hideEvent(ev); +}*/ + +void RootSubWindow::resizeEvent(QResizeEvent *ev){ + qDebug() << "Got Resize Event:" << ev->size(); + WIN->requestProperty(NativeWindow::Size, WinWidget->size()); + QFrame::resizeEvent(ev); +} +/*void RootSubWindow::showEvent(QShowEvent *ev){ + WIN->requestProperty(NativeWindow::Visible, true); + QFrame::showEvent(ev); +}*/ + -- cgit From c47e7ca51fcf653a3d3078924a93f2dca2c25359 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 08:37:37 -0400 Subject: Clean up some of the rootSubWindow overrides --- src-qt5/core/libLumina/RootSubWindow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 04deacf9..f45258a3 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -245,7 +245,7 @@ void RootSubWindow::propertiesChanged(QList props, QList //qDebug() << "RootSubWindow: Property Changed:" << props[i] << vals[i]; switch(props[i]){ case NativeWindow::Visible: - qDebug() << "Got Visibility Change:" << vals[i]; + //qDebug() << "Got Visibility Change:" << vals[i]; if(vals[i].toBool()){ WinWidget->setVisible(true); this->show(); } else{ this->hide(); } break; @@ -301,11 +301,11 @@ 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 - + QFrame::mousePressEvent(ev); } void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ - ev->accept(); + //ev->accept(); if(activeState == Normal){ setMouseCursor( getStateAtPoint(ev->pos()) ); //just update the mouse cursor }else{ @@ -382,12 +382,13 @@ void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ this->setGeometry(geom); } + QFrame::mouseMoveEvent(ev); } void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){ //Check for a right-click event //qDebug() << "Frame Mouse Release Event"; - ev->accept(); + QFrame::mouseReleaseEvent(ev); if( (activeState==Normal) && (titleBar->geometry().contains(ev->pos())) && (ev->button()==Qt::RightButton) ){ otherM->popup(ev->globalPos()); return; @@ -419,4 +420,3 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ WIN->requestProperty(NativeWindow::Visible, true); QFrame::showEvent(ev); }*/ - -- cgit From 4fa1cdda33d5fbdf3f1d496e705cddd76f7e1cfa Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 10:18:18 -0400 Subject: Get the window size/position change detection implemented. --- src-qt5/core/libLumina/RootSubWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index f45258a3..66cfbc6a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -261,11 +261,11 @@ void RootSubWindow::propertiesChanged(QList props, QList this->move( vals[i].toPoint() ); break; case NativeWindow::Size: - //qDebug() << "Got Widget Size:" << vals[i].toSize(); + 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() ) ); - //qDebug() << " - Size after change:" << WinWidget->size() << this->size(); + qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); -- cgit From f7ef0f0a21d56e3c9c946c6f4010a713835c8cbe Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 10:41:12 -0400 Subject: Make sure the global position of a window is/can be set as needed. --- src-qt5/core/libLumina/RootSubWindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 66cfbc6a..59cfc662 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -412,11 +412,18 @@ void RootSubWindow::leaveEvent(QEvent *ev){ }*/ void RootSubWindow::resizeEvent(QResizeEvent *ev){ - qDebug() << "Got Resize Event:" << ev->size(); + //qDebug() << "Got Resize Event:" << ev->size(); WIN->requestProperty(NativeWindow::Size, WinWidget->size()); QFrame::resizeEvent(ev); } + /*void RootSubWindow::showEvent(QShowEvent *ev){ WIN->requestProperty(NativeWindow::Visible, true); QFrame::showEvent(ev); }*/ + +void RootSubWindow::moveEvent(QMoveEvent *ev){ + //qDebug() << "Got Move Event:" << ev->pos(); + WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); + QFrame::moveEvent(ev); +} -- cgit From d911eba7e870937803e68562729b38173cdd5857 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 11:02:42 -0400 Subject: Ensure that the Global Position (and Size) properties *always* reference the embedded window. Also make a new "geometry()" function in NativeWindow to return the full window+frame geometry. --- src-qt5/core/libLumina/RootSubWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') 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 props, QList break; case NativeWindow::Icon: //qDebug() << "Got Icon Change:" << vals[i]; - otherB->setIcon(vals[i].value< QIcon>()); + otherB->setIcon(vals[i].value()); 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{ -- cgit From 44f14e37bd0ad573590d92cc6e1052b8d8711021 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 11:16:20 -0400 Subject: Clean up the handling of the frameExtents property quite a bit. --- src-qt5/core/libLumina/RootSubWindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index f17ee9a1..213e07ca 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -162,7 +162,7 @@ void RootSubWindow::initWindowFrame(){ titleLabel->setObjectName("Label_Title"); this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; }"); //And adjust the margins - mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); + mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); @@ -175,6 +175,13 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ for(int i=0; iproperty(list[i]); + if(list[i] == NativeWindow::FrameExtents){ + if(vals[i].isNull()){ + QList frame; frame << WIN_BORDER << WIN_BORDER << WIN_BORDER+titleLabel->height() << WIN_BORDER; + vals[i] = QVariant::fromValue< QList >(frame); //use this by default + WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); //make sure these values get saved permanently + } + } qDebug() << "Property:" << list[i] << vals[i]; } propertiesChanged(list, vals); @@ -276,6 +283,9 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Active: //if(vals[i].toBool()){ WinWidget->setFocus(); } break; + case NativeWindow::FrameExtents: + mainLayout->setContentsMargins( vals[i].value< QList >().at(0),vals[i].value< QList >().at(2) - titleLabel->height(),vals[i].value< QList >().at(1),vals[i].value< QList >().at(3)); + break; /*case NativeWindow::WindowFlags: this->setWindowFlags( val.value< Qt::WindowFlags >() ); break;*/ -- cgit From 1d301fca58db2a1ba171a1c3c423a7e32f6a059e Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 11:22:28 -0400 Subject: Oops - fix how the new/initial frame extents get saved into the structure.. --- src-qt5/core/libLumina/RootSubWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 213e07ca..bbbbf644 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -180,6 +180,7 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList frame; frame << WIN_BORDER << WIN_BORDER << WIN_BORDER+titleLabel->height() << WIN_BORDER; vals[i] = QVariant::fromValue< QList >(frame); //use this by default WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); //make sure these values get saved permanently + WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); } } qDebug() << "Property:" << list[i] << vals[i]; @@ -271,6 +272,7 @@ void RootSubWindow::propertiesChanged(QList props, QList qDebug() << "Got Widget Size:" << vals[i].toSize(); //WinWidget->setSizeHint( vals[i].toSize() ); //WinWidget->resize(vals[i].toSize() ); + WinWidget->resize(vals[i].toSize()); this->resize( WIN->geometry().size() ); qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; -- cgit From 9134d5971398e6de38465ca47b583d32bf8aaf94 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 11:50:20 -0400 Subject: Try to fix up the looping of the size/resize between X and the window --- src-qt5/core/libLumina/RootSubWindow.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index bbbbf644..075f94c5 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -269,12 +269,12 @@ void RootSubWindow::propertiesChanged(QList props, QList 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() ); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size(); + if(WinWidget->size() != 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(); + } break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); @@ -425,7 +425,9 @@ void RootSubWindow::leaveEvent(QEvent *ev){ void RootSubWindow::resizeEvent(QResizeEvent *ev){ //qDebug() << "Got Resize Event:" << ev->size(); - WIN->requestProperty(NativeWindow::Size, WinWidget->size()); + if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize()){ + WIN->requestProperty(NativeWindow::Size, WinWidget->size()); + } QFrame::resizeEvent(ev); } -- cgit From 1030649f5c8e831f1e7abae0b999173c6aed65ec Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 11:53:39 -0400 Subject: Quick fix to disable setting the new global position on window move (temporary) --- src-qt5/core/libLumina/RootSubWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 075f94c5..190ec3aa 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -265,7 +265,7 @@ void RootSubWindow::propertiesChanged(QList props, QList otherB->setIcon(vals[i].value()); break; case NativeWindow::GlobalPos: - //qDebug() << "Got Global Pos:" << vals[i].toPoint(); + qDebug() << "Got Global Pos:" << vals[i].toPoint(); this->move( WIN->geometry().topLeft() ); break; case NativeWindow::Size: @@ -437,7 +437,7 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ }*/ void RootSubWindow::moveEvent(QMoveEvent *ev){ - //qDebug() << "Got Move Event:" << ev->pos(); - WIN->setProperty(NativeWindow::GlobalPos, 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); } -- cgit From 9a8aa1fdf09be158a35737c3331ca1e08d844993 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 12:13:12 -0400 Subject: Quick change to some debugging --- src-qt5/core/libLumina/RootSubWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 190ec3aa..568c5dee 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -265,7 +265,7 @@ void RootSubWindow::propertiesChanged(QList props, QList otherB->setIcon(vals[i].value()); break; case NativeWindow::GlobalPos: - qDebug() << "Got Global Pos:" << vals[i].toPoint(); + qDebug() << "Got Global Pos:" << WIN->geometry().topLeft() << vals[i].toPoint(); this->move( WIN->geometry().topLeft() ); break; case NativeWindow::Size: -- cgit From 4f98326bc7c3b8f93c0f86059c813bdf866c2ddf Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 12:41:49 -0400 Subject: Fix up the saving/using of the global position property --- src-qt5/core/libLumina/RootSubWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 568c5dee..abaceca2 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -265,8 +265,8 @@ void RootSubWindow::propertiesChanged(QList props, QList otherB->setIcon(vals[i].value()); break; case NativeWindow::GlobalPos: - qDebug() << "Got Global Pos:" << WIN->geometry().topLeft() << vals[i].toPoint(); - this->move( WIN->geometry().topLeft() ); + 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()){ @@ -438,6 +438,6 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ void RootSubWindow::moveEvent(QMoveEvent *ev){ qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); - //WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); + WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); QFrame::moveEvent(ev); } -- cgit From 5a3ce5ac4fbc5f2169ab9eb7330e2096c73dd639 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 13:16:53 -0400 Subject: Get the RootSubWindow loading/using icons for the various buttons now. --- src-qt5/core/libLumina/RootSubWindow.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index abaceca2..d2ec7503 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -13,6 +13,8 @@ #define WIN_BORDER 5 +#include + // === PUBLIC === RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ this->setAttribute(Qt::WA_DeleteOnClose); @@ -166,8 +168,11 @@ void RootSubWindow::initWindowFrame(){ mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); - //this->setLayout(mainLayout); - //qDebug() << " - Done"; + //Now load the icons for the button + LIconCache::instance()->loadIcon(closeB, "window-close"); + LIconCache::instance()->loadIcon(maxB, "window-maximize"); + LIconCache::instance()->loadIcon(minB, "window-minimize"); + LIconCache::instance()->loadIcon(otherB, "list"); } void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ @@ -262,7 +267,8 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::Icon: //qDebug() << "Got Icon Change:" << vals[i]; - otherB->setIcon(vals[i].value()); + if(vals[i].value().isNull() ){ LIconCache::instance()->loadIcon(otherB, "window-close"); } + else{ otherB->setIcon(vals[i].value()); } break; case NativeWindow::GlobalPos: qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); -- cgit From 8fb12e24a67156e0ed6087592a4c5fe564f4462d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 13:20:59 -0400 Subject: Also clean up the default stylesheet for the window frame right now --- src-qt5/core/libLumina/RootSubWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index d2ec7503..cab02db4 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -162,7 +162,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; }"); + this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border-color: transparent; } QToolButton::hover{border-color: white;}"); //And adjust the margins mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); -- cgit From 1325f89e7b9b8baee10c47ef8473bffd5052e9b5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 13:29:00 -0400 Subject: Some more tweaks to the default stylesheet for the window frame. --- src-qt5/core/libLumina/RootSubWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index cab02db4..1814776a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -162,7 +162,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-color: transparent; } QToolButton::hover{border-color: white;}"); + 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::menu-arrow{ image: none; }"); //And adjust the margins mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); -- cgit From 06e86f64225d09ce1896f1ba860dbb1cedd71568 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 13:40:19 -0400 Subject: Add in a "show" animation for windows when they appear This is a good example of how animations can be setup/used in the window --- src-qt5/core/libLumina/RootSubWindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 1814776a..bf242eff 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -136,6 +136,9 @@ void RootSubWindow::initWindowFrame(){ maxB = new QToolButton(this); minB = new QToolButton(this); otherB = new QToolButton(this); + anim = new QPropertyAnimation(this); + anim->setTargetObject(this); + anim->setDuration(300); //1/3 second (appx) titleLabel = new QLabel(this); titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); otherM = new QMenu(this); //menu of other actions @@ -162,12 +165,13 @@ 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::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; } QToolButton::hover{border-color: white;} 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); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); + //Now load the icons for the button LIconCache::instance()->loadIcon(closeB, "window-close"); LIconCache::instance()->loadIcon(maxB, "window-maximize"); @@ -259,7 +263,13 @@ void RootSubWindow::propertiesChanged(QList props, QList switch(props[i]){ case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i]; - if(vals[i].toBool()){ WinWidget->setVisible(true); this->show(); } + if(vals[i].toBool()){ + WinWidget->setVisible(true); + this->show(); + anim->setPropertyName("windowOpacity"); + anim->setStartValue(0.0); anim->setEndValue(1.0); + anim->start(); + } else{ this->hide(); } break; case NativeWindow::Title: -- cgit From 8e9676547274d3bd63d5f54a583ceb79f775f359 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 13:49:55 -0400 Subject: Make sure we set the root flag that window opacity is supported. --- src-qt5/core/libLumina/RootSubWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index bf242eff..88dca132 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -265,10 +265,10 @@ void RootSubWindow::propertiesChanged(QList props, QList //qDebug() << "Got Visibility Change:" << vals[i]; if(vals[i].toBool()){ WinWidget->setVisible(true); - this->show(); anim->setPropertyName("windowOpacity"); anim->setStartValue(0.0); anim->setEndValue(1.0); anim->start(); + this->show(); } else{ this->hide(); } break; -- cgit From 1b8947f958d5ad1600a9eff5fe5fdf0f327d6926 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:08:35 -0400 Subject: Add some window close debugging, and change the setVisible animation to a window zoom rather than opacity (the frame is not technically an independant window). --- src-qt5/core/libLumina/RootSubWindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 88dca132..0aa97c54 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -265,8 +265,9 @@ void RootSubWindow::propertiesChanged(QList props, QList //qDebug() << "Got Visibility Change:" << vals[i]; if(vals[i].toBool()){ WinWidget->setVisible(true); - anim->setPropertyName("windowOpacity"); - anim->setStartValue(0.0); anim->setEndValue(1.0); + anim->setPropertyName("geometry"); + anim->setStartValue( QRect(this->geometry().center(), QSize(0,0)) ); + anim->setEndValue(this->geometry()); anim->start(); this->show(); } -- cgit From a512f8b35b20fe2c1ab8f1c26a2261b22dc0a253 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:25:50 -0400 Subject: Clean up a bunch of debugging, and add a "closing" animation to the rootSubWindow as well. --- src-qt5/core/libLumina/RootSubWindow.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') 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 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 props, QList else{ otherB->setIcon(vals[i].value()); } 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); } -- cgit From acfb339551b824f1e89c24364df9c9f330fd8549 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:42:08 -0400 Subject: Some more fixes for the window animations --- src-qt5/core/libLumina/RootSubWindow.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index eae5aa39..80d5c82b 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -202,7 +202,12 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ void RootSubWindow::clientClosed(){ qDebug() << "Client Closed"; closing = true; - this->close(); + anim->setPropertyName("geometry"); + anim->setStartValue(this->geometry()); + anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); + anim->start(); + QTimer::singleShot(anim->duration(), this, SLOT(close()) ); + //this->close(); } void RootSubWindow::LoadAllProperties(){ @@ -266,8 +271,8 @@ void RootSubWindow::propertiesChanged(QList props, QList if(vals[i].toBool()){ WinWidget->setVisible(true); anim->setPropertyName("geometry"); - anim->setStartValue( QRect(this->geometry().center(), QSize(0,0)) ); - anim->setEndValue(this->geometry()); + anim->setStartValue( QRect(WIN->geometry().center(), QSize(0,0)) ); + anim->setEndValue(WIN->geometry()); anim->start(); this->show(); }else{ @@ -284,7 +289,7 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::Icon: //qDebug() << "Got Icon Change:" << vals[i]; - if(vals[i].value().isNull() ){ LIconCache::instance()->loadIcon(otherB, "window-close"); } + if(vals[i].value().isNull() ){ LIconCache::instance()->loadIcon(otherB, "list"); } else{ otherB->setIcon(vals[i].value()); } break; case NativeWindow::GlobalPos: @@ -448,7 +453,7 @@ void RootSubWindow::leaveEvent(QEvent *ev){ void RootSubWindow::resizeEvent(QResizeEvent *ev){ //qDebug() << "Got Resize Event:" << ev->size(); - if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize()){ + if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ WIN->requestProperty(NativeWindow::Size, WinWidget->size()); } QFrame::resizeEvent(ev); @@ -461,6 +466,6 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ void RootSubWindow::moveEvent(QMoveEvent *ev){ //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); - WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); + if(!closing && anim->state()!=QAbstractAnimation::Running){ WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); } QFrame::moveEvent(ev); } -- cgit From e0e184fab30995de316bb6c9bb111785ad9d4f6b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:46:57 -0400 Subject: Add an animation finished routine so we can re-load any Window settings which are ignored during the animation. --- src-qt5/core/libLumina/RootSubWindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 80d5c82b..d5a2795d 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -139,6 +139,7 @@ void RootSubWindow::initWindowFrame(){ anim = new QPropertyAnimation(this); anim->setTargetObject(this); anim->setDuration(200); //1/5 second (appx) + connect(anim, SIGNAL(finished()), this, SLOT(animFinished()) ); titleLabel = new QLabel(this); titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); otherM = new QMenu(this); //menu of other actions @@ -258,8 +259,6 @@ void RootSubWindow::startResizing(){ } - - // === PRIVATE SLOTS === void RootSubWindow::propertiesChanged(QList props, QList vals){ for(int i=0; i props, QList } } +void RootSubWindow::animFinished(){ + if(anim->propertyName()=="geometry"){ this->setGeometry(this->geometry()); } //make sure to send one more resize/move event + +} + // === PROTECTED === void RootSubWindow::mousePressEvent(QMouseEvent *ev){ //qDebug() << "Frame Mouse Press Event"; -- cgit From aff9df01be61d2fb969ba38ba8c5721fac8384f6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:50:28 -0400 Subject: Fix up the animation finished routine - should work fine now --- src-qt5/core/libLumina/RootSubWindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index d5a2795d..2e773e9d 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -325,7 +325,10 @@ void RootSubWindow::propertiesChanged(QList props, QList } void RootSubWindow::animFinished(){ - if(anim->propertyName()=="geometry"){ this->setGeometry(this->geometry()); } //make sure to send one more resize/move event + if(anim->propertyName()=="geometry"){ + WIN->requestProperty(NativeWindow::Size, WinWidget->size()); + WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); + } } -- cgit From 5911c0b061840588626edee15d44ffbe16470301 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 14:55:39 -0400 Subject: add some debugging for the new window routine (need window ID's) --- src-qt5/core/libLumina/RootSubWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 2e773e9d..9eb1ff58 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -28,6 +28,7 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); WIN->addFrameWinID(WinWidget->winId()); WIN->emit RequestReparent(WIN->id(), WinWidget->winId(), QPoint(0,0)); + qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); //QTimer::singleShot(20, this, SLOT(LoadAllProperties()) ); } @@ -300,7 +301,7 @@ void RootSubWindow::propertiesChanged(QList props, QList //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(); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); } break; case NativeWindow::MinSize: -- cgit From 3cc4bb91529afd0a3454a3db86a7d8a7f51fde96 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Jun 2017 22:31:49 -0400 Subject: Commit another large block of work on Lumina2. 1. Starting to get the compositing put together, but not functional yet. 2. Get the window close routines completely finished, with memory being freed properly on close. 3. Get some of the "reset" of window properties after an animation all setup. Not quite finished yet. --- src-qt5/core/libLumina/RootSubWindow.cpp | 42 ++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 9eb1ff58..92a85291 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -30,11 +30,11 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ WIN->emit RequestReparent(WIN->id(), WinWidget->winId(), QPoint(0,0)); qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); - //QTimer::singleShot(20, this, SLOT(LoadAllProperties()) ); } RootSubWindow::~RootSubWindow(){ - + //qDebug() << "Visible Window Destroyed"; + WIN->deleteLater(); } WId RootSubWindow::id(){ @@ -202,30 +202,30 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ // === PUBLIC SLOTS === void RootSubWindow::clientClosed(){ - qDebug() << "Client Closed"; + //qDebug() << "Client Closed"; closing = true; + /*animResetProp = QRect(WIN->property(NativeWindow::GlobalPos).toPoint(), WIN->property(NativeWindow::Size).toSize()); anim->setPropertyName("geometry"); anim->setStartValue(this->geometry()); anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); anim->start(); - QTimer::singleShot(anim->duration(), this, SLOT(close()) ); - //this->close(); + QTimer::singleShot(anim->duration(), this, SLOT(close()) );*/ + if(anim->state()!=QAbstractAnimation::Running){ this->close(); } } void RootSubWindow::LoadAllProperties(){ QList< NativeWindow::Property> list = WIN->allProperties(); - /*list.removeAll(NativeWindow::Visible); - list << NativeWindow::Visible;*/ LoadProperties(list); } //Button Actions - public so they can be tied to key shortcuts and stuff as well void RootSubWindow::toggleMinimize(){ - + WIN->setProperty(NativeWindow::Visible, false); + QTimer::singleShot(2000, this, SLOT(toggleMaximize()) ); } void RootSubWindow::toggleMaximize(){ - + WIN->setProperty(NativeWindow::Visible, true); } void RootSubWindow::triggerClose(){ @@ -270,12 +270,14 @@ void RootSubWindow::propertiesChanged(QList props, QList //qDebug() << "Got Visibility Change:" << vals[i]; if(vals[i].toBool()){ WinWidget->setVisible(true); + animResetProp = WIN->geometry(); //show event - might not have the right geom yet anim->setPropertyName("geometry"); anim->setStartValue( QRect(WIN->geometry().center(), QSize(0,0)) ); anim->setEndValue(WIN->geometry()); anim->start(); this->show(); }else{ + animResetProp = this->geometry(); //hide event - should already be the right geom anim->setPropertyName("geometry"); anim->setStartValue(this->geometry()); anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); @@ -298,10 +300,10 @@ void RootSubWindow::propertiesChanged(QList props, QList 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(); + qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); } break; case NativeWindow::MinSize: @@ -326,15 +328,25 @@ void RootSubWindow::propertiesChanged(QList props, QList } void RootSubWindow::animFinished(){ - if(anim->propertyName()=="geometry"){ - WIN->requestProperty(NativeWindow::Size, WinWidget->size()); - WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); + if(closing){ this->close(); return;} + else if(anim->propertyName()=="geometry"){ + if(!animResetProp.isNull()){ + qDebug() << "Animation Finished, Reset Geometry:" << animResetProp; + qDebug() << " - Starting Value:" << anim->startValue(); + qDebug() << " - Ending Value:" << anim->endValue(); + qDebug() << " - Current Value:" << this->geometry(); + this->setGeometry( animResetProp.toRect() ); + WIN->requestProperty(NativeWindow::Size, WinWidget->size(), true); + WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)),true ); + } } - + animResetProp = QVariant(); //clear the variable } // === PROTECTED === void RootSubWindow::mousePressEvent(QMouseEvent *ev){ + activate(); + this->raise(); //qDebug() << "Frame Mouse Press Event"; offset.setX(0); offset.setY(0); if(activeState != Normal){ return; } // do nothing - already in a state of grabbed mouse -- cgit From 6a2af03c68033a9683de619b4ae6493a4f7254b7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 13 Jul 2017 14:02:59 -0400 Subject: Large update to the window embedding systems - almost have the compositing up and running. --- src-qt5/core/libLumina/RootSubWindow.cpp | 33 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 92a85291..5ce3d149 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -26,10 +26,10 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ initWindowFrame(); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); - WIN->addFrameWinID(WinWidget->winId()); - WIN->emit RequestReparent(WIN->id(), WinWidget->winId(), QPoint(0,0)); + WinWidget->embedWindow(WIN); qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); + //this->show(); } RootSubWindow::~RootSubWindow(){ @@ -147,7 +147,7 @@ void RootSubWindow::initWindowFrame(){ otherB->setMenu(otherM); otherB->setPopupMode(QToolButton::InstantPopup); otherB->setAutoRaise(true); - WinWidget = new QWidget(this); + WinWidget = new NativeEmbedWidget(this); connect(closeB, SIGNAL(clicked()), this, SLOT(triggerClose()) ); connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); @@ -267,13 +267,13 @@ void RootSubWindow::propertiesChanged(QList props, QList //qDebug() << "RootSubWindow: Property Changed:" << props[i] << vals[i]; switch(props[i]){ case NativeWindow::Visible: - //qDebug() << "Got Visibility Change:" << vals[i]; + qDebug() << "Got Visibility Change:" << vals[i] << this->geometry(); if(vals[i].toBool()){ - WinWidget->setVisible(true); - animResetProp = WIN->geometry(); //show event - might not have the right geom yet + animResetProp = WIN->geometry(); //this->geometry(); anim->setPropertyName("geometry"); - anim->setStartValue( QRect(WIN->geometry().center(), QSize(0,0)) ); - anim->setEndValue(WIN->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{ @@ -283,7 +283,6 @@ void RootSubWindow::propertiesChanged(QList props, QList anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); anim->start(); QTimer::singleShot(anim->duration(), this, SLOT(hide()) ); - //this->hide(); } break; case NativeWindow::Title: @@ -295,16 +294,16 @@ void RootSubWindow::propertiesChanged(QList props, QList else{ otherB->setIcon(vals[i].value()); } 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()){ + //if(WinWidget->size() != vals[i].toSize()){ qDebug() << "Got Widget Size Change:" << vals[i].toSize(); - WinWidget->resize(vals[i].toSize()); + //WinWidget->resize(vals[i].toSize()); this->resize( WIN->geometry().size() ); qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); - } + //} break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); @@ -331,13 +330,13 @@ void RootSubWindow::animFinished(){ if(closing){ this->close(); return;} else if(anim->propertyName()=="geometry"){ if(!animResetProp.isNull()){ - qDebug() << "Animation Finished, Reset Geometry:" << animResetProp; + /*qDebug() << "Animation Finished, Reset Geometry:" << animResetProp; qDebug() << " - Starting Value:" << anim->startValue(); qDebug() << " - Ending Value:" << anim->endValue(); - qDebug() << " - Current Value:" << this->geometry(); + qDebug() << " - Current Value:" << this->geometry();*/ this->setGeometry( animResetProp.toRect() ); - WIN->requestProperty(NativeWindow::Size, WinWidget->size(), true); - WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)),true ); + //WIN->requestProperty(NativeWindow::Size, WinWidget->size(), true); + //WIN->requestProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)),true ); } } animResetProp = QVariant(); //clear the variable -- cgit From c6cf1c1799aa3e6f095cae0aa579e0ea2971340e Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 13 Jul 2017 15:49:07 -0400 Subject: Start working on getting the frame extents set/used properly. Still off on the geom calculations right now. --- src-qt5/core/libLumina/RootSubWindow.cpp | 40 +++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 5ce3d149..11bfde29 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -173,6 +173,9 @@ void RootSubWindow::initWindowFrame(){ mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); + this->setFrameRect(QRect(0,0,0,0)); + this->setFrameShape(QFrame::NoFrame); + this->setContentsMargins(0,0,0,0); //Now load the icons for the button LIconCache::instance()->loadIcon(closeB, "window-close"); @@ -186,15 +189,18 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ for(int i=0; iproperty(list[i]); - if(list[i] == NativeWindow::FrameExtents){ + /*if(list[i] == NativeWindow::FrameExtents){ + qDebug() << "Check Frame Extents:" << vals[i]; if(vals[i].isNull()){ - QList frame; frame << WIN_BORDER << WIN_BORDER << WIN_BORDER+titleLabel->height() << WIN_BORDER; + qDebug() << " - supply default frame extents"; + QList frame; frame << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height(); vals[i] = QVariant::fromValue< QList >(frame); //use this by default WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); //make sure these values get saved permanently WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); + qDebug() << " - Default values:" << frame; } - } - qDebug() << "Property:" << list[i] << vals[i]; + }*/ + //qDebug() << "Property:" << list[i] << vals[i]; } propertiesChanged(list, vals); WIN->requestProperty(NativeWindow::Visible, true); @@ -215,6 +221,7 @@ void RootSubWindow::clientClosed(){ void RootSubWindow::LoadAllProperties(){ QList< NativeWindow::Property> list = WIN->allProperties(); + list << NativeWindow::FrameExtents; LoadProperties(list); } @@ -264,10 +271,10 @@ void RootSubWindow::startResizing(){ void RootSubWindow::propertiesChanged(QList props, QList vals){ for(int i=0; igeometry(); + qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ animResetProp = WIN->geometry(); //this->geometry(); anim->setPropertyName("geometry"); @@ -294,16 +301,21 @@ void RootSubWindow::propertiesChanged(QList props, QList else{ otherB->setIcon(vals[i].value()); } 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(); - //WinWidget->resize(vals[i].toSize()); + qDebug() << " - SIZE CHANGE"; + if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ + qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); this->resize( WIN->geometry().size() ); qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); - //} + } break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); @@ -315,6 +327,12 @@ void RootSubWindow::propertiesChanged(QList props, QList //if(vals[i].toBool()){ WinWidget->setFocus(); } break; case NativeWindow::FrameExtents: + qDebug() << " - FRAME CHANGE"; + if(vals[i].isNull()){ + vals[i] = QVariant::fromValue >( QList() << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height() ); + WIN->setProperty(NativeWindow::FrameExtents, vals[i]); + } + qDebug() << "Setting Frame Extents:" << vals[i].value >(); mainLayout->setContentsMargins( vals[i].value< QList >().at(0),vals[i].value< QList >().at(2) - titleLabel->height(),vals[i].value< QList >().at(1),vals[i].value< QList >().at(3)); break; /*case NativeWindow::WindowFlags: -- cgit From c2ae980ffa96dc8982e5c87f346f2763fcf38d4f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 14:26:38 -0400 Subject: Get a lot more of the geometry calculations/movements working. Almost ready to start adding additional window property support --- src-qt5/core/libLumina/RootSubWindow.cpp | 126 +++++++++++++++++++------------ 1 file changed, 77 insertions(+), 49 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 11bfde29..8c7c9b1a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -22,14 +22,12 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ //Create the QWindow and QWidget containers for the window WIN = win; closing = false; - //WinWidget = QWidget::createWindowContainer( WIN->window(), this); initWindowFrame(); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); WinWidget->embedWindow(WIN); qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); - //this->show(); } RootSubWindow::~RootSubWindow(){ @@ -48,10 +46,10 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset //above the frame itself - need to figure out which quadrant it is in (8-directions) if(pt.y() < WIN_BORDER){ //One of the top options - if(pt.x() < WIN_BORDER){ + if(pt.x() < this->width()/5){ if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner return ResizeTopLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()*4.0/5.0)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(pt.y()); } //difference from top-right corner return ResizeTopRight; }else{ @@ -60,10 +58,10 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset } }else if(pt.y() > (this->height()-WIN_BORDER) ){ //One of the bottom options - if(pt.x() < WIN_BORDER){ + if(pt.x() < this->width()/5){ if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner return ResizeBottomLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()*4.0/5.0)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-right corner return ResizeBottomRight; }else{ @@ -131,8 +129,13 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ void RootSubWindow::initWindowFrame(){ //qDebug() << "Create RootSubWindow Frame"; + this->setContentsMargins(0,0,0,0); mainLayout = new QVBoxLayout(this); - titleBar = new QHBoxLayout(); + mainLayout->setContentsMargins(0,0,0,0); + titleBar = new QWidget(this); + titleBar->setContentsMargins(0,0,0,0); + titleBarL = new QHBoxLayout(titleBar); + titleBarL->setContentsMargins(0,0,0,0); closeB = new QToolButton(this); maxB = new QToolButton(this); minB = new QToolButton(this); @@ -152,13 +155,14 @@ void RootSubWindow::initWindowFrame(){ connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); //Now assemble the frame layout based on the current settings - titleBar->addWidget(otherB); - titleBar->addWidget(titleLabel); - titleBar->addWidget(minB); - titleBar->addWidget(maxB); - titleBar->addWidget(closeB); + titleBarL->addWidget(otherB); + titleBarL->addWidget(titleLabel); + titleBarL->addWidget(minB); + titleBarL->addWidget(maxB); + titleBarL->addWidget(closeB); WinWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mainLayout->addLayout(titleBar); + titleBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + mainLayout->addWidget(titleBar); mainLayout->addWidget(WinWidget); //Now all the stylesheet options this->setObjectName("WindowFrame"); @@ -167,15 +171,20 @@ 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; border-radius: 3px; } QToolButton::hover{background-color: rgba(255,255,255,150); } QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); + this->setStyleSheet("QFrame#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); - titleBar->setSpacing(1); - titleBar->setContentsMargins(0,0,0,0); + titleBarL->setSpacing(1); + this->setFrameStyle(QFrame::NoFrame); + this->setLineWidth(0); + this->setMidLineWidth(0); this->setFrameRect(QRect(0,0,0,0)); - this->setFrameShape(QFrame::NoFrame); - this->setContentsMargins(0,0,0,0); + + //Setup the timer object to syncronize info + moveTimer = new QTimer(this); + moveTimer->setSingleShot(true); + moveTimer->setInterval(100); //1/10 second + connect(moveTimer, SIGNAL(timeout()), WinWidget, SLOT(resyncWindow()) ); //Now load the icons for the button LIconCache::instance()->loadIcon(closeB, "window-close"); @@ -184,26 +193,34 @@ void RootSubWindow::initWindowFrame(){ LIconCache::instance()->loadIcon(otherB, "list"); } +void RootSubWindow::enableFrame(bool on){ + //Make the individual frame elements visible as needed + if(on){ this->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); }//default border + else{ this->setContentsMargins(0, 0, 0, 0); } + titleBar->setVisible(on); + //And now calculate/save the frame extents + QList extents; extents << 0 << 0 << 0 << 0; //left, right, top, bottom + if(on){ + extents[0] = WIN_BORDER; + extents[1] = WIN_BORDER; + extents[2] = WIN_BORDER + titleBar->height(); + extents[3] = WIN_BORDER; + } + qDebug() << "SET FRAME EXTENTS:" << extents; + WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(extents) ); //save on raw window itself + WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(extents) ); //save to structure now +} + void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList vals; + //Always ensure that visibility changes are evaluated last + bool addvisible = false; for(int i=0; iproperty(list[i]); - /*if(list[i] == NativeWindow::FrameExtents){ - qDebug() << "Check Frame Extents:" << vals[i]; - if(vals[i].isNull()){ - qDebug() << " - supply default frame extents"; - QList frame; frame << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height(); - vals[i] = QVariant::fromValue< QList >(frame); //use this by default - WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); //make sure these values get saved permanently - WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(frame)); - qDebug() << " - Default values:" << frame; - } - }*/ - //qDebug() << "Property:" << list[i] << vals[i]; } + //if(addvisible){ list << NativeWindow::Visible; vals << WIN->property(NativeWindow::Visible); } propertiesChanged(list, vals); - WIN->requestProperty(NativeWindow::Visible, true); } // === PUBLIC SLOTS === @@ -220,9 +237,12 @@ void RootSubWindow::clientClosed(){ } void RootSubWindow::LoadAllProperties(){ - QList< NativeWindow::Property> list = WIN->allProperties(); - list << NativeWindow::FrameExtents; + QList< NativeWindow::Property> list; + list << NativeWindow::WinTypes << NativeWindow::WinActions << NativeWindow::States + << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Title << NativeWindow::ShortTitle + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); + WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -271,10 +291,10 @@ void RootSubWindow::startResizing(){ void RootSubWindow::propertiesChanged(QList props, QList vals){ for(int i=0; igeometry() << WIN->geometry(); + //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ animResetProp = WIN->geometry(); //this->geometry(); anim->setPropertyName("geometry"); @@ -312,9 +332,12 @@ void RootSubWindow::propertiesChanged(QList props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + if(vals[i].toSize() != WinWidget->size()){ + qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + WinWidget->resize(vals[i].toSize()); + this->resize( WIN->geometry().size() ); + qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + } } break; case NativeWindow::MinSize: @@ -326,7 +349,7 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Active: //if(vals[i].toBool()){ WinWidget->setFocus(); } break; - case NativeWindow::FrameExtents: + /*case NativeWindow::FrameExtents: qDebug() << " - FRAME CHANGE"; if(vals[i].isNull()){ vals[i] = QVariant::fromValue >( QList() << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height() ); @@ -334,10 +357,10 @@ void RootSubWindow::propertiesChanged(QList props, QList } qDebug() << "Setting Frame Extents:" << vals[i].value >(); mainLayout->setContentsMargins( vals[i].value< QList >().at(0),vals[i].value< QList >().at(2) - titleLabel->height(),vals[i].value< QList >().at(1),vals[i].value< QList >().at(3)); - break; - /*case NativeWindow::WindowFlags: - this->setWindowFlags( val.value< Qt::WindowFlags >() ); break;*/ + case NativeWindow::WinTypes: + enableFrame(vals[i].value< QList >().contains(NativeWindow::T_NORMAL) ); + break; default: qDebug() << "Window Property Unused:" << props[i] << vals[i]; } @@ -473,7 +496,7 @@ void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){ activeState = Normal; QApplication::restoreOverrideCursor(); setMouseCursor( getStateAtPoint(ev->pos()) ); - if(QWidget::mouseGrabber() == this){ this->releaseMouse(); } + if(QFrame::mouseGrabber() == this){ this->releaseMouse(); } } void RootSubWindow::leaveEvent(QEvent *ev){ @@ -490,9 +513,9 @@ void RootSubWindow::leaveEvent(QEvent *ev){ void RootSubWindow::resizeEvent(QResizeEvent *ev){ //qDebug() << "Got Resize Event:" << ev->size(); - if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ + /*if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ WIN->requestProperty(NativeWindow::Size, WinWidget->size()); - } + }*/ QFrame::resizeEvent(ev); } @@ -502,7 +525,12 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ }*/ void RootSubWindow::moveEvent(QMoveEvent *ev){ - //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); - if(!closing && anim->state()!=QAbstractAnimation::Running){ WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); } + qDebug() << "Got Move Event:" << ev->pos() << WinWidget->geometry(); QFrame::moveEvent(ev); + if(!closing && anim->state()!=QAbstractAnimation::Running){ + moveTimer->start(); + //WinWidget->resyncWindow(); + //WIN->requestProperty(NativeWindow::GlobalPos, ev->pos() ); + } + } -- cgit From e4ec849945d035909187149a2b36e5b5d3ba4c27 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 14:41:24 -0400 Subject: Add some better edge-detection systems for the window borders on the left/right sides. --- src-qt5/core/libLumina/RootSubWindow.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 8c7c9b1a..d4c0ceeb 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -68,17 +68,32 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset if(setoffset){ offset.setX(0); offset.setY(this->height() - pt.y()); } //difference from bottom edge (X does not matter) return ResizeBottom; } - }else{ - //One of the side options - if(pt.x() < WIN_BORDER){ + }else if(pt.x() < WIN_BORDER){ + //Left side options + if(pt.y() < this->height()/5){ + if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner + return ResizeTopLeft; + }else if(pt.y() > (this->height()*4.0/5.0)){ + if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner + return ResizeBottomLeft; + }else{ if(setoffset){ offset.setX(pt.x()); offset.setY(0); } //difference from left edge (Y does not matter) return ResizeLeft; - }else if(pt.x() > (this->width()-WIN_BORDER) ){ + } + }else if(pt.x() > (this->width()-WIN_BORDER) ){ + //Right side options + if(pt.y() < this->height()/5){ + if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(pt.y()); } //difference from top-right corner + return ResizeTopRight; + }else if(pt.y() > (this->height()*4.0/5.0)){ + if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-right corner + return ResizeBottomRight; + }else{ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(0); } //difference from right edge (Y does not matter) return ResizeRight; - }else{ - return Normal; } + }else{ + return Normal; } } return Normal; @@ -525,7 +540,7 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ }*/ void RootSubWindow::moveEvent(QMoveEvent *ev){ - qDebug() << "Got Move Event:" << ev->pos() << WinWidget->geometry(); + //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->geometry(); QFrame::moveEvent(ev); if(!closing && anim->state()!=QAbstractAnimation::Running){ moveTimer->start(); -- cgit From 6331ded27b98c14295f7e7367b321e97366ad897 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 18:56:59 -0400 Subject: Get the resize/movement functionality all finished. --- src-qt5/core/libLumina/RootSubWindow.cpp | 34 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index d4c0ceeb..a759dc09 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -311,7 +311,8 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ - animResetProp = WIN->geometry(); //this->geometry(); + if(lastGeom.isNull()){ animResetProp = WIN->geometry(); } + else{ animResetProp = lastGeom; } anim->setPropertyName("geometry"); anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); anim->setEndValue(animResetProp); @@ -320,6 +321,7 @@ void RootSubWindow::propertiesChanged(QList props, QList 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) ) ); @@ -337,21 +339,25 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::GlobalPos: //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() ); + if(activeState == RootSubWindow::Normal){ + this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); + } break; case NativeWindow::Size: - qDebug() << " - SIZE CHANGE"; - if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ - if(vals[i].toSize() != WinWidget->size()){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + //qDebug() << " - SIZE CHANGE"; + if(activeState == RootSubWindow::Normal){ + if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ + if(vals[i].toSize() != WinWidget->size()){ + //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + WinWidget->resize(vals[i].toSize()); + this->resize( WIN->geometry().size() ); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + } } } break; -- cgit From f998c3ad846ac75776cb2cf5207968cfe90dc25d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 19:04:05 -0400 Subject: Clean up a bit of debugging and such --- src-qt5/core/libLumina/RootSubWindow.cpp | 64 ++++++++------------------------ 1 file changed, 16 insertions(+), 48 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index a759dc09..35b2d7cd 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -26,7 +26,7 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); WinWidget->embedWindow(WIN); - qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); + //qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); } @@ -221,7 +221,7 @@ void RootSubWindow::enableFrame(bool on){ extents[2] = WIN_BORDER + titleBar->height(); extents[3] = WIN_BORDER; } - qDebug() << "SET FRAME EXTENTS:" << extents; + //qDebug() << "SET FRAME EXTENTS:" << extents; WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(extents) ); //save on raw window itself WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList >(extents) ); //save to structure now } @@ -242,12 +242,6 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ void RootSubWindow::clientClosed(){ //qDebug() << "Client Closed"; closing = true; - /*animResetProp = QRect(WIN->property(NativeWindow::GlobalPos).toPoint(), WIN->property(NativeWindow::Size).toSize()); - anim->setPropertyName("geometry"); - anim->setStartValue(this->geometry()); - anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); - anim->start(); - QTimer::singleShot(anim->duration(), this, SLOT(close()) );*/ if(anim->state()!=QAbstractAnimation::Running){ this->close(); } } @@ -311,8 +305,7 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ - if(lastGeom.isNull()){ animResetProp = WIN->geometry(); } - else{ animResetProp = lastGeom; } + animResetProp = WIN->geometry(); //this->geometry(); anim->setPropertyName("geometry"); anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); anim->setEndValue(animResetProp); @@ -321,7 +314,6 @@ void RootSubWindow::propertiesChanged(QList props, QList 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) ) ); @@ -339,25 +331,21 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::GlobalPos: //qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); - if(activeState == RootSubWindow::Normal){ - this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); - } + this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); break; case NativeWindow::Size: - //qDebug() << " - SIZE CHANGE"; - if(activeState == RootSubWindow::Normal){ - if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ - if(vals[i].toSize() != WinWidget->size()){ - //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); - } + qDebug() << " - SIZE CHANGE"; + if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ + if(vals[i].toSize() != WinWidget->size()){ + qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + WinWidget->resize(vals[i].toSize()); + this->resize( WIN->geometry().size() ); + qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); } } break; @@ -397,8 +385,6 @@ void RootSubWindow::animFinished(){ qDebug() << " - Ending Value:" << anim->endValue(); qDebug() << " - Current Value:" << this->geometry();*/ this->setGeometry( animResetProp.toRect() ); - //WIN->requestProperty(NativeWindow::Size, WinWidget->size(), true); - //WIN->requestProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)),true ); } } animResetProp = QVariant(); //clear the variable @@ -527,24 +513,6 @@ void RootSubWindow::leaveEvent(QEvent *ev){ } } -/*void RootSubWindow::hideEvent(QHideEvent *ev){ - WIN->requestProperty(NativeWindow::Visible, false); - QFrame::hideEvent(ev); -}*/ - -void RootSubWindow::resizeEvent(QResizeEvent *ev){ - //qDebug() << "Got Resize Event:" << ev->size(); - /*if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ - WIN->requestProperty(NativeWindow::Size, WinWidget->size()); - }*/ - QFrame::resizeEvent(ev); -} - -/*void RootSubWindow::showEvent(QShowEvent *ev){ - WIN->requestProperty(NativeWindow::Visible, true); - QFrame::showEvent(ev); -}*/ - void RootSubWindow::moveEvent(QMoveEvent *ev){ //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->geometry(); QFrame::moveEvent(ev); -- cgit From 1de88d56aa6eafc7ee347a607ae855526e5edad5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 20:47:10 -0400 Subject: Finish up the on-move window notification so that sub-windows (menus and such) are painted in the proper place. --- src-qt5/core/libLumina/RootSubWindow.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 35b2d7cd..1059871a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -27,6 +27,7 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ connect(WIN, SIGNAL(PropertiesChanged(QList, QList)), this, SLOT(propertiesChanged(QList, QList))); WinWidget->embedWindow(WIN); //qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); + activeState = RootSubWindow::Normal; LoadAllProperties(); } @@ -96,6 +97,7 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset return Normal; } } + //if it gets this far just return normal return Normal; } @@ -305,7 +307,8 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ - animResetProp = WIN->geometry(); //this->geometry(); + if(lastGeom.isNull()){ animResetProp = this->geometry(); } + else{ animResetProp = lastGeom; } anim->setPropertyName("geometry"); anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); anim->setEndValue(animResetProp); @@ -314,6 +317,7 @@ void RootSubWindow::propertiesChanged(QList props, QList 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) ) ); @@ -331,21 +335,23 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::GlobalPos: //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() ); + if(activeState == RootSubWindow::Normal){ + this->move( WIN->geometry().topLeft() ); + } break; case NativeWindow::Size: - qDebug() << " - SIZE CHANGE"; + //qDebug() << " - SIZE CHANGE"; if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ - if(vals[i].toSize() != WinWidget->size()){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + }else if(anim->state() != QPropertyAnimation::Running ){ + if(vals[i].toSize() != WinWidget->size() && activeState==Normal){ + //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); WinWidget->resize(vals[i].toSize()); this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); } } break; -- cgit From f5b60b2681bc6fc8e9171566e28064fe7048aa8b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 19 Jul 2017 13:53:34 -0400 Subject: Another checkpoint in the compositing saga. Got most of it working, but still getting random artifacting *outside* of the window that we are painting from time to time. --- src-qt5/core/libLumina/RootSubWindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 1059871a..9ef6464e 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -181,6 +181,12 @@ void RootSubWindow::initWindowFrame(){ titleBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); mainLayout->addWidget(titleBar); mainLayout->addWidget(WinWidget); + //Setup the cursors for the buttons + closeB->setCursor(Qt::ArrowCursor); + minB->setCursor(Qt::ArrowCursor); + maxB->setCursor(Qt::ArrowCursor); + otherM->setCursor(Qt::ArrowCursor); + titleLabel->setCursor(Qt::ArrowCursor); //Now all the stylesheet options this->setObjectName("WindowFrame"); closeB->setObjectName("Button_Close"); @@ -492,7 +498,6 @@ void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ default: break; } - this->setGeometry(geom); } QFrame::mouseMoveEvent(ev); -- cgit