diff options
Diffstat (limited to 'src-qt5/core')
8 files changed, 84 insertions, 41 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/panels.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/panels.conf index 07cf4635..f0cdc5a4 100644 --- a/src-qt5/core/lumina-desktop-unified/defaults/desktop/panels.conf +++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/panels.conf @@ -4,8 +4,9 @@ windows/anchor="bottom" windows/align="center" windows/length_percent=100 +windows/width_percent=3 windows/plugins="" -windows/background="rgba(0,0,0,120)" +windows/background="#1A000000" [default] active_ids="initial" @@ -18,4 +19,4 @@ align="center" length_percent=100 width_percent=2.1 plugins="" -background="rgba(0,0,0,120)" +background="#33000000" diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp index bfded781..ad2bc445 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp @@ -153,19 +153,32 @@ void DesktopManager::updateDesktopSettings(){ void DesktopManager::updatePanelSettings(){ QList<QScreen*> scrns = QGuiApplication::screens(); int primary = QApplication::desktop()->primaryScreen(); + qDebug() << "Panel Settings Changed:" << primary << scrns.length(); + QStringList total_ids; for(int i=0; i<scrns.length(); i++){ + //qDebug() << " - Check Screen Name:" << scrns[i]->name(); ScreenObject *sObj = RootDesktopObject::instance()->screen(scrns[i]->name()); if(sObj == 0){ continue; } //screen is not managed directly - skip it QStringList ids = DesktopSettings::instance()->value(DesktopSettings::Panels, scrns[i]->name().replace("-","_")+"/active_ids", QStringList()).toStringList(); if(ids.isEmpty() && (scrns.length()==1 || i==primary)){ + //qDebug() << " -- PRIMARY"; //Also look for the "default" panel id's for the primary/default screen ids = DesktopSettings::instance()->value(DesktopSettings::Panels, "default/active_ids", QStringList()).toStringList(); } - sObj->setPanels(ids); + ids.removeAll(""); + //qDebug() << " -- settings:" << ids; + for(int j=0; j<ids.length(); j++){ + total_ids << scrns[i]->name()+"/"+ids[j]; + } } //Now do the global-session panels QStringList ids = DesktopSettings::instance()->value(DesktopSettings::Panels, "session/active_ids", QStringList()).toStringList(); - RootDesktopObject::instance()->setPanels(ids); //put the new ones in place + ids.removeAll(""); + for(int i=0; i<ids.length(); i++){ + total_ids << "session/"+ids[i]; + } + //qDebug() << "Panel Settings Changed:" << total_ids; + RootDesktopObject::instance()->setPanels(total_ids); //put the new ones in place } void DesktopManager::updatePluginSettings(){ 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(); } } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/NativeWindow.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/NativeWindow.qml index 2150e37c..19ff4da9 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/NativeWindow.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/NativeWindow.qml @@ -14,10 +14,11 @@ Rectangle { SystemPalette { id:palette } id: windowFrame + visible: object.isVisible border.width: 5 border.color: palette.highlight radius: 5 - color: "transparent" //palette.window + color: palette.window x: object.frameGeometry.x y: object.frameGeometry.y width: object.frameGeometry.width diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp index 063c1337..a3bac808 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp @@ -788,8 +788,6 @@ void NativeWindowSystem::NewWindowDetected(WId id){ win->setProperty(NativeWindowObject::FrameExtents, QVariant::fromValue<QList<int> >( QList<int>() << 5 << 5 << 30 << 5 )); } qDebug() << "New Window [& associated ID's]:" << win->id() << win->property(NativeWindowObject::Name).toString(); - SetupNewWindow(win); - CheckWindowPosition(id, true); //first time placement //Now setup the connections with this window connect(win, SIGNAL(RequestClose(WId)), this, SLOT(RequestClose(WId)) ); connect(win, SIGNAL(RequestKill(WId)), this, SLOT(RequestKill(WId)) ); @@ -797,6 +795,8 @@ void NativeWindowSystem::NewWindowDetected(WId id){ connect(win, SIGNAL(RequestReparent(WId, WId, QPoint)), this, SLOT(RequestReparent(WId, WId, QPoint)) ); connect(win, SIGNAL(RequestPropertiesChange(WId, QList<NativeWindowObject::Property>, QList<QVariant>)), this, SLOT(RequestPropertiesChange(WId, QList<NativeWindowObject::Property>, QList<QVariant>)) ); connect(win, SIGNAL(VerifyNewGeometry(WId)), this, SLOT(CheckWindowPosition(WId)) ); + SetupNewWindow(win); + CheckWindowPosition(id, true); //first time placement xcb_map_window(QX11Info::connection(), win->id()); emit NewWindowAvailable(win); } @@ -831,22 +831,22 @@ void NativeWindowSystem::NewTrayWindowDetected(WId id){ void NativeWindowSystem::WindowCloseDetected(WId id){ NativeWindowObject *win = findWindow(id, false); + if(win==0){ win = findWindow(id, true); } //qDebug() << "Got Window Closed" << id << win; //qDebug() << "Old Window List:" << NWindows.length(); if(win!=0){ NWindows.removeAll(win); - //RequestReparent(id, QX11Info::appRootWindow(), QPoint(0,0)); win->emit WindowClosed(id); //qDebug() << "Visible Window Closed!!!"; - //win->deleteLater(); emit WindowClosed(); + win->deleteLater(); }else{ win = findTrayWindow(id); if(win!=0){ TWindows.removeAll(win); win->emit WindowClosed(id); - win->deleteLater(); emit TrayWindowClosed(); + win->deleteLater(); } } //qDebug() << " - Now:" << NWindows.length(); |