aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/DesktopSettings.cpp255
-rw-r--r--src-qt5/core/libLumina/DesktopSettings.h65
-rw-r--r--src-qt5/core/libLumina/DesktopSettings.pri7
-rw-r--r--src-qt5/core/libLumina/ExternalProcess.h3
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp8
-rw-r--r--src-qt5/core/lumina-desktop-unified/global-includes.h14
-rw-r--r--src-qt5/core/lumina-desktop-unified/global-objects.h12
-rw-r--r--src-qt5/core/lumina-desktop-unified/lumina-desktop.pro6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp43
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h5
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/events.pri6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/SampleAnimation.h2
16 files changed, 386 insertions, 52 deletions
diff --git a/src-qt5/core/libLumina/DesktopSettings.cpp b/src-qt5/core/libLumina/DesktopSettings.cpp
new file mode 100644
index 00000000..bfd149ca
--- /dev/null
+++ b/src-qt5/core/libLumina/DesktopSettings.cpp
@@ -0,0 +1,255 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "DesktopSettings.h"
+#include <QFile>
+#include <QDir>
+#include <QDebug>
+
+#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
+
+#define FILEPREFIX QString("/lumina-desktop/desktop/")
+
+// === PUBLIC ===
+DesktopSettings::DesktopSettings(QObject *parent) : QObject(parent){
+ watcher = 0;
+ runmode = DesktopSettings::UserFull;
+}
+
+DesktopSettings::~DesktopSettings(){
+ if(!files.isEmpty()){ stop(); }
+}
+
+//Start/stop routines
+void DesktopSettings::start(){
+ files.clear(); settings.clear(); //clear the internal hashes (just in case)
+ if(watcher==0){
+ watcher = new QFileSystemWatcher(this);
+ connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)) );
+ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)) );
+ }
+ parseSystemSettings(); //set the runmode appropriately
+ locateFiles(); //
+
+}
+
+void DesktopSettings::stop(){
+ QStringList watch; watch << watcher->files() << watcher->directories();
+ if(!watch.isEmpty()){ watcher->removePaths(watch); }
+ files.clear(); //clear the internal hash
+ settings.clear();
+}
+
+//Main Read/Write functions
+QVariant DesktopSettings::value(DesktopSettings::File file, QString variable, QVariant defaultvalue){
+ if(!files.contains(file)){ return defaultvalue; }
+ for(int i=0; i<files[file].length(); i++){
+ if( settings.contains(files[file][i])){ //make sure this file is in the settings hash
+ if(settings[files[file][i]]->contains(variable)){ //if this file does not have the variable - go to the next one
+ return settings[files[file][i]]->value(variable, defaultvalue);
+ }
+ }
+ }
+ return defaultvalue; //none of the files contain the variable - return the default
+}
+
+bool DesktopSettings::setValue(DesktopSettings::File file, QString variable, QVariant value){
+ if(!files.contains(file)){ return false; }
+ for(int i=0; i<files[file].length(); i++){
+ if( settings.contains(files[file][i])){ //make sure this file is in the settings hash
+ if(settings[files[file][i]]->isWritable() ){ //Check write permissions
+ settings[files[file][i]]->setValue(variable, value);
+ settings[files[file][i]]->sync(); //make sure this is synced to disk ASAP
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+QStringList DesktopSettings::keys(DesktopSettings::File file){
+ if(!files.contains(file)){ return QStringList(); }
+ QStringList keyList;
+ for(int i=0; i<files[file].length(); i++){
+ if( settings.contains(files[file][i])){ //make sure this file is in the settings hash
+ keyList << settings[files[file][i]]->allKeys();
+ }
+ }
+ keyList.removeDuplicates();
+ return keyList;
+}
+
+//Information functions
+QStringList DesktopSettings::filePaths(DesktopSettings::File file){
+ if(!files.contains(file)){ return QStringList(); }
+ return files.value(file);
+}
+
+//=== PRIVATE ===
+void DesktopSettings::parseSystemSettings(){
+ //run at start - determine the RunMode for this user/session
+ //This will also load the DesktopSettings::System file into the hashes
+ runmode = DesktopSettings::UserFull; //default value unless otherwise specified
+ QStringList dirs;
+ dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":") << QString(getenv("XDG_DATA_DIRS")).split(":");
+ for(int i=0; i<dirs.length(); i++){
+ if(dirs[i].endsWith("/xdg")){ dirs[i] = dirs[i].section("/",0,-2); } //Chop off the xdg subdir - need the generic configuration directory
+ QString path = dirs[i]+rel_path(DesktopSettings::System);
+ if(!QFile::exists(path)){ continue; }
+ //Load the system file into the hashes
+ files.insert(DesktopSettings::System, QStringList() << path);
+ settings.insert(path, new QSettings(path, QSettings::IniFormat, this) );
+ //Read off the default mode for the system
+ QString defMode = settings[path]->value("default_mode","fulluser").toString().toLower();
+ if(defMode=="fullsystem"){ runmode= DesktopSettings::SystemFull; }
+ else if(defMode=="staticinterface"){ runmode = DesktopSettings::SystemInterface; }
+
+ //Now determine the runmode for this user
+ struct passwd *pw = getpwuid(getuid());
+ if(pw!=0){
+ QString cuser = QString(pw->pw_name);
+ free(pw); //done with this structure
+ if( settings[path]->value("fulluser_users", QStringList()).toStringList().contains(cuser) ){ runmode = DesktopSettings::UserFull; }
+ else if( settings[path]->value("fullsystem_users", QStringList()).toStringList().contains(cuser) ){ runmode = DesktopSettings::SystemFull; }
+ else if( settings[path]->value("staticinterface_users", QStringList()).toStringList().contains(cuser) ){ runmode = DesktopSettings::SystemInterface; }
+ else{
+ //No rule found for this specific user - check the group rules
+ //Read off the list of groups
+ gid_t grpList[100];
+ int grpSize = 100;
+ if( getgrouplist(cuser.toLocal8Bit(), getgid(), grpList, &grpSize) > 0 ){
+ QStringList groups;
+ for(int i=0; i<grpSize; i++){
+ struct group *g = getgrgid(grpList[i]);
+ if(g!=0){
+ groups << QString(g->gr_name);
+ free(g);
+ }
+ }
+ QStringList fromfile = settings[path]->value("fulluser_groups", QStringList()).toStringList();
+ fromfile.removeDuplicates();
+ if( (fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::UserFull; }
+ else{
+ fromfile = settings[path]->value("fullsystem_groups", QStringList()).toStringList();
+ fromfile.removeDuplicates();
+ if((fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::SystemFull; }
+ else{
+ fromfile = settings[path]->value("staticinterface_groups", QStringList()).toStringList();
+ fromfile.removeDuplicates();
+ if((fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::SystemInterface; }
+ }
+ }
+ } //end group list read
+ }
+ }else{
+ runmode = DesktopSettings::SystemFull; //could not read user name - assume system files only
+ }
+
+ break; //found this file - go ahead and stop now (no hierarchy for this special file)
+ }
+ //Now report the run mode that was detected
+ QString mode;
+ if(runmode == DesktopSettings::UserFull){ mode = "Full User"; }
+ else if(runmode == DesktopSettings::SystemFull){ mode = "Full System"; }
+ else if(runmode == DesktopSettings::SystemInterface){ mode = "System Interface"; }
+ qDebug() << "Detected Lumina Runtime Mode:" << mode;
+}
+
+void DesktopSettings::locateFiles(){
+ //run at start - finds the locations of the various files (based on RunMode)
+ QString userdir;
+ QStringList systemdirs;
+ userdir = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop";
+ systemdirs << QString(getenv("XDG_CONFIG_DIRS")).split(":") << QString(getenv("XDG_DATA_DIRS")).split(":");
+ //Load all the user-level files for this run mode
+ QList< DesktopSettings::File > tmp;
+ if(runmode == DesktopSettings::UserFull){ tmp << DesktopSettings::Favorites << DesktopSettings::Environment << DesktopSettings::Session << DesktopSettings::Desktop << DesktopSettings::Keys << DesktopSettings::Theme; }
+ else if(runmode == DesktopSettings::SystemInterface){ tmp << DesktopSettings::Favorites << DesktopSettings::Environment << DesktopSettings::Session << DesktopSettings::Desktop << DesktopSettings::Keys << DesktopSettings::Theme; }
+ for(int i=0; i<tmp.length(); i++){
+ QString path = userdir+rel_path(tmp[i]);
+ touchFile(path);
+ files.insert(tmp[i], QStringList() << path);
+ settings.insert(path, new QSettings(path, QSettings::IniFormat, this) );
+ watcher->addPath(path);
+ }
+ //Now load all the system-level files
+ tmp.clear();
+ tmp << DesktopSettings::Favorites << DesktopSettings::Environment << DesktopSettings::Session << DesktopSettings::Desktop << DesktopSettings::Keys << DesktopSettings::Theme;
+ for(int i=0; i<systemdirs.length(); i++){
+ if(systemdirs[i].endsWith("/xdg")){ systemdirs[i] = systemdirs[i].section("/",0,-2); }
+ if( !QFile::exists(systemdirs[i]+"/lumina-desktop") ){ continue; }
+ for(int j=0; j<tmp.length(); j++){
+ QString path = systemdirs[i]+rel_path(tmp[j]);
+ if(QFile::exists(path)){
+ files.insert(tmp[j], QStringList() << path);
+ settings.insert(path, new QSettings(path, QSettings::IniFormat, this) );
+ watcher->addPath(path);
+ }
+ }
+ }
+
+}
+
+void DesktopSettings::touchFile(QString path){
+ if(QFile::exists(path)){ return; } //already exists
+ //Make sure the parent directory exists
+ if(!QFile::exists(path.section("/",0,-2)) ){
+ QDir dir;
+ dir.mkpath(path.section("/",0,-2));
+ }
+ //Now create the empty file
+ QFile file(path);
+ if( file.open(QIODevice::ReadWrite) ){ //if it opens successfully, then it has created the file
+ file.close();
+ }
+}
+
+QString DesktopSettings::rel_path(DesktopSettings::File file){
+ QString name;
+ switch(file){
+ case DesktopSettings::System:
+ name="system"; break;
+ case DesktopSettings::Favorites:
+ name="favorites"; break;
+ case DesktopSettings::Environment:
+ name="environment"; break;
+ case DesktopSettings::Session:
+ name="session"; break;
+ case DesktopSettings::Desktop:
+ name="desktop"; break;
+ case DesktopSettings::Keys:
+ name="keys"; break;
+ case DesktopSettings::Theme:
+ name="theme"; break;
+ }
+ return FILEPREFIX+name+".conf";
+}
+
+//=== PRIVATE SLOTS ===
+void DesktopSettings::fileChanged(QString file){
+ //QFileSystemWatcher change detected
+ if(!watcher->files().contains(file)){
+ //Make sure this file stays watched for changes
+ touchFile(file);
+ watcher->addPath(file);
+ }
+ //Make sure the settings structure for this file is updated to match what is on disk
+ if(settings.contains(file)){ settings[file]->sync(); }
+ //Find which file type this is and send out the signal about it
+ QList< DesktopSettings::File > types = files.keys();
+ for(int i=0; i<types.length(); i++){
+ if(files[types[i]].contains(file)){
+ emit FileModified(types[i]);
+ break;
+ }
+ }
+}
+
+void DesktopSettings::dirChanged(QString){
+ //Not used yet - placeholder in case we need it later on
+}
diff --git a/src-qt5/core/libLumina/DesktopSettings.h b/src-qt5/core/libLumina/DesktopSettings.h
new file mode 100644
index 00000000..737fd6af
--- /dev/null
+++ b/src-qt5/core/libLumina/DesktopSettings.h
@@ -0,0 +1,65 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is a simple class for managing all the various desktop
+// setting files, and sending out notifications about changes
+//===========================================
+// NOTE:
+// This class has a heirarchy-based lookup/write system
+// USER Settings > SYSTEM Settings > DEFAULT Settings
+// XDG_CONFIG_HOME/lumina-desktop > XDG_CONFIG_DIRS/lumina-desktop > XDG_DATA_DIRS/lumina-desktop
+//===========================================
+#ifndef _LUMINA_DESKTOP_SETTINGS_CLASS_H
+#define _LUMINA_DESKTOP_SETTINGS_CLASS_H
+
+#include <QSettings>
+#include <QFileSystemWatcher>
+#include <QString>
+#include <QStringList>
+#include <QHash>
+#include <QVariant>
+
+class DesktopSettings : public QObject{
+ Q_OBJECT
+public:
+ enum File{ System, Favorites, Environment, Session, Desktop, Keys, Theme };
+
+ DesktopSettings(QObject *parent = 0);
+ ~DesktopSettings();
+
+ //Start/stop routines
+ void start();
+ void stop();
+
+ //Main Read/Write functions
+ QVariant value(DesktopSettings::File, QString variable, QVariant defaultvalue);
+ bool setValue(DesktopSettings::File, QString variable, QVariant value);
+ QStringList keys(DesktopSettings::File); //return a list of all variables which are available in this file
+
+ //Information functions
+ QStringList filePaths(DesktopSettings::File); //just in case we need to access any of these files outside this class
+
+private:
+ enum RunMode{UserFull, SystemFull, SystemInterface };
+ DesktopSettings::RunMode runmode; //simple flag for which mode the current session is running in
+ QFileSystemWatcher *watcher;
+ QHash< DesktopSettings::File, QStringList > files; //location hash for where files are actually located on disk
+ QHash< QString, QSettings*> settings; //location hash for the settings files themselves
+
+ void parseSystemSettings(); //run at start - determine the RunMode for this user/session
+ void locateFiles(); //run at start - finds the locations of the various files (based on RunMode)
+ void touchFile(QString path); //used to create an empty file so it can be watched for changes later
+ QString rel_path(DesktopSettings::File); //return the relative file path (starting with "/")
+
+private slots:
+ void fileChanged(QString); //QFileSystemWatcher change detected
+ void dirChanged(QString); //QFileSystemWatcher change detected
+
+signals:
+ void FileModified(DesktopSettings::File);
+
+};
+#endif
diff --git a/src-qt5/core/libLumina/DesktopSettings.pri b/src-qt5/core/libLumina/DesktopSettings.pri
new file mode 100644
index 00000000..19290797
--- /dev/null
+++ b/src-qt5/core/libLumina/DesktopSettings.pri
@@ -0,0 +1,7 @@
+HEADERS *= $${PWD}/DesktopSettings.h
+SOURCES *= $${PWD}/DesktopSettings.cpp
+
+INCLUDEPATH *= ${PWD}
+
+#Now the other dependendies of it
+#include(LUtils.pri)
diff --git a/src-qt5/core/libLumina/ExternalProcess.h b/src-qt5/core/libLumina/ExternalProcess.h
index 2106f296..4cf91ccd 100644
--- a/src-qt5/core/libLumina/ExternalProcess.h
+++ b/src-qt5/core/libLumina/ExternalProcess.h
@@ -33,6 +33,9 @@ public:
connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished()) );
}
~ExternalProcess(){
+ if(this->state() == QProcess::Running){
+ this->detach(); //about to close down the QProcess - detach the other program so it can continue functioning normally.
+ }
}
static void launch(QString program, QStringList args = QStringList()){
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index a8839cee..2f6e371a 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -16,10 +16,9 @@
LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lumina-desktop"){
//Initialize the global objects to null pointers
mediaObj = 0; //private object used for playing login/logout chimes
- Lumina::SYSTEM = 0;
Lumina::EFILTER = 0;
Lumina::SS = 0;
- Lumina::WM = 0;
+ //Lumina::WM = 0;
Lumina::EVThread = 0;
if(this->isPrimaryProcess()){
@@ -36,10 +35,9 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
//this->setAttribute(Qt::AA_UseHighDpiPixmaps); //allow pixmaps to be scaled up as well as down
//Now initialize the global objects (but do not start them yet)
- Lumina::SYSTEM = new LXCB(); //need access to XCB data/functions right away
Lumina::EFILTER = new EventFilter(); //Need the XCB Event filter
Lumina::SS = new LScreenSaver();
- Lumina::WM = new LWindowManager();
+ //Lumina::WM = new LWindowManager();
//Now put the Event Filter into it's own thread to keep things snappy
Lumina::EVThread = new QThread();
Lumina::EFILTER->moveToThread(Lumina::EVThread);
@@ -50,7 +48,7 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
LSession::~LSession(){
//Clean up the global objects as needed
- if(Lumina::SYSTEM!=0){ Lumina::SYSTEM->deleteLater(); }
+
}
diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h
index 0733b232..006ecedf 100644
--- a/src-qt5/core/lumina-desktop-unified/global-includes.h
+++ b/src-qt5/core/lumina-desktop-unified/global-includes.h
@@ -43,6 +43,8 @@
#include <QDesktopWidget>
#include <QStyleOption>
#include <QThread>
+#include <QMediaObject>
+#include <QMediaPlayer>
// libLumina includes
#include <LuminaX11.h>
@@ -52,12 +54,12 @@
#include <LUtils.h>
#include <LDesktopUtils.h>
#include <LuminaSingleApplication.h>
+#include <DesktopSettings.h>
-//XCB Includes
-/*#include <xcb/xcb.h>
-#include <xcb/xproto.h>
-#include <xcb/damage.h>
-#include <xcb/xcb_atom.h>
-#include <xcb/xcb_aux.h> //included in libxcb-util.so*/
+//Setup any global defines (no classes or global objects: use "global-objects.h" for that)
+namespace Lumina{
+ //Flags/enumerations
+ enum WindowAction{MoveResize, Show, Hide, TryClose, Closed, WA_NONE};
+};
#endif
diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h
index 043bc46c..8485ffe6 100644
--- a/src-qt5/core/lumina-desktop-unified/global-objects.h
+++ b/src-qt5/core/lumina-desktop-unified/global-objects.h
@@ -19,20 +19,17 @@
//Load the appropriate "EventFilter" class for the graphics subsystem
//#ifndef USE_WAYLAND
-#include <LXcbEventFilter.h>
+#include "src-events/LXcbEventFilter.h"
//#endif
-#include "<LScreenSaver.h>"
-#include "src-WM/LWindowManager.h"
+#include "src-screensaver/LScreenSaver.h"
+//#include "src-WM/LWindowManager.h"
//Any special defines for settings/testing
#define ANIMTIME 80 //animation time in milliseconds
//Global flags/structures
-namespace Lumina{
- //Flags/enumerations
- enum WindowAction{MoveResize, Show, Hide, TryClose, Closed, WA_NONE};
-
+namespace Lumina{
//Data structures and objects
extern EventFilter *EFILTER; //Native Event Watcher
//ScreenSaver
@@ -41,7 +38,6 @@ namespace Lumina{
//LWindowManager *WM;
QThread *EVThread; //X Event thread
-
};
diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
index 8c72541c..3f228373 100644
--- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
+++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
@@ -15,6 +15,11 @@ include(../libLumina/LuminaXDG.pri)
include(../libLumina/LuminaX11.pri)
include(../libLumina/LuminaSingleApplication.pri)
include(../libLumina/LuminaThemes.pri)
+include(../libLumina/DesktopSettings.pri)
+
+#include all the main individual source groups
+include(src-screensaver/screensaver.pri)
+include(src-events/events.pri)
TEMPLATE = app
@@ -30,7 +35,6 @@ HEADERS += global-includes.h \
FORMS += BootSplash.ui
-include(src-screensaver/screensaver.pri)
#Now include all the files for the various plugins
#include(panel-plugins/panel-plugins.pri)
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp
index e2b1cb2c..e04ee924 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp
@@ -6,6 +6,9 @@
//===========================================
#include "LXcbEventFilter.h"
+#include <xcb/xcb_aux.h>
+#include <xcb/damage.h>
+
//==================================================
// NOTE: All the XCB interactions and atoms are accessed via:
// obj->XCB->EWMH.(atom name)
@@ -49,17 +52,17 @@ void EventFilter::start(){
XCB->setupEventsForRoot(WMFlag);
XCB->WM_Set_Supporting_WM(WMFlag);
- EF->startSystemTray();
+ static_cast<XCBEventFilter*>(EF)->startSystemTray();
QCoreApplication::instance()->flush();
}
void EventFilter::stop(){
- EF->stopSystemTray();
+ static_cast<XCBEventFilter*>(EF)->stopSystemTray();
}
QList<WId> EventFilter::currentTrayApps(){
- return EF->trayApps();
+ return static_cast<XCBEventFilter*>(EF)->trayApps();
}
//=============================
@@ -93,19 +96,18 @@ void XCBEventFilter::InitAtoms(){
<< obj->XCB->EWMH._NET_ACTIVE_WINDOW \
<< obj->XCB->EWMH._NET_WM_ICON \
<< obj->XCB->EWMH._NET_WM_ICON_GEOMETRY;
-}
-
-bool XCBEventFilter::startSystemTray(){
-
-}
-
-bool XCBEventFilter::stopSystemTray(){
+ //_NET_SYSTEM_TRAY_OPCODE
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(QX11Info::connection(), 0, 23,"_NET_SYSTEM_TRAY_OPCODE");
+ xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(QX11Info::connection(), cookie, NULL);
+ if(r){
+ _NET_SYSTEM_TRAY_OPCODE = r->atom;
+ free(r);
+ }
}
//This function format taken directly from the Qt5.3 documentation
-bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
-{
+bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *){
//if(stopping){ return false; } //don't do any parsing
//qDebug() << "New Event";
bool stopevent = false;
@@ -175,7 +177,7 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
break; //This is just a notification that a window was mapped - nothing needs to change here
case XCB_MAP_REQUEST:
qDebug() << "Window Map Request Event";
- obj->emit ModifyWindow( ((xcb_map_request_event_t *) ev)->window, LWM::Show);
+ obj->emit ModifyWindow( ((xcb_map_request_event_t *) ev)->window, Lumina::Show);
break;
//==============================
case XCB_CREATE_NOTIFY:
@@ -184,7 +186,7 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
//==============================
case XCB_UNMAP_NOTIFY:
qDebug() << "Window Unmap Event";
- obj->emit ModifyWindow( ((xcb_unmap_notify_event_t *)ev)->window, LWM::Hide);
+ obj->emit ModifyWindow( ((xcb_unmap_notify_event_t *)ev)->window, Lumina::Hide);
break;
//==============================
case XCB_DESTROY_NOTIFY:
@@ -263,7 +265,7 @@ QList<WId> XCBEventFilter::trayApps(){
}
bool XCBEventFilter::startSystemTray(){
- if(SystemTrayID != 0){ return; } //already started
+ if(SystemTrayID != 0){ return true; } //already started
RunningTrayApps.clear(); //nothing running yet
SystemTrayID = obj->XCB->startSystemTray(0);
if(SystemTrayID!=0){
@@ -276,7 +278,7 @@ bool XCBEventFilter::startSystemTray(){
}
bool XCBEventFilter::stopSystemTray(){
- if(SystemTrayID==0){ return; } //already stopped
+ if(SystemTrayID==0){ return true; } //already stopped
qDebug() << "Stopping system tray...";
//Close all the running Tray Apps
QList<WId> tmpApps = RunningTrayApps;
@@ -291,17 +293,18 @@ bool XCBEventFilter::stopSystemTray(){
obj->XCB->closeSystemTray(SystemTrayID);
SystemTrayID = 0;
TrayDmgID = 0;
+ return true;
}
//=========
// PRIVATE
//=========
-bool XCBEventFilter::BlockInputEvent(WId win){
+bool XCBEventFilter::BlockInputEvent(WId){
//Checks the current state of the WM and sets the stop flag as needed
// - Always let the screensaver know about the event first (need to reset timers and such)
obj->emit NewInputEvent();
// - Check the state of the screensaver
- if(SS->isLocked()){ qDebug() << "SS Locked"; return true; }
+ if(Lumina::SS->isLocked()){ qDebug() << "SS Locked"; return true; }
// - Check the state of any fullscreen apps
/*else if( win!=0 && !obj->FS_WINS.isEmpty()){
if(!obj->FS_WINS.contains(win) ){
@@ -316,7 +319,7 @@ bool XCBEventFilter::BlockInputEvent(WId win){
void XCBEventFilter::addTrayApp(WId win){
if(SystemTrayID==0){ return; }
if(RunningTrayApps.contains(win)){ return; } //already managed
- qDebug() << "Session Tray: Window Added" << obj->XCB->windowClass(win);
+ qDebug() << "Session Tray: Window Added" << obj->XCB->WindowClass(win);
RunningTrayApps << win;
if(DEBUG){ qDebug() << "Tray List Changed"; }
obj->emit Tray_AppAdded(win);
@@ -337,7 +340,7 @@ bool XCBEventFilter::rmTrayApp(WId win){
}
void XCBEventFilter::checkDamageID(WId id){
- if(runningTrayApps.contains(id)){
+ if(RunningTrayApps.contains(id)){
obj->emit Tray_AppUpdated(id);
}else{
//Could check for window damage ID's - but we should not need this
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h
index 6726ef8b..713d97a0 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h
+++ b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h
@@ -9,7 +9,7 @@
#ifndef _LUMINA_DESKTOP_XCB_FILTER_H
#define _LUMINA_DESKTOP_XCB_FILTER_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
/*
@@ -67,7 +67,7 @@ signals:
void NewInputEvent();
void NewManagedWindow(WId);
void WindowClosed(WId);
- void ModifyWindow(WId win, LWM::WindowAction);
+ void ModifyWindow(WId win, Lumina::WindowAction);
//System Tray Signals
void Tray_AppAdded(WId); //new tray app registered
@@ -90,6 +90,7 @@ public:
private:
EventFilter *obj;
QList<xcb_atom_t> WinNotifyAtoms, SysNotifyAtoms;
+ xcb_atom_t _NET_SYSTEM_TRAY_OPCODE;
void InitAtoms();
bool BlockInputEvent(WId win = 0); //Checks the current state of the system to see if the event should be stopped
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/events.pri b/src-qt5/core/lumina-desktop-unified/src-events/events.pri
index 38225d7f..b3ca9847 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/events.pri
+++ b/src-qt5/core/lumina-desktop-unified/src-events/events.pri
@@ -1,6 +1,6 @@
-SOURCES *= $${PWD}/LXCBEventFilter.cpp
+SOURCES *= $${PWD}/LXcbEventFilter.cpp
-HEADERS *= $${PWD}/LXCBEventFilter.h
+HEADERS *= $${PWD}/LXcbEventFilter.h
-#update the includepath so we can just (#include <LXCBEventFilter.h>) as needed without paths
+#update the includepath so we can just (#include <LXcbEventFilter.h>) as needed without paths
INCLUDEPATH *= ${PWD}
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h
index 040499c1..5470128a 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h
@@ -7,7 +7,7 @@
#ifndef _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H
#define _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
namespace Ui{
class LLockScreen;
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h
index 5119d8b1..d27db37e 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h
@@ -7,7 +7,7 @@
#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_H
#define _LUMINA_DESKTOP_SCREEN_SAVER_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
#include "SSBaseWidget.h"
#include "LLockScreen.h"
@@ -56,4 +56,4 @@ protected:
};
-#endif \ No newline at end of file
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
index a6574679..bdcefa24 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
@@ -9,7 +9,7 @@
#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_BASE_WIDGET_H
#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_WIDGET_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
#include "animations/BaseAnimGroup.h"
class SSBaseWidget : public QWidget{
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
index dd7269d4..3b442281 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
@@ -10,7 +10,7 @@
#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H
#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
class BaseAnimGroup : public QParallelAnimationGroup{
Q_OBJECT
@@ -34,4 +34,4 @@ public:
};
-#endif \ No newline at end of file
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/SampleAnimation.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/SampleAnimation.h
index e0f11ba5..972a5109 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/SampleAnimation.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/SampleAnimation.h
@@ -9,7 +9,7 @@
#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_SAMPLE_ANIMATION_H
#define _LUMINA_DESKTOP_SCREEN_SAVER_SAMPLE_ANIMATION_H
-#include "GlobalDefines.h"
+#include "global-includes.h"
#include "BaseAnimGroup.h"
class SampleAnimation : public BaseAnimGroup{
bgstack15