diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-27 08:20:14 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-27 08:20:14 -0400 |
commit | 79ed54ff31ed654b953d46987851ce4f572245c2 (patch) | |
tree | b61de25f0ece7cfdb266f396a826b271c47ed0dd /src-qt5/core/lumina-desktop-unified | |
parent | Quick fix for the mkport.sh script (diff) | |
download | lumina-79ed54ff31ed654b953d46987851ce4f572245c2.tar.gz lumina-79ed54ff31ed654b953d46987851ce4f572245c2.tar.bz2 lumina-79ed54ff31ed654b953d46987851ce4f572245c2.zip |
Another large batch of re-organization for lumina-desktop-unified.
This gets the new "NativeWindowSystem" and associated Native* classes all integrated (untested)
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
12 files changed, 154 insertions, 103 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index e511d7ad..c67156c6 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -15,7 +15,9 @@ #endif //Initialize all the global objects to null pointers -EventFilter* Lumina::EFILTER = 0; +NativeWindowSystem* Lumina::NWS = 0; +NativeEventFilter* Lumina::NEF = 0; +//EventFilter* Lumina::EFILTER = 0; LScreenSaver* Lumina::SS = 0; DesktopSettings* Lumina::SETTINGS = 0; //Lumina::WM = 0; @@ -42,32 +44,29 @@ 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::EFILTER = new EventFilter(); //Need the XCB Event filter first + Lumina::NEF = new NativeEventFilter(); + Lumina::NWS = new NativeWindowSystem(); + //Lumina::EFILTER = new EventFilter(); //Need the XCB Event filter first Lumina::SETTINGS = new DesktopSettings(); Lumina::SS = new LScreenSaver(); //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); + Lumina::NEF->moveToThread(Lumina::EVThread); Lumina::EVThread->start(); Lumina::ROOTWIN = new RootWindow(); Lumina::APPLIST = new XDGDesktopList(0, true); //keep this list up to date Lumina::SHORTCUTS = new LShortcutEvents(); //this can be moved to it's own thread eventually as well - //Setup the basic connections between the shortcuts class and the session itself - connect(Lumina::SHORTCUTS, SIGNAL(StartLogout()), this, SLOT(StartLogout()) ); - connect(Lumina::SHORTCUTS, SIGNAL(StartReboot()), this, SLOT(StartReboot()) ); - connect(Lumina::SHORTCUTS, SIGNAL(StartShutdown()), this, SLOT(StartShutdown()) ); - //Setup the various connections between the global classes - // NOTE: Most of these connections will only become "active" as the global objects get started during the setupSession routine - connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::EFILTER, SLOT(RegisterVirtualRoot(WId)) ); - connect(Lumina::EFILTER, SIGNAL(WindowCreated(NativeWindow*)), Lumina::ROOTWIN, SLOT(NewWindow(NativeWindow*)) ); - } //end check for primary process + setupGlobalConnections(); + } //end check for primary process } LSession::~LSession(){ //Clean up the global objects as needed - if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); } + if(Lumina::NEF!=0){ Lumina::NEF->deleteLater(); } + if(Lumina::NWS!=0){ Lumina::NWS->deleteLater(); } + //if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); } if(Lumina::SS!=0){ Lumina::SS->deleteLater(); } if(Lumina::EVThread!=0){ if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); } @@ -106,35 +105,39 @@ 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() << " - Load Localization Files:" << timer->elapsed();} + currTranslator = LUtils::LoadTranslation(this, "lumina-desktop"); if(DEBUG){ qDebug() << " - Start Event Filter:" << timer->elapsed(); } - Lumina::EFILTER->start(); + Lumina::NEF->start(); + if( !Lumina::NWS->start() ){ + qWarning() << "Could not start the Lumina desktop. Is another desktop or window manager running?"; + this->exit(1); + return; + } //use the system settings //Setup the user's lumina settings directory as necessary splash.showScreen("user"); - if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();} + if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();} //checkUserFiles(); //adds these files to the watcher as well //Initialize the internal variables //DESKTOPS.clear(); - + //Start the background system tray splash.showScreen("systray"); - //Initialize the global menus qDebug() << " - Initialize system menus"; splash.showScreen("apps"); if(DEBUG){ qDebug() << " - Populate App List:" << timer->elapsed();} Lumina::APPLIST->updateList(); //appmenu = new AppMenu(); - + splash.showScreen("menus"); //if(DEBUG){ qDebug() << " - Init SettingsMenu:" << timer->elapsed();} //settingsmenu = new SettingsMenu(); //if(DEBUG){ qDebug() << " - Init SystemWindow:" << timer->elapsed();} //sysWindow = new SystemWindow(); - + //Initialize the desktops splash.showScreen("desktop"); if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed(); } @@ -180,7 +183,7 @@ void LSession::setupSession(){ QTimer::singleShot(500, this, SLOT(launchStartupApps()) ); splash.hide(); LSession::processEvents(); - splash.close(); + splash.close(); LSession::processEvents(); //DEBUG: Wait a bit then close down the session //QTimer::singleShot(15000, this, SLOT(StartLogout()) ); @@ -201,7 +204,7 @@ void LSession::CleanupSession(){ bool playaudio = Lumina::SETTINGS->value(DesktopSettings::Session,"PlayLogoutAudio",true).toBool(); if( playaudio ){ playAudioFile(LOS::LuminaShare()+"Logout.ogg"); } //Now perform any other cleanup - Lumina::EFILTER->stop(); + //Lumina::NEF->stop(); //Now wait a moment for things to close down before quitting if(playaudio){ //wait a max of 5 seconds for audio to finish @@ -219,10 +222,60 @@ void LSession::CleanupSession(){ if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); } } +//================= + +void LSession::setupGlobalConnections(){ + //Setup the various connections between the global classes + // NOTE: Most of these connections will only become "active" as the global objects get started during the setupSession routine + + //Setup the basic connections between the shortcuts class and the session itself + connect(Lumina::SHORTCUTS, SIGNAL(StartLogout()), this, SLOT(StartLogout()) ); + connect(Lumina::SHORTCUTS, SIGNAL(StartReboot()), this, SLOT(StartReboot()) ); + connect(Lumina::SHORTCUTS, SIGNAL(StartShutdown()), this, SLOT(StartShutdown()) ); + + //Root window connections + connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::NWS, SLOT(RegisterVirtualRoot(WId)) ); + + //Native Window Class connections + connect(Lumina::NEF, SIGNAL(WindowCreated(WId)), Lumina::NWS, SLOT(NewWindowDetected(WId))); + connect(Lumina::NEF, SIGNAL(WindowDestroyed(WId)), Lumina::NWS, SLOT(WindowCloseDetected(WId))); + connect(Lumina::NEF, SIGNAL(WindowPropertyChanged(WId, NativeWindow::Property)), Lumina::NWS, SLOT(WindowPropertyChanged(WId, NativeWindow::Property))); + connect(Lumina::NEF, SIGNAL(TrayWindowCreated(WId)), Lumina::NWS, SLOT(NewTrayWindowDetected(WId))); + connect(Lumina::NEF, SIGNAL(TrayWindowDestroyed(WId)), Lumina::NWS, SLOT(WindowCloseDetected(WId))); + connect(Lumina::NEF, SIGNAL(PossibleDamageEvent(WId)), Lumina::NWS, SLOT(CheckDamageID(WId))); + connect(Lumina::NEF, SIGNAL(KeyPressed(int, WId)), Lumina::NWS, SLOT(NewKeyPress(int, WId))); + connect(Lumina::NEF, SIGNAL(KeyReleased(int, WId)), Lumina::NWS, SLOT(NewKeyRelease(int, WId))); + connect(Lumina::NEF, SIGNAL(MousePressed(int, WId)), Lumina::NWS, SLOT(NewMousePress(int, WId))); + connect(Lumina::NEF, SIGNAL(MouseReleased(int, WId)), Lumina::NWS, SLOT(NewMouseRelease(int, WId))); + //connect(Lumina::NEF, SIGNAL(MouseMovement(WId)), Lumina::NWS, SLOT()); + //connect(Lumina::NEF, SIGNAL(MouseEnterWindow(WId)), Lumina::NWS, SLOT()); + //connect(Lumina::NEF, SIGNAL(MouseLeaveWindow(WId)), Lumina::NWS, SLOT()); + + //Input Events for ScreenSaver + connect(Lumina::NEF, SIGNAL(KeyPressed(int, WId)), Lumina::SS, SLOT(newInputEvent())); + connect(Lumina::NEF, SIGNAL(KeyReleased(int, WId)), Lumina::SS, SLOT(newInputEvent())); + connect(Lumina::NEF, SIGNAL(MousePressed(int, WId)), Lumina::SS, SLOT(newInputEvent())); + connect(Lumina::NEF, SIGNAL(MouseReleased(int, WId)), Lumina::SS, SLOT(newInputEvent())); + connect(Lumina::NEF, SIGNAL(MouseMovement(WId)), Lumina::SS, SLOT(newInputEvent())); + + connect(Lumina::SS, SIGNAL(LockStatusChanged(bool)), Lumina::NWS, SLOT(ScreenLockChanged(bool)) ); + + //Mouse/Keyboard Shortcut Events (Make sure to connect to the NWS - the raw events need to be ignored sometimes) + connect(Lumina::NWS, SIGNAL(KeyPressDetected(WId, int);), this, SLOT(KeyPress(WId, int)) ); + connect(Lumina::NWS, SIGNAL(KeyReleaseDetected(WId, int)), this, SLOT(KeyRelease(WId, int)) ); + connect(Lumina::NWS, SIGNAL(MousePressDetected(WId, NativeWindowSystem::MouseButton)), this, SLOT(MousePress(WId, NativeWindowSystem::MouseButton)) ); + connect(Lumina::NWS, SIGNAL(MouseReleaseDetected(WId, NativeWindowSystem::MouseButton)), this, SLOT(MouseRelease(WId, NativeWindowSystem::MouseButton)) ); + + //NWS Events to the window system + connect(Lumina::NWS, SIGNAL(NewWindowAvailable(NativeWindow*)), Lumina::ROOTWIN, SLOT(NewWindow(NativeWindow*)) ); +} + +//================= + int LSession::VersionStringToNumber(QString version){ version = version.section("-",0,0); //trim any extra labels off the end int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>) - maj = mid = min = 0; + maj = mid = min = 0; bool ok = true; maj = version.section(".",0,0).toInt(&ok); if(ok){ mid = version.section(".",1,1).toInt(&ok); }else{ maj = 0; } @@ -233,6 +286,8 @@ int LSession::VersionStringToNumber(QString version){ return (maj*1000000 + mid*1000 + min); } +//================= + //Play System Audio void LSession::playAudioFile(QString filepath){ if( !QFile::exists(filepath) ){ return; } @@ -257,10 +312,10 @@ void LSession::NewCommunication(QStringList list){ for(int i=0; i<list.length(); i++){ if(list[i]=="--logout"){ QTimer::singleShot(0, this, SLOT(StartLogout()) ); - }else if(list[i]=="--lock-session"){ + }else if(list[i]=="--lock-session"){ Lumina::SS->LockScreenNow(); } - } + } } void LSession::launchStartupApps(){ @@ -275,32 +330,32 @@ void LSession::launchStartupApps(){ QProcess::startDetached("numlockx off"); } } - int tmp = LOS::ScreenBrightness(); - if(tmp>0){ + /*int tmp = LOS::ScreenBrightness(); + if(tmp>0){ LOS::setScreenBrightness( tmp ); qDebug() << " - - Screen Brightness:" << QString::number(tmp)+"%"; } //ExternalProcess::launch("nice lumina-open -autostart-apps"); - + //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 qDebug() << " - Loading previous settings"; tmp = LOS::audioVolume(); LOS::setAudioVolume(tmp); qDebug() << " - - Audio Volume:" << QString::number(tmp)+"%"; - + */ //Now play the login music since we are finished if(Lumina::SETTINGS->value(DesktopSettings::System,"PlayStartupAudio",true).toBool()){ //Make sure to re-set the system volume to the last-used value at outset - int vol = LOS::audioVolume(); - if(vol>=0){ LOS::setAudioVolume(vol); } + /*int vol = LOS::audioVolume(); + if(vol>=0){ LOS::setAudioVolume(vol); }*/ LSession::playAudioFile(LOS::LuminaShare()+"Login.ogg"); } qDebug() << " - Finished with startup routines"; } void LSession::checkUserFiles(){ - //internal version conversion examples: + //internal version conversion examples: // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] QString OVS = Lumina::SETTINGS->value(DesktopSettings::System,"DesktopVersion","0").toString(); //Old Version String bool changed = LDesktopUtils::checkUserFiles(OVS); @@ -322,26 +377,26 @@ void LSession::StartLogout(){ void LSession::StartShutdown(bool skipupdates){ CleanupSession(); LOS::systemShutdown(skipupdates); - QCoreApplication::exit(0); + QCoreApplication::exit(0); } void LSession::StartReboot(bool skipupdates){ CleanupSession(); LOS::systemRestart(skipupdates); - QCoreApplication::exit(0); + QCoreApplication::exit(0); } void LSession::reloadIconTheme(){ //Wait a moment for things to settle before sending out the signal to the interfaces QApplication::processEvents(); QApplication::processEvents(); - emit IconThemeChanged(); + emit IconThemeChanged(); } //Temporarily change the session locale (nothing saved between sessions) void LSession::switchLocale(QString localeCode){ - currTranslator = LUtils::LoadTranslation(this, "lumina-desktop", localeCode, currTranslator); - if(currTranslator!=0 || localeCode=="en_US"){ + currTranslator = LUtils::LoadTranslation(this, "lumina-desktop", localeCode, currTranslator); + if(currTranslator!=0 || localeCode=="en_US"){ LUtils::setLocaleEnv(localeCode); //will set everything to this locale (no custom settings) } emit LocaleChanged(); diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h index c791c66b..dd32d22a 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.h +++ b/src-qt5/core/lumina-desktop-unified/LSession.h @@ -17,7 +17,8 @@ public: private: void CleanupSession(); - + void setupGlobalConnections(); + int VersionStringToNumber(QString version); QMediaPlayer *mediaObj; void playAudioFile(QString filepath); @@ -45,7 +46,7 @@ signals: //General Signals void LocaleChanged(); void IconThemeChanged(); - + }; #endif diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index 867076db..53caf88f 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -59,6 +59,8 @@ #include <RootWindow.h> #include <ExternalProcess.h> #include <NativeWindow.h> +#include <NativeWindowSystem.h> +#include <NativeEventFilter.h> // Standard C includes #include <unistd.h> diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h index 2f298e27..8d76772e 100644 --- a/src-qt5/core/lumina-desktop-unified/global-objects.h +++ b/src-qt5/core/lumina-desktop-unified/global-objects.h @@ -19,7 +19,7 @@ //Load the appropriate "EventFilter" class for the graphics subsystem //#ifndef USE_WAYLAND -#include "src-events/LXcbEventFilter.h" +//#include "src-events/LXcbEventFilter.h" //#endif #include "src-events/LShortcutEvents.h" @@ -30,9 +30,13 @@ #define ANIMTIME 80 //animation time in milliseconds //Global flags/structures -namespace Lumina{ +namespace Lumina{ //Data structures and objects - extern EventFilter *EFILTER; //Native Event Watcher + // -- Native Window System Objects + extern NativeWindowSystem *NWS; + extern NativeEventFilter *NEF; + + //extern EventFilter *EFILTER; //Native Event Watcher extern LShortcutEvents *SHORTCUTS; //Keyboard/mouse shortcut events extern DesktopSettings *SETTINGS; //All Settings files //ScreenSaver @@ -43,7 +47,7 @@ namespace Lumina{ //LWindowManager *WM; //Application List extern XDGDesktopList *APPLIST; - + extern 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 1de8308d..58c7e774 100644 --- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro @@ -18,6 +18,7 @@ include(../libLumina/LuminaThemes.pri) include(../libLumina/DesktopSettings.pri) include(../libLumina/RootWindow.pri) include(../libLumina/ExternalProcess.pri) +include(../libLumina/NativeWindow.pri) #include all the main individual source groups include(src-screensaver/screensaver.pri) diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp index e363af01..6bd36ef6 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp @@ -13,7 +13,7 @@ void DesktopContextMenu::SettingsChanged(DesktopSettings::File file){ void DesktopContextMenu::UpdateMenu(){ //Put a label at the top - unsigned int num = Lumina::EFILTER->currentWorkspace(); //LX11::GetCurrentDesktop(); + unsigned int num = Lumina::NWS->currentWorkspace(); workspaceLabel->setText( "<b>"+QString(tr("Workspace %1")).arg(QString::number(num+1))+"</b>"); this->clear(); //clear it for refresh this->addAction(wkspaceact); diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp index b09a1a5b..eb448f02 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp @@ -25,18 +25,9 @@ void LShortcutEvents::start(){ clearTimer->setSingleShot(true); connect(clearTimer, SIGNAL(timeout()), this, SLOT(clearKeys()) ); } - //Now connect this object to the global EFILTER object signals - connect(Lumina::EFILTER, SIGNAL(KeyPressed(WId, int)), this, SLOT(KeyPress(WId, int)) ); - connect(Lumina::EFILTER, SIGNAL(KeyReleased(WId, int)), this, SLOT(KeyRelease(WId, int)) ); - connect(Lumina::EFILTER, SIGNAL(MousePressed(WId, Lumina::MouseButton)), this, SLOT(MousePress(WId, Lumina::MouseButton)) ); - connect(Lumina::EFILTER, SIGNAL(MouseReleased(WId, Lumina::MouseButton)), this, SLOT(MouseRelease(WId, Lumina::MouseButton)) ); } void LShortcutEvents::stop(){ - disconnect(Lumina::EFILTER, SIGNAL(KeyPressed(WId, int)), this, SLOT(KeyPress(WId, int)) ); - disconnect(Lumina::EFILTER, SIGNAL(KeyReleased(WId, int)), this, SLOT(KeyRelease(WId, int)) ); - disconnect(Lumina::EFILTER, SIGNAL(MousePressed(WId, Lumina::MouseButton)), this, SLOT(MousePress(WId, Lumina::MouseButton)) ); - disconnect(Lumina::EFILTER, SIGNAL(MouseReleased(WId, Lumina::MouseButton)), this, SLOT(MouseRelease(WId, Lumina::MouseButton)) ); clearKeys(); } @@ -59,42 +50,42 @@ void LShortcutEvents::CheckKeySequence(WId win){ } } -void LShortcutEvents::CheckMouseSequence(WId win, Lumina::MouseButton button, bool release){ - if(release && (button == Lumina::WheelUp || button == Lumina::WheelDown || button == Lumina::WheelLeft || button == Lumina::WheelRight)){ +void LShortcutEvents::CheckMouseSequence(WId win, NativeWindowSystem::MouseButton button, bool release){ + if(release && (button == NativeWindowSystem::WheelUp || button == NativeWindowSystem::WheelDown || button == NativeWindowSystem::WheelLeft || button == NativeWindowSystem::WheelRight)){ return; //skip mouse release events for wheel actions (always come in pairs of press/release) - }else if(keylist.isEmpty() || button == Lumina::NoButton){ return; } //Never overwrite mouse clicks themselves - just combinations with key presses + }else if(keylist.isEmpty() || button == NativeWindowSystem::NoButton){ return; } //Never overwrite mouse clicks themselves - just combinations with key presses //Get the keyboard modifiers QString shortcut = keylistToString(); //Add the mouse button to the shortcut switch(button){ - case Lumina::LeftButton: + case NativeWindowSystem::LeftButton: shortcut.append("+LeftMouse"); break; - case Lumina::RightButton: + case NativeWindowSystem::RightButton: shortcut.append("+RightMouse"); break; - case Lumina::MidButton: + case NativeWindowSystem::MidButton: shortcut.append("+MiddleMouse"); break; - case Lumina::BackButton: + case NativeWindowSystem::BackButton: shortcut.append("+BackMouse"); break; - case Lumina::ForwardButton: + case NativeWindowSystem::ForwardButton: shortcut.append("+ForwardMouse"); break; - case Lumina::TaskButton: + case NativeWindowSystem::TaskButton: shortcut.append("+TaskMouse"); break; - case Lumina::WheelUp: + case NativeWindowSystem::WheelUp: shortcut.append("+WheelUp"); break; - case Lumina::WheelDown: + case NativeWindowSystem::WheelDown: shortcut.append("+WheelDown"); break; - case Lumina::WheelLeft: + case NativeWindowSystem::WheelLeft: shortcut.append("+WheelLeft"); break; - case Lumina::WheelRight: + case NativeWindowSystem::WheelRight: shortcut.append("+WheelRight"); break; default: @@ -146,7 +137,7 @@ void LShortcutEvents::evaluateShortcutAction(QString action){ // === PUBLIC SLOTS === void LShortcutEvents::KeyPress(WId window, int key){ if(window!=WIN){ keylist.clear(); WIN = window; } - if(!keylist.contains(key)){ + if(!keylist.contains(key)){ //Put it in the list in ascending order bool found = false; for(int i=0; i<keylist.length() && !found; i++){ @@ -156,26 +147,26 @@ void LShortcutEvents::KeyPress(WId window, int key){ evaluated = false; } //Evaluate the key sequence only when the first one is released - clearTimer->start(); //will "restart" if already running + clearTimer->start(); //will "restart" if already running } void LShortcutEvents::KeyRelease(WId window, int key){ if(window!=WIN){ keylist.clear(); return; } if(!evaluated){ CheckKeySequence(WIN); } //run this "before" removing the key from the list keylist.removeAll(key); - clearTimer->start(); //will "restart" if already running + clearTimer->start(); //will "restart" if already running } -void LShortcutEvents::MousePress(WId window, Lumina::MouseButton button){ +void LShortcutEvents::MousePress(WId window, NativeWindowSystem::MouseButton button){ //We do not provide shortcuts for combinations of mouse buttons - just mouse+keyboard combinations CheckMouseSequence(window, button, false); - clearTimer->start(); //will "restart" if already running + clearTimer->start(); //will "restart" if already running } -void LShortcutEvents::MouseRelease(WId window, Lumina::MouseButton button){ +void LShortcutEvents::MouseRelease(WId window, NativeWindowSystem::MouseButton button){ //We do not provide shortcuts for combinations of mouse buttons - just mouse+keyboard combinations CheckMouseSequence(window, button, true); - clearTimer->start(); //will "restart" if already running + clearTimer->start(); //will "restart" if already running } void LShortcutEvents::clearKeys(){ diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h index d1c3b4e0..a8ab4b38 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h +++ b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h @@ -29,15 +29,15 @@ private: //Actual check functions void CheckKeySequence(WId win); - void CheckMouseSequence(WId win, Lumina::MouseButton, bool release); + void CheckMouseSequence(WId win, NativeWindowSystem::MouseButton, bool release); QString keylistToString(); void evaluateShortcutAction(QString action); public slots: void KeyPress(WId window, int key); void KeyRelease(WId window, int key); - void MousePress(WId window, Lumina::MouseButton); - void MouseRelease(WId window, Lumina::MouseButton); + void MousePress(WId window, NativeWindowSystem::MouseButton); + void MouseRelease(WId window, NativeWindowSystem::MouseButton); void clearKeys(); signals: @@ -50,7 +50,7 @@ signals: // Session Options void ChangeWorkspace(int); // +/- 1 from current void LockSession(); - + //Active Window Options void ActiveWindowMoveToWorkspace(int); //number of workspace void ActiveWindowTakeToWorkspace(int); //number of workspace 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 9eec91ca..48d500ed 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 #Shortcut event files SOURCES *= $${PWD}/LShortcutEvents.cpp diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp index cdcf2434..0ff70142 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp @@ -10,17 +10,15 @@ #include <unistd.h> #define NUMTRIES 3 -//#define WAITMINS 1 #define DEBUG 1 LLockScreen::LLockScreen(QWidget *parent) : QWidget(parent), ui(new Ui::LLockScreen()){ ui->setupUi(this); waittime = new QTimer(this); - //waittime->setInterval(WAITMINS*60000); //(too many attempts in short time) waittime->setSingleShot(true); refreshtime = new QTimer(this); //timer to update the wait time display refreshtime->setInterval(6000); //6 seconds (1/10 second) - + connect(ui->tool_unlock, SIGNAL(clicked()), this, SLOT(TryUnlock()) ); connect(ui->line_password, SIGNAL(returnPressed()), this, SLOT(TryUnlock()) ); connect(ui->line_password, SIGNAL(textEdited(QString)), this, SIGNAL(InputDetected()) ); @@ -30,7 +28,7 @@ LLockScreen::LLockScreen(QWidget *parent) : QWidget(parent), ui(new Ui::LLockScr } LLockScreen::~LLockScreen(){ - + } void LLockScreen::LoadSystemDetails(){ @@ -47,7 +45,7 @@ void LLockScreen::aboutToHide(){ ui->line_password->clear(); ui->line_password->clearFocus(); if(refreshtime->isActive()){ refreshtime->stop(); } -} +} void LLockScreen::aboutToShow(){ if(!waittime->isActive()){ @@ -61,21 +59,17 @@ void LLockScreen::aboutToShow(){ UpdateLockInfo(); ui->line_password->clear(); ui->line_password->setFocus(); -} +} // ================= // PRIVATE SLOTS // ================= void LLockScreen::UpdateLockInfo(){ QString info; - /*if(triesleft>0 && triesleft<NUMTRIES ){ - if(triesleft==1){info = tr("1 Attempt Left"); } - else{info = QString(tr("%1 Attempts Left")).arg(QString::number(triesleft)); } - }else*/ - if(waittime->isActive()){ + if(waittime->isActive()){ info = tr("Too Many Failures")+"\n"+ QString(tr("Wait %1 Minutes")).arg( QString::number(qRound(waittime->remainingTime()/6000.0)/10.0) ); }else if(attempts>0){ info.append("\n"+QString(tr("Failed Attempts: %1")).arg(QString::number(attempts)) ); } - ui->label_info->setText(info); + ui->label_info->setText(info); } void LLockScreen::TryUnlock(){ @@ -89,11 +83,11 @@ void LLockScreen::TryUnlock(){ this->setEnabled(true); }else{ triesleft--; - if(triesleft>0){ + if(triesleft>0){ this->setEnabled(true); - }else{ + }else{ waittime->setInterval( (attempts/NUMTRIES)*60000); - waittime->start(); + waittime->start(); refreshtime->start(); } ui->line_password->setFocus(); diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp index 3dcbf85e..9f280a47 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp @@ -17,7 +17,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo locktimer->setSingleShot(true); hidetimer = new QTimer(this); hidetimer->setSingleShot(true); - + LOCKER = new LLockScreen(this); LOCKER->hide(); settings = new QSettings("lumina-desktop","lumina-screensaver",this); @@ -33,7 +33,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo } LScreenSaver::~LScreenSaver(){ - + } bool LScreenSaver::isLocked(){ @@ -66,7 +66,7 @@ void LScreenSaver::reloadSettings(){ hidetimer->setInterval( settings->value("hidesecs",15).toInt() * 1000 ); } -void LScreenSaver::newInputEvent(){ +void LScreenSaver::newInputEvent(){ if(updating){ return; } //in the middle of making changes which could cause an event if(DEBUG){ qDebug() << "New Input Event"; } if(SSRunning && SSLocked){ @@ -79,7 +79,6 @@ void LScreenSaver::newInputEvent(){ HideScreenSaver(); } UpdateTimers(); - } void LScreenSaver::LockScreenNow(){ @@ -119,7 +118,7 @@ void LScreenSaver::ShowScreenSaver(){ if(!this->isActiveWindow()){ this->raise(); this->show(); - this->activateWindow(); + this->activateWindow(); } for(int i=0; i<BASES.length(); i++){ BASES[i]->show(); @@ -149,10 +148,11 @@ void LScreenSaver::HideScreenSaver(){ if(!SSLocked){ this->hide(); emit ClosingScreenSaver(); + emit LockStatusChanged(false); } - for(int i=0; i<BASES.length(); i++){ + for(int i=0; i<BASES.length(); i++){ BASES[i]->hide(); - BASES[i]->stopPainting(); + BASES[i]->stopPainting(); } UpdateTimers(); } @@ -171,6 +171,7 @@ void LScreenSaver::LockScreen(){ if(SSLocked){ return; } if(DEBUG){ qDebug() << "Locking Screen:" << QDateTime::currentDateTime().toString(); } SSLocked = true; + emit LockStatusChanged(true); LOCKER->LoadSystemDetails(); UpdateTimers(); } @@ -178,6 +179,7 @@ void LScreenSaver::LockScreen(){ void LScreenSaver::SSFinished(){ if(DEBUG){ qDebug() << "Screensaver Finished:" << QDateTime::currentDateTime().toString(); } SSLocked = false; + emit LockStatusChanged(false); HideLockScreen(); HideScreenSaver(); } 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 d27db37e..18f12fab 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h @@ -19,7 +19,7 @@ public: ~LScreenSaver(); bool isLocked(); - + private: QTimer *starttimer, *locktimer, *hidetimer; QSettings *settings; @@ -48,6 +48,7 @@ private slots: signals: void StartingScreenSaver(); void ClosingScreenSaver(); + void LockStatusChanged(bool locked); protected: void mouseMoveEvent(QMouseEvent*){ |