aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-01-19 14:53:04 -0500
committerKen Moore <ken@ixsystems.com>2018-01-19 14:53:04 -0500
commit8ab77628db56aba8e9295ede63c56d9312e4262a (patch)
treeac44b95b7b26cf8db489a199089fd4319bb3dcc4 /src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-8ab77628db56aba8e9295ede63c56d9312e4262a.tar.gz
lumina-8ab77628db56aba8e9295ede63c56d9312e4262a.tar.bz2
lumina-8ab77628db56aba8e9295ede63c56d9312e4262a.zip
Get some more of Lumina 2 cleaned up:
1. Ensure window visibility is managed on the QML side 2. Have all panels (even ones pinned to a screen) get created by the root window QML (for layering purposes) 3. Change the default panel setting to include partial-transparency
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp12
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp22
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp52
4 files changed, 59 insertions, 31 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
index 9bb78dd0..e2cac852 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
@@ -242,6 +242,10 @@ bool NativeWindowObject::isSticky(){
return (this->property(NativeWindowObject::Workspace).toInt()<0 || this->property(NativeWindowObject::States).value<QList<NativeWindowObject::State> >().contains(NativeWindowObject::S_STICKY) );
}
+bool NativeWindowObject::isVisible(){
+ return (this->property(NativeWindowObject::Visible).toBool() );
+}
+
int NativeWindowObject::workspace(){
return this->property(NativeWindowObject::Workspace).toInt();
}
@@ -262,14 +266,13 @@ void NativeWindowObject::updateGeometry(int x, int y, int width, int height, boo
if(fgeom.isEmpty()){ fgeom << 0<<0<<0<<0; } //just in case (left/right/top/bottom)
QPoint pos(x+fgeom[0], y+fgeom[2]);
QSize sz(width-fgeom[0]-fgeom[1], height-fgeom[2]-fgeom[3]);
+ newgeom = QRect(pos, sz);
if(!now){
- newgeom = QRect(pos, sz);
//qDebug() << "Update Geometry:" << fgeom << QRect(x,y,width,height) << pos << sz;
//requestProperties(QList<NativeWindowObject::Property>() << NativeWindowObject::GlobalPos << NativeWindowObject::Size, QList<QVariant>() << pos << sz);
if(!geomTimer->isActive()){ geomTimer->start(); }
}else{
- requestProperties(QList<NativeWindowObject::Property>() << NativeWindowObject::GlobalPos << NativeWindowObject::Size , QList<QVariant>() << pos << sz );
- setProperties(QList<NativeWindowObject::Property>() << NativeWindowObject::GlobalPos << NativeWindowObject::Size , QList<QVariant>() << pos << sz );
+ sendNewGeom();
}
}
@@ -311,6 +314,8 @@ void NativeWindowObject::emitSinglePropChanged(NativeWindowObject::Property prop
emit winImageChanged(); break;
case NativeWindowObject::WinTypes:
emit winTypeChanged(); break;
+ case NativeWindowObject::Visible:
+ emit visibilityChanged(); break;
default:
break; //do nothing otherwise
}
@@ -321,4 +326,5 @@ void NativeWindowObject::sendNewGeom(){
QList<QVariant> vals; vals << newgeom.topLeft() << newgeom.size();
requestProperties(props, vals);
setProperties(props,vals);
+ emit VerifyNewGeometry(winid);
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
index 6a63813e..87df1f10 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
@@ -23,6 +23,7 @@ class NativeWindowObject : public QObject{
Q_PROPERTY( QString shortTitle READ shortTitle NOTIFY shortTitleChanged)
Q_PROPERTY( QString icon READ icon NOTIFY iconChanged)
Q_PROPERTY( bool sticky READ isSticky NOTIFY stickyChanged)
+ Q_PROPERTY(bool isVisible READ isVisible NOTIFY visibilityChanged)
//Button/Titlebar visibility
Q_PROPERTY( bool showCloseButton READ showCloseButton NOTIFY winTypeChanged)
Q_PROPERTY( bool showMinButton READ showMinButton NOTIFY winTypeChanged)
@@ -109,6 +110,7 @@ public:
Q_INVOKABLE bool showWindowFrame();
//QML Window States
Q_INVOKABLE bool isSticky();
+ Q_INVOKABLE bool isVisible();
Q_INVOKABLE int workspace();
//QML Geometry reporting
@@ -150,6 +152,7 @@ signals:
void RequestKill(WId); //Kill the window/app (usually from being unresponsive)
void RequestPing(WId); //Verify that the window is still active (such as not closing after a request
void RequestReparent(WId, WId, QPoint); //client window, frame window, relative origin point in frame
+ void VerifyNewGeometry(WId);
// System Tray Icon Embed/Unembed Requests
//void RequestEmbed(WId, QWidget*);
//void RequestUnEmbed(WId, QWidget*);
@@ -163,6 +166,7 @@ signals:
void stickyChanged();
void winTypeChanged();
void geomChanged();
+ void visibilityChanged();
};
// Declare the enumerations as Qt MetaTypes
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
index 9054f528..a0f58e71 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
@@ -47,14 +47,15 @@ void PanelObject::setGeometry( QRect newgeom ){
void PanelObject::syncWithSettings(QRect parent_geom){
//Read off all the settings
- //qDebug() << "Sync Panel Settings:" << panel_id << parent_geom;
- QString anchor = DesktopSettings::instance()->value(DesktopSettings::Panels, panel_id+"/anchor", "bottom").toString().toLower();
- QString align = DesktopSettings::instance()->value(DesktopSettings::Panels, panel_id+"/align", "center").toString().toLower();
- double length = DesktopSettings::instance()->value(DesktopSettings::Panels, panel_id+"/length_percent", 100).toDouble()/100.0;
- double width = DesktopSettings::instance()->value(DesktopSettings::Panels, panel_id+"/width_font_percent", 2.1).toDouble();
+ QString id = panel_id.section("/",-1); //last section (allow for prefixes to distinguish multiple monitors with the same profile but different screens)
+ //qDebug() << "Sync Panel Settings:" << panel_id << id << parent_geom;
+ QString anchor = DesktopSettings::instance()->value(DesktopSettings::Panels, id+"/anchor", "bottom").toString().toLower();
+ QString align = DesktopSettings::instance()->value(DesktopSettings::Panels, id+"/align", "center").toString().toLower();
+ double length = DesktopSettings::instance()->value(DesktopSettings::Panels, id+"/length_percent", 100).toDouble()/100.0;
+ double width = DesktopSettings::instance()->value(DesktopSettings::Panels, id+"/width_font_percent", 2.1).toDouble();
width = qRound(width * QApplication::fontMetrics().height() );
- this->setBackground( DesktopSettings::instance()->value(DesktopSettings::Panels, panel_id+"/background", "rgba(0,0,0,120)").toString() );
- // qDebug() << "Update Panel:" << panel_id << anchor+"/"+align << length << width;
+ this->setBackground( DesktopSettings::instance()->value(DesktopSettings::Panels, id+"/background", "rgba(0,0,0,120)").toString() );
+ // qDebug() << "Update Panel:" << panel_id << id << anchor+"/"+align << length << width;
//Now calculate the geometry of the panel
QRect newgeom;
//Figure out the size of the panel
@@ -79,6 +80,9 @@ void PanelObject::syncWithSettings(QRect parent_geom){
else if(anchor=="right"){ newgeom.moveTopRight(QPoint(parent_geom.width(), (parent_geom.height()-newgeom.height())/2 )); }
else{ newgeom.moveBottomLeft(QPoint( (parent_geom.width()-newgeom.width())/2, parent_geom.height()) ); }
}
- //qDebug() << " - Calculated Geometry:" << newgeom;
- this->setGeometry(newgeom); //Note: This is in parent-relative coordinates (not global)
+ //qDebug() << " - Calculated Geometry (relative to parent):" << newgeom;
+ //Note: newgeom is currently in parent-relative coordinates (not global)
+ newgeom.translate(parent_geom.x(), parent_geom.y());
+ //qDebug() << " - Calculated Geometry (global):" << newgeom;
+ this->setGeometry(newgeom); //shift to global coordinates
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
index 07d4e463..a565ef25 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
@@ -95,31 +95,45 @@ void RootDesktopObject::setPanels(QStringList ids){
this->emit changePanels(ids);
return;
}
-
+ //qDebug() << "GOT PANEL CHANGE:" << ids;
//Get the current bounding rectangle for the session
QRect total;
- for(int i=0; i<s_objects.length(); i++){
- total = total.united(s_objects[i]->geometry());
- }
- //First update/remove any current panel objects
bool change = false;
- for(int i=0; i<panel_objects.length(); i++){
- if(ids.contains(panel_objects[i]->name()) ){
- ids.removeAll(panel_objects[i]->name()); //already handled
- panel_objects[i]->syncWithSettings(total);
+ for(int i=0; i<=s_objects.length(); i++){
+ QRect geom;
+ QString prefix;
+ if(i==s_objects.length()){
+ geom = total; //session geometry
+ prefix="session/";
}else{
- panel_objects.takeAt(i)->deleteLater();
- i--;
+ geom = s_objects[i]->geometry();
+ total = total.united(geom);
+ prefix=s_objects[i]->name()+"/";
+ }
+ QStringList newids = ids.filter(prefix);
+ //qDebug() << " Check Panel IDs:" << prefix << newids << ids;
+ //First update/remove any current panel objects
+ for(int i=0; i<panel_objects.length(); i++){
+ if(newids.contains(panel_objects[i]->name()) ){
+ //qDebug() << " - Update Existing Panel:" << panel_objects[i]->name();
+ newids.removeAll(panel_objects[i]->name()); //already handled
+ panel_objects[i]->syncWithSettings(geom);
+ }else if(panel_objects[i]->name().startsWith(prefix) ){
+ //qDebug() << " - Remove Existing Panel:" << panel_objects[i]->name();
+ panel_objects.takeAt(i)->deleteLater();
+ i--;
+ change = true; //list changed
+ }
+ }
+ //Now create any new panel objects as needed
+ for(int i=0; i<newids.length(); i++){
+ //qDebug() << " - Create Panel:" << newids[i];
+ PanelObject *tmp = new PanelObject(newids[i], this);
+ tmp->syncWithSettings(geom);
+ panel_objects << tmp;
change = true; //list changed
}
- }
- //Now create any new panel objects as needed
- for(int i=0; i<ids.length(); i++){
- PanelObject *tmp = new PanelObject(ids[i], this);
- tmp->syncWithSettings(total);
- panel_objects << tmp;
- change = true; //list changed
- }
+ } //end loop over screens+session
if(change){ emit panelsChanged(); }
}
bgstack15