aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaX11.cpp2
-rw-r--r--libLumina/LuminaX11.h21
-rw-r--r--lumina-desktop/BootSplash.cpp8
-rw-r--r--lumina-desktop/LSession.cpp29
-rw-r--r--lumina-desktop/LSession.h3
-rw-r--r--lumina-desktop/lumina-desktop.pro2
-rw-r--r--lumina-desktop/panel-plugins/systemtray/LSysTray.cpp14
-rw-r--r--lumina-desktop/panel-plugins/systemtray/LSysTray.h17
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp28
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.h6
-rw-r--r--lumina-open/main.cpp18
11 files changed, 79 insertions, 69 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index f5aab49f..11c0f0ef 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -842,7 +842,7 @@ void LXCB::ReserveLocation(WId win, QRect geom, QString loc){
uint LXCB::EmbedWindow(WId win, WId container){
if(DEBUG){ qDebug() << "XCB: EmbedWindow()"; }
//This returns the damage control ID number (or 0 for a failure)
- if(win==0 || container==0){ return 0; }
+ if(win==0 || container==0 || LXCB::WindowClass(win).isEmpty() ){ return 0; } //invalid window (destroyed before getting here?)
//qDebug() << "Embed Window:" << win << container;
//Initialize any atoms that will be needed
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index b6431fc6..201b8576 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -21,19 +21,13 @@
#include <QDebug>
#include <QPainter>
#include <QObject>
+#include <QFlags>
// Addition includes for compilations (cause issues with X11 libs later)
-#include <QDir>
-#include <QEvent>
-#include <QHeaderView>
+//#include <QDir>
+//#include <QEvent>
+//#include <QHeaderView>
-
-//X includes (these need to be last due to Qt compile issues)
-//#include <X11/Xlib.h>
-//#include <X11/Xutil.h>
-//#include <X11/Xatom.h>
-//#include <X11/extensions/Xrender.h>
-
#include <xcb/xcb_ewmh.h>
//SYSTEM TRAY STANDARD DEFINITIONS
@@ -51,8 +45,11 @@ class LXCB{
public:
enum WINDOWSTATE {IGNORE, INVISIBLE, VISIBLE, ACTIVE, ATTENTION}; //note that this in order of priority
enum ICCCM_STATE {WITHDRAWN, NORMAL, ICONIC};
- enum ICCCM_PROTOCOLS {TAKE_FOCUS, DELETE_WINDOW};
-
+ //Now enums which can have multiple values at once
+ enum ICCCM_PROTOCOL {TAKE_FOCUS = 0x0, DELETE_WINDOW = 0x1}; //any combination
+ Q_DECLARE_FLAGS(ICCCM_PROTOCOLS, ICCCM_PROTOCOL);
+
+
xcb_ewmh_connection_t EWMH; //This is where all the screen info and atoms are located
LXCB();
diff --git a/lumina-desktop/BootSplash.cpp b/lumina-desktop/BootSplash.cpp
index b535fff4..e75bca21 100644
--- a/lumina-desktop/BootSplash.cpp
+++ b/lumina-desktop/BootSplash.cpp
@@ -41,10 +41,14 @@ void BootSplash::showScreen(QString loading){ //update icon, text, and progress
}else if(loading=="final"){
txt = tr("Finalizing …"); per = 90;
icon = "pcbsd";
+ }else if(loading.startsWith("app::")){
+ txt = QString(tr("Starting App: %1")).arg(loading.section("::",1,50)); per = -1;
}
- ui->progressBar->setValue(per);
+ if(per>0){ ui->progressBar->setValue(per); }
+ else{ ui->progressBar->setRange(0,0); } //loading indicator
ui->label_text->setText(txt);
- ui->label_icon->setPixmap( LXDG::findIcon(icon, "Lumina-DE").pixmap(64,64) );
+ if(!icon.isEmpty()){ui->label_icon->setPixmap( LXDG::findIcon(icon, "Lumina-DE").pixmap(64,64) ); }
+ this->raise();
this->show();
this->update();
QApplication::processEvents();
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 61c01175..4934d42b 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -9,6 +9,7 @@
#include <QTime>
#include <QScreen>
+#include <QtConcurrent>
#include "LXcbEventFilter.h"
#include "BootSplash.h"
@@ -162,9 +163,11 @@ void LSession::setupSession(){
connect(this, SIGNAL(aboutToQuit()), this, SLOT(SessionEnding()) );
if(DEBUG){ qDebug() << " - Init Finished:" << timer->elapsed(); delete timer;}
//QTimer::singleShot(3000, this, SLOT(launchStartupApps()) ); //startup these processes in 3 seconds
- splash.close();
QApplication::processEvents();
- launchStartupApps();
+ //QtConcurrent::run(this, &LSession::launchStartupApps);
+ //launchStartupApps(&splash);
+ QTimer::singleShot(500, this, SLOT(launchStartupApps()) );
+ splash.close();
}
void LSession::CleanupSession(){
@@ -260,24 +263,20 @@ void LSession::launchStartupApps(){
LOS::setScreenBrightness( tmp );
qDebug() << " - - Screen Brightness:" << QString::number(tmp)+"%";
}
-
+ QProcess::startDetached("nice lumina-open -autostart-apps");
//Now get any XDG startup applications and launch them
- QList<XDGDesktop> xdgapps = LXDG::findAutoStartFiles();
+ /*QList<XDGDesktop> xdgapps = LXDG::findAutoStartFiles();
for(int i=0; i<xdgapps.length(); i++){
qDebug() << " - Auto-Starting File:" << xdgapps[i].filePath;
+ //splash->showScreen("app::"+xdgapps[i].name);
if(xdgapps[i].startupNotify){
- LSession::LaunchApplication("lumina-open \""+xdgapps[i].filePath+"\"");
+ LSession::LaunchApplication("nice lumina-open \""+xdgapps[i].filePath+"\"");
}else{
//Don't update the mouse cursor
- QProcess::startDetached("lumina-open \""+xdgapps[i].filePath+"\"");
- }
- //Put a tiny bit of space between app starts (don't overload the system)
- for(int j=0; j<5; j++){
- usleep(50000); //50ms = 50000 us --> 250ms total wait
- LSession::processEvents();
+ QProcess::startDetached("nice lumina-open \""+xdgapps[i].filePath+"\"");
}
-
- }
+ LSession::processEvents();
+ }*/
//Re-load the screen brightness and volume settings from the previous session
// Wait until after the XDG-autostart functions, since the audio system might be started that way
@@ -818,6 +817,10 @@ void LSession::unregisterVisualTray(WId visualTray){
QList<WId> LSession::currentTrayApps(WId visualTray){
if(visualTray==VisualTrayID){
+ //Check the validity of all the current tray apps (make sure nothing closed erratically)
+ for(int i=0; i<RunningTrayApps.length(); i++){
+ if(XCB->WindowClass(RunningTrayApps[i]).isEmpty()){ RunningTrayApps.removeAt(i); i--; }
+ }
return RunningTrayApps;
}else if( registerVisualTray(visualTray) ){
return RunningTrayApps;
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 247b7ecb..8147e411 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -28,6 +28,7 @@
#include "SystemWindow.h"
#include "LDesktop.h"
#include "WMProcess.h"
+//#include "BootSplash.h"
#include <LuminaX11.h>
@@ -130,7 +131,6 @@ private:
int VersionStringToNumber(QString version);
public slots:
- void launchStartupApps();
void StartLogout();
void StartShutdown();
void StartReboot();
@@ -138,6 +138,7 @@ public slots:
void reloadIconTheme();
private slots:
+ void launchStartupApps(); //used during initialization
void watcherChange(QString);
void screensChanged();
void screenResized(int);
diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro
index 9f791fbc..8db2662e 100644
--- a/lumina-desktop/lumina-desktop.pro
+++ b/lumina-desktop/lumina-desktop.pro
@@ -1,6 +1,6 @@
QT += core gui network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia quickwidgets
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia quickwidgets concurrent
TARGET = Lumina-DE
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
index 3be31f43..a921d314 100644
--- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
@@ -88,8 +88,9 @@ void LSysTray::checkAll(){
int index = wins.indexOf(trayIcons[i]->appID());
if(index < 0){
//Tray Icon no longer exists: remove it
- qDebug() << " - Visual System Tray: Remove Icon";
+ qDebug() << " - Visual System Tray: Remove Icon:" << trayIcons[i]->appID();
TrayIcon *cont = trayIcons.takeAt(i);
+ cont->cleanup();
LI->removeWidget(cont);
delete cont;
i--; //List size changed
@@ -108,9 +109,10 @@ void LSysTray::checkAll(){
}
//Now go through any remaining windows and add them
for(int i=0; i<wins.length() && TrayRunning; i++){
- qDebug() << " - Visual System Tray: Add Icon";
+ qDebug() << " - Visual System Tray: Add Icon:" << wins[i];
TrayIcon *cont = new TrayIcon(this);
- LSession::processEvents();
+ connect(cont, SIGNAL(BadIcon()), this, SLOT(checkAll()) );
+ //LSession::processEvents();
trayIcons << cont;
LI->addWidget(cont);
//qDebug() << " - Update tray layout";
@@ -121,12 +123,12 @@ void LSysTray::checkAll(){
cont->setSizeSquare(this->width()-2-2*frame->frameWidth()); //vertical tray
this->setMaximumSize(10000, trayIcons.length()*this->width());
}
- LSession::processEvents();
+ //LSession::processEvents();
//qDebug() << " - Attach tray app";
cont->attachApp(wins[i]);
if(cont->appID()==0){
//could not attach window - remove the widget
- //qDebug() << "Invalid Tray Container:";
+ qDebug() << " - Invalid Tray App: Could Not Embed:";
trayIcons.takeAt(trayIcons.length()-1); //Always at the end
LI->removeWidget(cont);
delete cont;
@@ -151,8 +153,6 @@ void LSysTray::UpdateTrayWindow(WId win){
if(trayIcons[i]->appID()==win){
//qDebug() << "System Tray: Update Window " << win;
trayIcons[i]->repaint(); //don't use update() because we need an instant repaint (not a cached version)
- //QTimer::singleShot(10, trayIcons[i], SLOT(repaint()) ); //re-paint in 10ms (give it a moment to settle)
- //QTimer::singleShot(1000, trayIcons[i], SLOT(update()) );
return; //finished now
}
}
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/lumina-desktop/panel-plugins/systemtray/LSysTray.h
index e189b729..84cde5c9 100644
--- a/lumina-desktop/panel-plugins/systemtray/LSysTray.h
+++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.h
@@ -38,22 +38,14 @@ private:
QList<TrayIcon*> trayIcons;
QFrame *frame;
QBoxLayout *LI; //layout items
- //WId TrayID;
QTimer *upTimer; //manual timer to force refresh of all items
private slots:
- //void checkXEvent(XEvent *event);
- //void closeAll();
void checkAll();
void UpdateTrayWindow(WId win);
- //void initialTrayIconDetect(); //initial scan for previously running tray apps
- //void addTrayIcon(WId win);
//void removeTrayIcon(WId win);
- /*void updateStatus();
- void trayAppClosed();*/
-
public slots:
void start();
void stop();
@@ -76,15 +68,6 @@ public slots:
}
}
-protected:
- /*void paintEvent(QPaintEvent *event){
- //Also repaint all the tray icons
- for(int i=0; i<trayIcons.length(); i++){
- trayIcons[i]->update();
- }
- //Now pass the event on to the normal routine
- LPPlugin::paintEvent(event);
- }*/
};
#endif
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
index 1b843e3e..9fdbce50 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
@@ -14,6 +14,7 @@ TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){
AID = 0; //nothing yet
IID = 0;
dmgID = 0;
+ badpaints = 0;
//this->setLayout(new QHBoxLayout);
//this->layout()->setContentsMargins(0,0,0,0);
}
@@ -21,6 +22,10 @@ TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){
TrayIcon::~TrayIcon(){
}
+void TrayIcon::cleanup(){
+ AID = IID = 0;
+}
+
WId TrayIcon::appID(){
return AID;
}
@@ -94,26 +99,21 @@ void TrayIcon::paintEvent(QPaintEvent *event){
//qDebug() << " - - " << event->rect().x() << event->rect().y() << event->rect().width() << event->rect().height();
//qDebug() << " - Get image:" << AID;
QPixmap pix = LSession::handle()->XCB->TrayImage(AID); //= WIN->icon().pixmap(this->size());
- //if(pix.isNull()){
- //qDebug() << "Null Image - use Qt grab Window";
- //Try to grab the window directly with Qt instead
- /*QList<QScreen*> scrnlist = QApplication::screens();
- for(int i=0; i<scrnlist.length(); i++){
- pix = scrnlist[i]->grabWindow(AID);
- break; //stop here
- }
- //}
- if(pix.isNull()){
- qDebug() << "Null Qt Pixmap - Use XCB grab image:";
- pix = LSession::handle()->XCB->TrayImage(AID);
- }*/
+
//qDebug() << " - Pix size:" << pix.size().width() << pix.size().height();
//qDebug() << " - Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height();
if(!pix.isNull()){
if(this->size() != pix.size()){ QTimer::singleShot(10, this, SLOT(updateIcon())); }
painter.drawPixmap(0,0,this->width(), this->height(), pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
+ badpaints = 0; //good paint
}else{
- qWarning() << " - - No Tray Icon/Image found!" << "ID:" << AID;
+ badpaints++;
+ if(badpaints>5){
+ qWarning() << " - - No Tray Icon/Image found!" << "ID:" << AID;
+ AID = 0; //reset back to nothing
+ IID = 0;
+ emit BadIcon(); //removed/destroyed in some non-valid way?
+ }
}
//qDebug() << " - Done";
}
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
index fef3b578..5d072cc1 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
@@ -30,6 +30,8 @@ public:
TrayIcon(QWidget* parent = 0);
~TrayIcon();
+ void cleanup(); //about to be removed after window was detroyed
+
WId appID(); //the ID for the attached application
void attachApp(WId id);
void setSizeSquare(int side);
@@ -40,12 +42,14 @@ public slots:
private:
WId IID, AID; //icon ID and app ID
- //QWindow *WIN;
+ int badpaints;
uint dmgID;
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
+signals:
+ void BadIcon();
};
#endif \ No newline at end of file
diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp
index 2b44b14a..8f98e342 100644
--- a/lumina-open/main.cpp
+++ b/lumina-open/main.cpp
@@ -38,6 +38,7 @@ void printUsageInfo(){
qDebug() << "Special Flags:";
qDebug() << " \"-volume[up/down]\" Flag to increase/decrease audio volume by 5%";
qDebug() << " \"-brightness[up/down]\" Flag to increase/decrease screen brightness by 5%";
+ qDebug() << " \"-autostart-apps\" Flag to launch all the various apps which are registered with XDG autostart specification";
exit(1);
}
@@ -77,6 +78,20 @@ void showOSD(int argc, char **argv, QString message){
splash.hide();
}
+void LaunchAutoStart(){
+ QList<XDGDesktop> xdgapps = LXDG::findAutoStartFiles();
+ for(int i=0; i<xdgapps.length(); i++){
+ //Generate command and clean up any stray "Exec" field codes (should not be any here)
+ QString cmd = LXDG::getDesktopExec(xdgapps[i]);
+ if(cmd.contains("%")){cmd = cmd.remove("%U").remove("%u").remove("%F").remove("%f").remove("%i").remove("%c").remove("%k").simplified(); }
+ //Now run the command
+ if(!cmd.isEmpty()){
+ qDebug() << " - Auto-Starting File:" << xdgapps[i].filePath;
+ QProcess::startDetached(cmd);
+ }
+ }
+}
+
QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QString& path, bool showDLG=false){
//First check to see if there is a default for this extension
QString defApp;
@@ -160,6 +175,9 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat
//Test the crash handler
binary = "internalcrashtest"; watch=true;
return;
+ }else if(QString(argv[i]).simplified() == "-autostart-apps"){
+ LaunchAutoStart();
+ return;
}else if(QString(argv[i]).simplified() == "-volumeup"){
int vol = LOS::audioVolume()+5; //increase 5%
if(vol>100){ vol=100; }
bgstack15