diff options
author | Ken Moore <ken@ixsystems.com> | 2017-01-26 15:09:22 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-01-26 15:09:22 -0500 |
commit | a74bf353f08f45f8f5fb91573d67ad463a25ad4d (patch) | |
tree | ba9a0f906666d7e593740bebe9776e2c03407e86 /src-qt5/core | |
parent | Finish up the new RootWindow class, and tie it into the lumina-desktop-unifie... (diff) | |
download | lumina-a74bf353f08f45f8f5fb91573d67ad463a25ad4d.tar.gz lumina-a74bf353f08f45f8f5fb91573d67ad463a25ad4d.tar.bz2 lumina-a74bf353f08f45f8f5fb91573d67ad463a25ad4d.zip |
Another large batch of work on the new unified desktop.
1) Get the RootWindow up and functional.
2) Get the lumina-desktop-unified binary functional for starting to test the various pieces (not ready yet for general use)
3) Get the start-lumina-desktop binary setup to launch the new unified binary for testing if the "--unified" flag is used.
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 13 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.h | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/BootSplash.cpp | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 54 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.h | 5 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/global-objects.h | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/main.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.cpp | 24 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-events/LXcbEventFilter.h | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/main.cpp | 6 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.h | 2 |
12 files changed, 79 insertions, 40 deletions
diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 0121c3b2..aa5957b5 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -8,9 +8,11 @@ #include <QDesktopWidget> #include <QScreen> +#include <QDebug> // === PUBLIC === -RootWindow::RootWindow(){ +RootWindow::RootWindow() : QWidget(0, Qt::Window | Qt::BypassWindowManagerHint | Qt::WindowStaysOnBottomHint){ + qRegisterMetaType<WId>("WId"); autoResizeTimer = 0; } @@ -19,6 +21,7 @@ RootWindow::~RootWindow(){ } void RootWindow::start(){ + if(autoResizeTimer==0){ autoResizeTimer = new QTimer(this); autoResizeTimer->setInterval(100); //1/10 second (collect all nearly-simultaneous signals and compress into a single update) @@ -27,7 +30,9 @@ void RootWindow::start(){ connect(QApplication::desktop(), SIGNAL(resized(int)), autoResizeTimer, SLOT(start()) ); connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), autoResizeTimer, SLOT(start()) ); } - + this->show(); + ResizeRoot(); + emit RegisterVirtualRoot(this->winId()); } // === PRIVATE === @@ -123,6 +128,7 @@ void RootWindow::ResizeRoot(){ } } //Trigger a repaint and send out any signals + this->setGeometry(fullscreen); this->update(); emit RootResized(); if(!valid.isEmpty()){ emit NewScreens(valid); } @@ -136,6 +142,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin WALLPAPERS[i].scale = scale; WALLPAPERS[i].file = file; updateScreenPixmap(&WALLPAPERS[i]); + //qDebug() << " --- Updated Wallpaper:" << WALLPAPERS[i].id << WALLPAPERS[i].file << WALLPAPERS[i].area; found = true; } } @@ -150,6 +157,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin info.scale = scale; info.area = scrns[i]->geometry(); updateScreenPixmap(&info); + //qDebug() << " --- Loaded Wallpaper:" << info.id << info.file << info.area; WALLPAPERS << info; break; } @@ -162,6 +170,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin // === PROTECTED === void RootWindow::paintEvent(QPaintEvent *ev){ + //qDebug() << "RootWindow: PaintEvent:" << ev->rect(); //<< QDateTime::currentDateTime()->toString(QDateTime::ShortDate); bool found = false; QPainter painter(this); for(int i=0; i<WALLPAPERS.length(); i++){ diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/RootWindow.h index a60c4a1d..b371d239 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/RootWindow.h @@ -54,6 +54,7 @@ protected: void paintEvent(QPaintEvent *ev); signals: + void RegisterVirtualRoot(WId); void RootResized(); void NewScreens(QStringList); // [screen_id_1, screen_id_2, etc..] void RemovedScreens(QStringList); // [screen_id_1, screen_id_2, etc..] 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(); diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 0e076ac3..ed391e04 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -24,10 +24,13 @@ int main(int argc, char ** argv) { + bool unified = false; if (argc > 1) { if (QString(argv[1]) == QString("--version")){ qDebug() << LDesktopUtils::LuminaDesktopVersion(); return 0; + }else if(QString(argv[1]) == QString("--unified")){ + unified = true; } } if(!QFile::exists(LOS::LuminaShare())){ @@ -41,6 +44,7 @@ int main(int argc, char ** argv) //No X session found. Go ahead and re-init this binary within an xinit call QString prog = QString(argv[0]).section("/",-1); LUtils::isValidBinary(prog); //will adjust the path to be absolute + if(unified){ prog = prog+" --unified"; } QStringList args; args << prog; //if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session return QProcess::execute("xinit", args); @@ -78,7 +82,7 @@ int main(int argc, char ** argv) //Startup the session QCoreApplication a(argc, argv); LSession sess; - sess.start(); + sess.start(unified); int retCode = a.exec(); qDebug() << "Finished Closing Down Lumina"; return retCode; diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 67d0e317..2e9433d1 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -77,11 +77,12 @@ void LSession::startProcess(QString ID, QString command, QStringList watchfiles) PROCS << proc; } -void LSession::start(){ +void LSession::start(bool unified){ //First check for a valid installation if(!LUtils::isValidBinary("lumina-desktop") ){ exit(1); } + if(!unified){ QSettings sessionsettings("lumina-desktop","sessionsettings"); QString WM = sessionsettings.value("WindowManager", "fluxbox").toString(); //Window Manager First @@ -151,5 +152,8 @@ void LSession::start(){ startProcess("runtime","lumina-desktop"); //ScreenSaver if(LUtils::isValidBinary("xscreensaver")){ startProcess("screensaver","xscreensaver -no-splash"); } - + }else{ + //unified process + startProcess("runtime","lumina-desktop-unified"); + } } diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h index 7263a3a7..99127c07 100644 --- a/src-qt5/core/lumina-session/session.h +++ b/src-qt5/core/lumina-session/session.h @@ -73,6 +73,6 @@ public: } ~LSession(){ } - void start(); + void start(bool unified = false); }; |