aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/BootSplash.cpp1
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp54
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.h5
-rw-r--r--src-qt5/core/lumina-desktop-unified/global-objects.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/main.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp24
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h1
7 files changed, 55 insertions, 34 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/BootSplash.cpp b/src-qt5/core/lumina-desktop-unified/BootSplash.cpp
index 1a648973..beb4094b 100644
--- a/src-qt5/core/lumina-desktop-unified/BootSplash.cpp
+++ b/src-qt5/core/lumina-desktop-unified/BootSplash.cpp
@@ -9,6 +9,7 @@ BootSplash::BootSplash() : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowMana
ui->setupUi(this);
this->setObjectName("LuminaBootSplash"); //for theme styling
//Center the window on the primary screen
+ this->show();
QPoint ctr = QApplication::desktop()->screenGeometry().center();
this->move( ctr.x()-(this->width()/2), ctr.y()-(this->height()/2) );
generateTipOfTheDay();
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index 63e86fdc..57b30a2e 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -9,7 +9,7 @@
#include "BootSplash.h"
#ifndef DEBUG
-#define DEBUG 0
+#define DEBUG 1
#endif
//Initialize all the global objects to null pointers
@@ -19,6 +19,7 @@ DesktopSettings* Lumina::SETTINGS = 0;
//Lumina::WM = 0;
QThread* Lumina::EVThread = 0;
RootWindow* Lumina::ROOTWIN = 0;
+XDGDesktopList* Lumina::APPLIST = 0;
LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lumina-desktop"){
//Initialize the global objects to null pointers
@@ -46,7 +47,10 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
Lumina::EFILTER->moveToThread(Lumina::EVThread);
Lumina::EVThread->start();
Lumina::ROOTWIN = new RootWindow();
+ Lumina::APPLIST = new XDGDesktopList(0, true); //keep this list up to date
+ //Setup the various connections between the global classes
+ connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::EFILTER, SLOT(RegisterVirtualRoot(WId)) );
} //end check for primary process
}
@@ -61,12 +65,13 @@ LSession::~LSession(){
}
if(Lumina::SETTINGS!=0){ Lumina::SETTINGS->deleteLater(); }
if(Lumina::ROOTWIN!=0){ Lumina::ROOTWIN->deleteLater(); }
+ if(Lumina::APPLIST!=0){ Lumina::APPLIST->deleteLater(); }
}
void LSession::setupSession(){
BootSplash splash;
splash.showScreen("init");
- qDebug() << "Initializing Session";
+ qDebug() << "Initializing Session:" << QDateTime::currentDateTime().toString( Qt::SystemLocaleShortDate);;
if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); }
QTime* timer = 0;
if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();}
@@ -91,44 +96,51 @@ void LSession::setupSession(){
sessionsettings->value("InitLocale/LC_COLLATE","").toString(), \
sessionsettings->value("InitLocale/LC_CTYPE","").toString() );
}*/
+ if(DEBUG){ qDebug() << " - Load Localization Files:" << timer->elapsed();}
currTranslator = LUtils::LoadTranslation(this, "lumina-desktop");
+ if(DEBUG){ qDebug() << " - Start Event Filter:" << timer->elapsed(); }
+ Lumina::EFILTER->start();
//use the system settings
//Setup the user's lumina settings directory as necessary
splash.showScreen("user");
if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();}
- checkUserFiles(); //adds these files to the watcher as well
+ //checkUserFiles(); //adds these files to the watcher as well
//Initialize the internal variables
//DESKTOPS.clear();
//Start the background system tray
splash.showScreen("systray");
- if(DEBUG){ qDebug() << " - Init System Tray:" << timer->elapsed();}
- //startSystemTray();
//Initialize the global menus
qDebug() << " - Initialize system menus";
splash.showScreen("apps");
- if(DEBUG){ qDebug() << " - Init AppMenu:" << timer->elapsed();}
+ if(DEBUG){ qDebug() << " - Populate App List:" << timer->elapsed();}
+ Lumina::APPLIST->updateList();
//appmenu = new AppMenu();
splash.showScreen("menus");
- if(DEBUG){ qDebug() << " - Init SettingsMenu:" << timer->elapsed();}
+ //if(DEBUG){ qDebug() << " - Init SettingsMenu:" << timer->elapsed();}
//settingsmenu = new SettingsMenu();
- if(DEBUG){ qDebug() << " - Init SystemWindow:" << timer->elapsed();}
+ //if(DEBUG){ qDebug() << " - Init SystemWindow:" << timer->elapsed();}
//sysWindow = new SystemWindow();
//Initialize the desktops
splash.showScreen("desktop");
- if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed();}
+ if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed(); }
+ QList<QScreen*> scrns= QApplication::screens();
+ for(int i=0; i<scrns.length(); i++){
+ qDebug() << " --- Load Wallpaper for Screen:" << scrns[i]->name();
+ Lumina::ROOTWIN->ChangeWallpaper(scrns[i]->name(), RootWindow::Stretch, LOS::LuminaShare()+"desktop-background.jpg");
+ }
+ Lumina::ROOTWIN->start();
//desktopFiles = QDir(QDir::homePath()+"/Desktop").entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs, QDir::Name | QDir::IgnoreCase | QDir::DirsFirst);
//updateDesktops();
//for(int i=0; i<6; i++){ LSession::processEvents(); } //Run through this a few times so the interface systems get up and running
//Now setup the system watcher for changes
splash.showScreen("final");
- qDebug() << " - Initialize file system watcher";
- if(DEBUG){ qDebug() << " - Init QFileSystemWatcher:" << timer->elapsed();}
+ //if(DEBUG){ qDebug() << " - Init QFileSystemWatcher:" << timer->elapsed();}
/*watcher = new QFileSystemWatcher(this);
QString confdir = sessionsettings->fileName().section("/",0,-2);
watcherChange(sessionsettings->fileName() );
@@ -144,14 +156,19 @@ void LSession::setupSession(){
//connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) );
//connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange(QString)) );
//connect(this, SIGNAL(aboutToQuit()), this, SLOT(SessionEnding()) );
+ if(DEBUG){ qDebug() << " - Start Screen Saver:" << timer->elapsed();}
+ Lumina::SS->start();
+
if(DEBUG){ qDebug() << " - Init Finished:" << timer->elapsed(); delete timer;}
//for(int i=0; i<4; i++){ LSession::processEvents(); } //Again, just a few event loops here so thing can settle before we close the splash screen
//launchStartupApps();
- QTimer::singleShot(500, this, SLOT(launchStartupApps()) );
+ //QTimer::singleShot(500, this, SLOT(launchStartupApps()) );
splash.hide();
LSession::processEvents();
splash.close();
LSession::processEvents();
+ //DEBUG: Wait a bit then close down the session
+ QTimer::singleShot(15000, this, SLOT(StartLogout()) );
}
//================
@@ -168,11 +185,8 @@ void LSession::CleanupSession(){
LOS::setAudioVolume( LOS::audioVolume() ); //make sure the audio volume is saved in the backend for the next login
bool playaudio = Lumina::SETTINGS->value(DesktopSettings::Session,"PlayLogoutAudio",true).toBool();
if( playaudio ){ playAudioFile(LOS::LuminaShare()+"Logout.ogg"); }
- //Stop the background system tray (detaching/closing apps as necessary)
- //stopSystemTray(!cleansession);
//Now perform any other cleanup
Lumina::EFILTER->stop();
- //evFilter->StopEventHandling();
//Now wait a moment for things to close down before quitting
if(playaudio){
//wait a max of 5 seconds for audio to finish
@@ -226,11 +240,11 @@ void LSession::playAudioFile(QString filepath){
void LSession::NewCommunication(QStringList list){
if(DEBUG){ qDebug() << "New Communications:" << list; }
for(int i=0; i<list.length(); i++){
- /*if(list[i]=="--check-geoms"){
- screensChanged();
- }else if(list[i]=="--show-start"){
- emit StartButtonActivated();
- }*/
+ if(list[i]=="--logout"){
+ QTimer::singleShot(0, this, SLOT(StartLogout()) );
+ }else if(list[i]=="--lock-session"){
+ Lumina::SS->LockScreenNow();
+ }
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h
index ac156035..c791c66b 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.h
+++ b/src-qt5/core/lumina-desktop-unified/LSession.h
@@ -14,9 +14,6 @@ class LSession : public LSingleApplication{
public:
LSession(int &argc, char **argv);
~LSession();
- //Functions to be called during startup
- void setupSession();
-
private:
void CleanupSession();
@@ -28,6 +25,8 @@ private:
QTranslator *currTranslator;
public slots:
+ void setupSession(); //called during startup only
+
void StartLogout();
void StartShutdown(bool skipupdates = false);
void StartReboot(bool skipupdates = false);
diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h
index 7d924378..66bfd122 100644
--- a/src-qt5/core/lumina-desktop-unified/global-objects.h
+++ b/src-qt5/core/lumina-desktop-unified/global-objects.h
@@ -39,6 +39,8 @@ namespace Lumina{
extern RootWindow *ROOTWIN;
//Window Manager
//LWindowManager *WM;
+ //Application List
+ extern XDGDesktopList *APPLIST;
extern QThread *EVThread; //X Event thread
};
diff --git a/src-qt5/core/lumina-desktop-unified/main.cpp b/src-qt5/core/lumina-desktop-unified/main.cpp
index f8be977d..6141f1ea 100644
--- a/src-qt5/core/lumina-desktop-unified/main.cpp
+++ b/src-qt5/core/lumina-desktop-unified/main.cpp
@@ -37,7 +37,7 @@ int main(int argc, char ** argv)
LuminaThemeEngine theme(&a);
QObject::connect(&theme, SIGNAL(updateIcons()), &a, SLOT(reloadIconTheme()) );
if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); }
- a.setupSession();
+ QTimer::singleShot(0, &a, SLOT(setupSession()) );
theme.refresh();
if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;}
int retCode = a.exec();
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 e04ee924..ced2cadb 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp
@@ -22,7 +22,7 @@
#define SYSTEM_TRAY_CANCEL_MESSAGE 2
-#define DEBUG 1
+#define DEBUG 0
// Also keep the root window/screen around for use in the filters
namespace L_XCB{
@@ -64,6 +64,10 @@ void EventFilter::stop(){
QList<WId> EventFilter::currentTrayApps(){
return static_cast<XCBEventFilter*>(EF)->trayApps();
}
+// === PUBLIC SLOTS ===
+void EventFilter::RegisterVirtualRoot(WId id){
+ XCB->WM_Set_Virtual_Roots( QList<WId>() << id );
+}
//=============================
// XCBEventFilter Class
@@ -121,19 +125,19 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
//==============================
case XCB_KEY_PRESS:
//This is a keyboard key press
- //qDebug() << "Key Press Event";
+ qDebug() << "Key Press Event";
obj->emit NewInputEvent();
stopevent = BlockInputEvent( ((xcb_key_press_event_t *) ev)->root ); //use the main "root" window - not the child widget
break;
case XCB_KEY_RELEASE:
//This is a keyboard key release
- //qDebug() << "Key Release Event";
+ qDebug() << "Key Release Event";
obj->emit NewInputEvent();
stopevent = BlockInputEvent( ((xcb_key_release_event_t *) ev)->root ); //use the main "root" window - not the child widget
break;
case XCB_BUTTON_PRESS:
//This is a mouse button press
- //qDebug() << "Button Press Event";
+ qDebug() << "Button Press Event";
obj->emit NewInputEvent();
stopevent = BlockInputEvent( ((xcb_button_press_event_t *) ev)->root ); //use the main "root" window - not the child widget
if(!stopevent){
@@ -145,7 +149,7 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
break;
case XCB_BUTTON_RELEASE:
//This is a mouse button release
- //qDebug() << "Button Release Event";
+ qDebug() << "Button Release Event";
//xcb_button_release_event_t *tmp = (xcb_button_release_event_t *)ev;
stopevent = BlockInputEvent( ((xcb_button_release_event_t *) ev)->root ); //use the main "root" window - not the child widget
break;
@@ -157,19 +161,19 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
break;
case XCB_ENTER_NOTIFY:
//This is a mouse movement event when mouse goes over a new window
- //qDebug() << "Enter Notify Event";
+ qDebug() << "Enter Notify Event";
obj->emit NewInputEvent();
stopevent = BlockInputEvent( ((xcb_enter_notify_event_t *) ev)->root );
break;
case XCB_LEAVE_NOTIFY:
//This is a mouse movement event when mouse goes leaves a window
- //qDebug() << "Leave Notify Event";
+ qDebug() << "Leave Notify Event";
obj->emit NewInputEvent();
stopevent = BlockInputEvent();
break;
//==============================
case XCB_EXPOSE:
- //qDebug() << "Expose Notify Event:";
+ qDebug() << "Expose Notify Event:";
//qDebug() << " - Given Window:" << ((xcb_property_notify_event_t*)ev)->window;
break;
//==============================
@@ -205,12 +209,12 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
break;
//==============================
case XCB_PROPERTY_NOTIFY:
- //qDebug() << "Property Notify Event:";
+ qDebug() << "Property Notify Event:";
//qDebug() << " - Given Window:" << ((xcb_property_notify_event_t*)ev)->window;
break;
//==============================
case XCB_CLIENT_MESSAGE:
- //qDebug() << "Client Message Event";
+ qDebug() << "Client Message Event";
//qDebug() << " - Given Window:" << ((xcb_client_message_event_t*)ev)->window;
if( ((xcb_client_message_event_t*)ev)->type == _NET_SYSTEM_TRAY_OPCODE && ((xcb_client_message_event_t*)ev)->format == 32){
//data32[0] is timestamp, [1] is opcode, [2] is window handle
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 713d97a0..bd235658 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h
+++ b/src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h
@@ -62,6 +62,7 @@ public:
LXCB *XCB; //used to interact with the X11 graphics subsystem
public slots:
+ void RegisterVirtualRoot(WId);
signals:
void NewInputEvent();
bgstack15