diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2017-07-27 12:14:30 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2017-07-27 12:14:30 -0400 |
commit | 675dd82ad7a1d41d994164e0d5da6fb6b9584f84 (patch) | |
tree | 6d66b946296e322e062c5e01c953c13624db7d00 /src-qt5/core/libLumina | |
parent | Removed unneeded titles (diff) | |
parent | Start adding the window arrangement framework to Lumina2. (diff) | |
download | lumina-675dd82ad7a1d41d994164e0d5da6fb6b9584f84.tar.gz lumina-675dd82ad7a1d41d994164e0d5da6fb6b9584f84.tar.bz2 lumina-675dd82ad7a1d41d994164e0d5da6fb6b9584f84.zip |
Merge branch 'master' of https://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.cpp | 11 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 20 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow-mgmt.cpp | 34 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.h | 11 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.pri | 1 |
6 files changed, 71 insertions, 7 deletions
diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 48d0380b..3c76ed00 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -86,7 +86,16 @@ void NativeWindow::requestProperties(QList<NativeWindow::Property> props, QList< QRect NativeWindow::geometry(){ //Calculate the "full" geometry of the window + frame (if any) - QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), hash.value(NativeWindow::Size).toSize() ); + //Check that the size is between the min/max limitations + QSize size = hash.value(NativeWindow::Size).toSize(); + QSize min = hash.value(NativeWindow::MinSize).toSize(); + QSize max = hash.value(NativeWindow::MaxSize).toSize(); + if(min.isValid() && min.width() > size.width() ){ size.setWidth(min.width()); } + if(min.isValid() && min.height() > size.height()){ size.setHeight(min.height()); } + if(max.isValid() && max.width() < size.width() && max.width()>min.width()){ size.setWidth(max.width()); } + if(max.isValid() && max.height() < size.height() && max.height()>min.height()){ size.setHeight(max.height()); } + //Assemble the full geometry + QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), size ); //Now adjust the window geom by the frame margins QList<int> frame = hash.value(NativeWindow::FrameExtents).value< QList<int> >(); //Left,Right,Top,Bottom //qDebug() << "Calculate Geometry:" << geom << frame; diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index c2da8aef..322e524f 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -266,9 +266,9 @@ void RootSubWindow::LoadAllProperties(){ 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; + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos;// << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); - WIN->requestProperty(NativeWindow::Visible, true); + //WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -342,13 +342,25 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running ){ - if(vals[i].toSize() != WinWidget->size() && activeState==Normal && vals[i]==WIN->property(NativeWindow::Size)){ + if(WIN->property(NativeWindow::Size).toSize() != WinWidget->size() && activeState==Normal ){ this->setGeometry(WIN->geometry()); } } break; case NativeWindow::MinSize: - WinWidget->setMinimumSize(vals[i].toSize()); + if(vals[i].toSize().isValid()){ + //Just larger than titlebar, with enough space for 8 characters in the titlebar (+4 buttons) + //qDebug() << "Got invalid Min Size: Set a reasonable default minimum"; + WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().width("O")*10, this->fontMetrics().height()*10) ); + WIN->setProperty(NativeWindow::MinSize, WinWidget->minimumSize()); + }else{ + WinWidget->setMinimumSize(vals[i].toSize()); + } + if(WIN->property(NativeWindow::Size).toSize().width() < WinWidget->minimumSize().width() \ + || WIN->property(NativeWindow::Size).toSize().height() < WinWidget->minimumSize().height() ){ + WIN->setProperty(NativeWindow::Size, WinWidget->minimumSize(), true); //force this + //WinWidget->resize(WinWidget->minimumSize()); + } break; case NativeWindow::MaxSize: WinWidget->setMaximumSize(vals[i].toSize()); diff --git a/src-qt5/core/libLumina/RootWindow-mgmt.cpp b/src-qt5/core/libLumina/RootWindow-mgmt.cpp new file mode 100644 index 00000000..e00ce9ce --- /dev/null +++ b/src-qt5/core/libLumina/RootWindow-mgmt.cpp @@ -0,0 +1,34 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootWindow.h" + +//Primary/private function +void RootWindow::arrangeWindows(RootSubWindow *primary, QString type){ + if(primary==0){ + //Get the currently active window and treat that as the primary + + } + //Now loop over the windows and arrange them as needed + +} + +// ================ +// Public slots for starting the arrangement routine(s) above +// ================ +void RootWindow::ArrangeWindows(WId *primary, QString type){ + +} + +void RootWindow::TileWindows(WId *primary, QString type){ + +} + +void RootWindow::CheckWindowPosition(WId, bool newwindow){ + //used after a "drop" to validate/snap/re-arrange window(s) as needed + // if "newwindow" is true, then this is the first-placement routine for a window before it initially appears + +} diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 90ad8739..596755df 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -185,6 +185,7 @@ void RootWindow::NewWindow(NativeWindow *win){ connect(win, SIGNAL(WindowClosed(WId)), this, SLOT(CloseWindow(WId)) ); WINDOWS << subwin; } + CheckWindowPosition(win->id(), true); //first-time run //win->setProperty(NativeWindow::Visible, true); //win->requestProperty( NativeWindow::Active, true); win->requestProperties(QList<NativeWindow::Property>() << NativeWindow::Visible << NativeWindow::Active, QList<QVariant>() << true << true); diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/RootWindow.h index a7792752..2fd76cea 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/RootWindow.h @@ -18,10 +18,11 @@ #include <QTimer> #include <QApplication> #include <QPaintEvent> -//#include <QMdiArea> #include "RootSubWindow.h" -#include "NativeWindow.h" + +#include <NativeWindow.h> +#include <DesktopSettings.h> class RootWindow : public QWidget{ Q_OBJECT @@ -49,6 +50,7 @@ private: //Window Management QList<RootSubWindow*> WINDOWS; + void arrangeWindows(RootSubWindow *primary = 0, QString type = ""); public slots: void ResizeRoot(); @@ -58,6 +60,11 @@ public slots: void NewWindow(NativeWindow*); void CloseWindow(WId); //automatically connected for any new native window + //Window arrangement functions - defined in "RootWindow-mgmt.cpp" + void ArrangeWindows(WId *primary = 0, QString type = ""); + void TileWindows(WId *primary = 0, QString type = ""); + void CheckWindowPosition(WId, bool newwindow = false); //used after a "drop" to validate/snap/re-arrange window(s) as needed + private slots: protected: diff --git a/src-qt5/core/libLumina/RootWindow.pri b/src-qt5/core/libLumina/RootWindow.pri index b83240e5..9426b6b4 100644 --- a/src-qt5/core/libLumina/RootWindow.pri +++ b/src-qt5/core/libLumina/RootWindow.pri @@ -1,6 +1,7 @@ # Files SOURCES *= $${PWD}/RootWindow.cpp \ + $${PWD}/RootWindow-mgmt.cpp \ $${PWD}/RootSubWindow.cpp \ $${PWD}/RootSubWindow-animations.cpp |