aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-02-25 09:04:25 -0500
committerKen Moore <ken@pcbsd.org>2015-02-25 09:04:25 -0500
commit5b13c16cdd7012f4e221d4d17370516b721d4983 (patch)
tree10ce3b000d238f82fd479c7443faa8dc849d71c2
parentSubclass the main QFileSystemModel to provide drag and drop support. This sti... (diff)
downloadlumina-5b13c16cdd7012f4e221d4d17370516b721d4983.tar.gz
lumina-5b13c16cdd7012f4e221d4d17370516b721d4983.tar.bz2
lumina-5b13c16cdd7012f4e221d4d17370516b721d4983.zip
Add lumina-xconfig shortcuts into the desktop interface (userbutton, settings menu).
Clean up/add some desktop/panel "prepareToClose()" routines, and have them run when appropriate. Also add these close routines to the general session cleanup. Add support for a new "--noclean" CLI flag when starting LuminaDE. This flag will tell the session not to close system tray utilities and other applications on session close.
-rw-r--r--lumina-desktop/LDesktop.cpp15
-rw-r--r--lumina-desktop/LDesktop.h5
-rw-r--r--lumina-desktop/LPanel.cpp13
-rw-r--r--lumina-desktop/LPanel.h2
-rw-r--r--lumina-desktop/LSession.cpp67
-rw-r--r--lumina-desktop/LSession.h1
-rw-r--r--lumina-desktop/SettingsMenu.cpp3
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp2
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h3
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.ui22
10 files changed, 104 insertions, 29 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 31baa48d..9a045e4f 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -13,12 +13,12 @@
#define DEBUG 1
-LDesktop::LDesktop(int deskNum) : QObject(){
+LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){
DPREFIX = "desktop-"+QString::number(deskNum)+"/";
desktopnumber = deskNum;
desktop = QApplication::desktop();
- defaultdesktop = (desktop->screenGeometry(desktopnumber).x()==0);
+ defaultdesktop = setdefault; //(desktop->screenGeometry(desktopnumber).x()==0);
desktoplocked = true;
issyncing = bgupdating = false;
usewinmenu=false;
@@ -52,10 +52,18 @@ void LDesktop::show(){
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->show(); }
}
-void LDesktop::hide(){
+/*void LDesktop::hide(){
if(bgWindow!=0){ bgWindow->hide(); }
if(bgDesktop!=0){ bgDesktop->hide(); }
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); }
+}*/
+
+void LDesktop::prepareToClose(){
+ //Get any panels ready to close
+ for(int i=0; i<PANELS.length(); i++){ PANELS[i]->prepareToClose(); delete PANELS.takeAt(i); i--; }
+ //Now close down any desktop plugins
+ desktoplocked = true; //make sure that plugin settings are preserved during removal
+ for(int i=0; i<PLUGINS.length(); i++){delete PLUGINS.takeAt(i); i--; }
}
WId LDesktop::backgroundID(){
@@ -390,6 +398,7 @@ void LDesktop::UpdatePanels(){
for(int i=0; i<PANELS.length(); i++){
if(panels <= PANELS[i]->number()){
if(DEBUG){ qDebug() << " -- Remove Panel:" << PANELS[i]->number(); }
+ PANELS[i]->prepareToClose();
delete PANELS.takeAt(i);
i--;
}
diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h
index ef91110a..456c61e9 100644
--- a/lumina-desktop/LDesktop.h
+++ b/lumina-desktop/LDesktop.h
@@ -34,12 +34,13 @@
class LDesktop : public QObject{
Q_OBJECT
public:
- LDesktop(int deskNum=0);
+ LDesktop(int deskNum=0, bool setdefault = false);
~LDesktop();
int Screen(); //return the screen number this object is managing
void show();
- void hide();
+ //void hide();
+ void prepareToClose();
WId backgroundID();
QRect availableScreenGeom();
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index 51c994a5..f979ea15 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -64,6 +64,19 @@ LPanel::~LPanel(){
}
+void LPanel::prepareToClose(){
+ //Go through and remove all the plugins
+ for(int i=0; i<PLUGINS.length(); i++){
+ if( PLUGINS[i]->type().startsWith("systemtray---") ){
+ static_cast<LSysTray*>(PLUGINS[i])->stop();
+ }
+ layout->takeAt(i); //remove from the layout
+ delete PLUGINS.takeAt(i); //delete the actual widget
+ LSession::processEvents();
+ i--; //need to back up one space to not miss another plugin
+ }
+}
+
//===========
// PUBLIC SLOTS
//===========
diff --git a/lumina-desktop/LPanel.h b/lumina-desktop/LPanel.h
index b7b89d71..ed1a8906 100644
--- a/lumina-desktop/LPanel.h
+++ b/lumina-desktop/LPanel.h
@@ -49,6 +49,8 @@ public:
return panelnum;
}
+ void prepareToClose();
+
public slots:
void UpdatePanel(); //Load the settings file and update the panel appropriately
void UpdateLocale(); //Locale Changed externally
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 4b0a04e7..811c60da 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -24,7 +24,7 @@
#include <X11/extensions/Xdamage.h>
#ifndef DEBUG
-#define DEBUG 0
+#define DEBUG 1
#endif
XCBEventFilter *evFilter = 0;
@@ -43,6 +43,10 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){
SystemTrayID = 0; VisualTrayID = 0;
TrayDmgEvent = 0;
TrayDmgError = 0;
+ cleansession = true;
+ for(int i=1; i<argc; i++){
+ if( QString::fromLocal8Bit(argv[i]) == "--noclean" ){ cleansession = false; break; }
+ }
XCB = new LXCB(); //need access to XCB data/functions right away
//initialize the empty internal pointers to 0
appmenu = 0;
@@ -133,28 +137,36 @@ void LSession::CleanupSession(){
if( sessionsettings->value("PlayLogoutAudio",true).toBool() ){
playAudioFile(LOS::LuminaShare()+"Logout.ogg");
}
- //Close any Tray Apps
- for(int i=0; i<RunningTrayApps.length(); i++){
- XCB->CloseWindow(RunningTrayApps[i]);
- LSession::processEvents();
- }
- //Close any open windows
- QList<WId> WL = XCB->WindowList(true);
- for(int i=0; i<WL.length(); i++){
- XCB->CloseWindow(WL[i]);
- LSession::processEvents();
- }
-
- //Now wait a moment for things to close down before quitting
- for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause
- //Kill any remaining windows
- WL = XCB->WindowList(true); //all workspaces
- for(int i=0; i<WL.length(); i++){
- LX11::KillWindow(WL[i]);
- LSession::processEvents();
+ if(cleansession){
+ //Close any Tray Apps
+ for(int i=0; i<RunningTrayApps.length(); i++){
+ XCB->CloseWindow(RunningTrayApps[i]);
+ LSession::processEvents();
+ }
+ //Close any open windows
+ QList<WId> WL = XCB->WindowList(true);
+ for(int i=0; i<WL.length(); i++){
+ XCB->CloseWindow(WL[i]);
+ LSession::processEvents();
+ }
+ //Now wait a moment for things to close down before quitting
+ for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause
+ //Kill any remaining windows
+ WL = XCB->WindowList(true); //all workspaces
+ for(int i=0; i<WL.length(); i++){
+ LX11::KillWindow(WL[i]);
+ LSession::processEvents();
+ }
+ }
+ //Stop the window manager
+ WM->stopWM();
+ //Now close down the desktop
+ for(int i=0; i<DESKTOPS.length(); i++){
+ DESKTOPS[i]->prepareToClose();
+ //don't actually close them yet - that will happen when the session exits
+ // this will leave the wallpapers up for a few moments (preventing black screens)
}
-
//Now wait a moment for things to close down before quitting
for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause
}
@@ -295,7 +307,11 @@ void LSession::updateDesktops(){
if(!found){
//Start the desktop on the new screen
qDebug() << " - Start desktop on screen:" << i;
- DESKTOPS << new LDesktop(i);
+ if(firstrun && DW->screenGeometry(i).x()==0){
+ DESKTOPS << new LDesktop(i,true); //set this one as the default
+ }else{
+ DESKTOPS << new LDesktop(i);
+ }
}
}
//qDebug() << " - Done Starting Desktops";
@@ -305,8 +321,10 @@ void LSession::updateDesktops(){
//Now go through and make sure to delete any desktops for detached screens
for(int i=0; i<DESKTOPS.length(); i++){
if(DESKTOPS[i]->Screen() >= DW->screenCount()){
- qDebug() << " - Hide desktop on screen:" << DESKTOPS[i]->Screen();
- DESKTOPS[i]->hide();
+ qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen();
+ DESKTOPS[i]->prepareToClose(); //hide();
+ delete DESKTOPS.takeAt(i);
+ i--;
}else{
qDebug() << " - Show desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->show();
@@ -341,6 +359,7 @@ void LSession::adjustWindowGeom(WId win, bool maximize){
}
//Adjust the window location if necessary
if(maximize){
+ if(DEBUG){ qDebug() << "Maximizing New Window:" << desk.width() << desk.height(); }
geom = desk; //Use the full screen
XCB->MoveResizeWindow(win, geom);
XCB->MaximizeWindow(win, true); //directly set the appropriate "maximized" flags (bypassing WM)
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 6ad4ac90..fdd47eb6 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -99,6 +99,7 @@ private:
QMediaPlayer *mediaObj;
QThread *audioThread;
QSettings *sessionsettings;
+ bool cleansession;
//System Tray Variables
WId SystemTrayID, VisualTrayID;
diff --git a/lumina-desktop/SettingsMenu.cpp b/lumina-desktop/SettingsMenu.cpp
index 8c989600..95e6e44f 100644
--- a/lumina-desktop/SettingsMenu.cpp
+++ b/lumina-desktop/SettingsMenu.cpp
@@ -28,6 +28,9 @@ void SettingsMenu::InitMenu(){
act = new QAction( LXDG::findIcon("preferences-desktop",""), tr("Desktop"), this);
act->setWhatsThis("lumina-config");
this->addAction(act);
+ act = new QAction( LXDG::findIcon("preferences-other",""), tr("Screen Configuration"), this);
+ act->setWhatsThis("lumina-xconfig");
+ this->addAction(act);
QString qtconfig = LOS::QtConfigShortcut();
if(QFile::exists(qtconfig) && !qtconfig.isEmpty()){
act = new QAction( LXDG::findIcon("preferences-desktop-theme",""), tr("Window Theme"), this);
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index d5f8cd2e..6ca3ba19 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -32,12 +32,14 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") );
ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") );
ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") );
+ ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") );
ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") );
ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") );
ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") );
//Connect the signals/slots
connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) );
connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) );
+ connect(ui->tool_config_screensettings, SIGNAL(clicked()), this, SLOT(openScreenConfig()) );
connect(ui->tool_fav_apps, SIGNAL(clicked()), this, SLOT(FavChanged()) );
connect(ui->tool_fav_files, SIGNAL(clicked()), this, SLOT(FavChanged()) );
connect(ui->tool_fav_dirs, SIGNAL(clicked()), this, SLOT(FavChanged()) );
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
index 108f540f..c7af2a4d 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
@@ -80,6 +80,9 @@ private slots:
void openScreenSaverConfig(){
LaunchItem(SSAVER, false);
}
+ void openScreenConfig(){
+ LaunchItem("lumina-xconfig",false);
+ }
void openLuminaInfo(){
LaunchItem("lumina-info",false);
}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
index 9a307cb6..f00daf08 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
@@ -481,6 +481,28 @@
</widget>
</item>
<item>
+ <widget class="QToolButton" name="tool_config_screensettings">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Screen Configuration</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QToolButton" name="tool_qtconfig">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
bgstack15