diff options
author | Ken Moore <ken@ixsystems.com> | 2017-01-09 14:41:30 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-01-09 14:41:30 -0500 |
commit | d1750c349cf59bce56569e5be74886edc97ba967 (patch) | |
tree | 48a28f398286f721c8272c85017aa8bbf3b83228 /src-qt5/core/lumina-desktop-unified/src-WM | |
parent | Flip the location of the +/- buttons on the panel config widget to match the ... (diff) | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-d1750c349cf59bce56569e5be74886edc97ba967.tar.gz lumina-d1750c349cf59bce56569e5be74886edc97ba967.tar.bz2 lumina-d1750c349cf59bce56569e5be74886edc97ba967.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-WM')
13 files changed, 0 insertions, 1115 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.cpp deleted file mode 100644 index 4cc6d68b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LLockScreen.h" -#include "ui_LLockScreen.h" - -#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()) ); - connect(ui->line_password, SIGNAL(cursorPositionChanged(int,int)), this, SIGNAL(InputDetected()) ); - connect(waittime, SIGNAL(timeout()), this, SLOT(aboutToShow()) ); - connect(refreshtime, SIGNAL(timeout()), this, SLOT(UpdateLockInfo()) ); -} - -LLockScreen::~LLockScreen(){ - -} - -void LLockScreen::LoadSystemDetails(){ - //Run every time the screen is initially locked - QString user = QString(getlogin()); - ui->label_username->setText( QString(tr("Locked by: %1")).arg(user) ); - ui->label_hostname->setText( QHostInfo::localHostName() ); - ui->tool_unlock->setIcon( LXDG::findIcon("document-decrypt","") ); - attempts = 0; -} - -void LLockScreen::aboutToHide(){ - //auto-hide timeout - clear display - ui->line_password->clear(); - ui->line_password->clearFocus(); - if(refreshtime->isActive()){ refreshtime->stop(); } -} - -void LLockScreen::aboutToShow(){ - if(!waittime->isActive()){ - ui->label_info->clear(); - this->setEnabled(true); - triesleft = NUMTRIES; //back to initial number of tries - if(refreshtime->isActive()){ refreshtime->stop(); } - }else{ - if(!refreshtime->isActive()){ refreshtime->start(); } - } - 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()){ - 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); -} - -void LLockScreen::TryUnlock(){ - attempts++; - this->setEnabled(false); - QString pass = ui->line_password->text(); - ui->line_password->clear(); - bool ok = (LUtils::runCmd("lumina-checkpass", QStringList() << pass) == 0); - if(ok){ - emit ScreenUnlocked(); - this->setEnabled(true); - }else{ - triesleft--; - if(triesleft>0){ - this->setEnabled(true); - }else{ - waittime->start(); - refreshtime->start(); - } - ui->line_password->setFocus(); - } - UpdateLockInfo(); - -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.h b/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.h deleted file mode 100644 index 040499c1..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.h +++ /dev/null @@ -1,42 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H -#define _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H - -#include "GlobalDefines.h" - -namespace Ui{ - class LLockScreen; -}; - -class LLockScreen : public QWidget{ - Q_OBJECT -public: - LLockScreen(QWidget *parent = 0); - ~LLockScreen(); - - void LoadSystemDetails(); //Run right after the screen is initially locked - -public slots: - void aboutToHide(); //auto-hide timeout (can happen multiple times per lock) - void aboutToShow(); //about to be re-shown (can happen multiple times per lock) - -private: - Ui::LLockScreen *ui; - int triesleft, attempts; - QTimer *waittime; - QTimer *refreshtime; - -private slots: - void UpdateLockInfo(); - void TryUnlock(); - -signals: - void ScreenUnlocked(); - void InputDetected(); -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.ui b/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.ui deleted file mode 100644 index 7f0b45b8..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LLockScreen.ui +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>LLockScreen</class> - <widget class="QWidget" name="LLockScreen"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>289</width> - <height>188</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QFrame" name="frame_unlock"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label_hostname"> - <property name="font"> - <font> - <weight>50</weight> - <italic>true</italic> - <bold>false</bold> - <underline>true</underline> - </font> - </property> - <property name="text"> - <string notr="true">hostname</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_username"> - <property name="text"> - <string notr="true">Locked by username</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_info"> - <property name="font"> - <font> - <italic>true</italic> - </font> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QLineEdit" name="line_password"> - <property name="inputMask"> - <string notr="true"/> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="placeholderText"> - <string>Password</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QToolButton" name="tool_unlock"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Unlock Session</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.cpp deleted file mode 100644 index 0c92784e..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.cpp +++ /dev/null @@ -1,181 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LScreenSaver.h" -#include <QScreen> -#include <QApplication> - -#define DEBUG 1 - -LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint){ - starttimer = new QTimer(this); - starttimer->setSingleShot(true); - locktimer = new QTimer(this); - locktimer->setSingleShot(true); - hidetimer = new QTimer(this); - hidetimer->setSingleShot(true); - - LOCKER = new LLockScreen(this); - LOCKER->hide(); - settings = new QSettings("lumina-desktop","lumina-screensaver",this); - SSRunning = SSLocked = updating = false; - this->setObjectName("LSCREENSAVERBASE"); - this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: grey; }"); - this->setMouseTracking(true); - connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); - connect(locktimer, SIGNAL(timeout()), this, SLOT(LockScreen()) ); - connect(hidetimer, SIGNAL(timeout()), this, SLOT(HideLockScreen()) ); - connect(LOCKER, SIGNAL(ScreenUnlocked()), this, SLOT(SSFinished()) ); - connect(LOCKER, SIGNAL(InputDetected()), this, SLOT(newInputEvent()) ); -} - -LScreenSaver::~LScreenSaver(){ - -} - -bool LScreenSaver::isLocked(){ - return SSLocked; -} - -void LScreenSaver::UpdateTimers(){ - //This is generally used for programmatic changes - if(starttimer->isActive()){ starttimer->stop();} - if(locktimer->isActive()){ locktimer->stop(); } - if(hidetimer->isActive()){ hidetimer->stop(); } - - if(!SSRunning && !SSLocked && (starttimer->interval() > 1000) ){ starttimer->start(); } //time to SS start - else if( SSRunning && !SSLocked && (locktimer->interval() > 1000 ) ){ locktimer->start(); } //time to lock - else if( !SSRunning && SSLocked ){ hidetimer->start(); } //time to hide lock screen -} - -// =========== -// PUBLIC SLOTS -// =========== -void LScreenSaver::start(){ - reloadSettings(); //setup all the initial time frames - starttimer->start(); -} - -void LScreenSaver::reloadSettings(){ - settings->sync(); - starttimer->setInterval( settings->value("timedelaymin",10).toInt() * 60000 ); - locktimer->setInterval( settings->value("lockdelaymin",1).toInt() * 60000 ); - hidetimer->setInterval( settings->value("hidesecs",15).toInt() * 1000 ); -} - -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){ - //Running and locked - // Hide the running setting, and display the lock screen - HideScreenSaver(); - ShowLockScreen(); - }else if(SSRunning){ - //Only running, not locked - HideScreenSaver(); - } - UpdateTimers(); - -} - -void LScreenSaver::LockScreenNow(){ - ShowScreenSaver(); - LockScreen(); -} - -// =========== -// PRIVATE SLOTS -// =========== -void LScreenSaver::ShowScreenSaver(){ - if(DEBUG){ qDebug() << "Showing Screen Saver:" << QDateTime::currentDateTime().toString(); } - SSRunning = true; - updating = true; - //Now remove any current Base widgets (prevent any lingering painting between sessions) - for(int i=0; i<BASES.length(); i++){ - if(DEBUG){ qDebug() << " - Removing SS Base"; } - delete BASES.takeAt(i); i--; - } - //Now go through and create/show all the various widgets - QList<QScreen*> SCREENS = QApplication::screens(); - QRect bounds; - cBright = LOS::ScreenBrightness(); - if(cBright>0){ LOS::setScreenBrightness(cBright/2); } //cut to half while the screensaver is active - for(int i=0; i<SCREENS.length(); i++){ - bounds = bounds.united(SCREENS[i]->geometry()); - if(DEBUG){ qDebug() << " - New SS Base:" << i; } - BASES << new SSBaseWidget(this, settings); - connect(BASES[i], SIGNAL(InputDetected()), this, SLOT(newInputEvent()) ); - //Setup the geometry of the base to match the screen - BASES[i]->setGeometry(SCREENS[i]->geometry()); //match this screen geometry - BASES[i]->setPlugin(settings->value("screenplugin"+QString::number(i+1), settings->value("defaultscreenplugin","random").toString() ).toString() ); - } - //Now set the overall parent widget geometry and show everything - this->setGeometry(bounds); //overall background widget - if(!this->isActiveWindow()){ - this->raise(); - this->show(); - this->activateWindow(); - } - for(int i=0; i<BASES.length(); i++){ - BASES[i]->show(); - BASES[i]->startPainting(); - } - updating = false; - UpdateTimers(); -} - -void LScreenSaver::ShowLockScreen(){ - if(DEBUG){ qDebug() << "Showing Lock Screen:" << QDateTime::currentDateTime().toString(); } - LOCKER->aboutToShow(); - //Move the screen locker to the appropriate spot - QPoint ctr = QApplication::desktop()->screenGeometry(QCursor::pos()).center(); - LOCKER->resize(LOCKER->sizeHint()); - LOCKER->move(ctr - QPoint(LOCKER->width()/2, LOCKER->height()/2) ); - LOCKER->show(); - //Start the timer for hiding the lock screen due to inactivity - UpdateTimers(); -} - -void LScreenSaver::HideScreenSaver(){ - if(DEBUG){ qDebug() << "Hiding Screen Saver:" << QDateTime::currentDateTime().toString(); } - SSRunning = false; - if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness - if(!SSLocked){ - this->hide(); - emit ClosingScreenSaver(); - } - for(int i=0; i<BASES.length(); i++){ - BASES[i]->hide(); - BASES[i]->stopPainting(); - } - UpdateTimers(); -} - -void LScreenSaver::HideLockScreen(){ - if(DEBUG){ qDebug() << "Hiding Lock Screen:" << QDateTime::currentDateTime().toString(); } - //Leave the Locked flag set (still locked, just not visible) - LOCKER->aboutToHide(); - LOCKER->hide(); - this->repaint(); - if(SSLocked){ ShowScreenSaver(); } - UpdateTimers(); -} - -void LScreenSaver::LockScreen(){ - if(SSLocked){ return; } - if(DEBUG){ qDebug() << "Locking Screen:" << QDateTime::currentDateTime().toString(); } - SSLocked = true; - LOCKER->LoadSystemDetails(); - UpdateTimers(); -} - -void LScreenSaver::SSFinished(){ - if(DEBUG){ qDebug() << "Screensaver Finished:" << QDateTime::currentDateTime().toString(); } - SSLocked = false; - HideLockScreen(); - HideScreenSaver(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.h b/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.h deleted file mode 100644 index 5119d8b1..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LScreenSaver.h +++ /dev/null @@ -1,59 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_H -#define _LUMINA_DESKTOP_SCREEN_SAVER_H - -#include "GlobalDefines.h" - -#include "SSBaseWidget.h" -#include "LLockScreen.h" - -class LScreenSaver : public QWidget{ - Q_OBJECT -public: - LScreenSaver(); - ~LScreenSaver(); - - bool isLocked(); - -private: - QTimer *starttimer, *locktimer, *hidetimer; - QSettings *settings; - QList<SSBaseWidget*> BASES; - LLockScreen *LOCKER; - int cBright; - bool SSRunning, SSLocked, updating; - - void UpdateTimers(); - -public slots: - void start(); - void reloadSettings(); - void newInputEvent(); - void LockScreenNow(); - -private slots: - void ShowScreenSaver(); - void ShowLockScreen(); - void HideScreenSaver(); - void HideLockScreen(); - - void LockScreen(); - void SSFinished(); - -signals: - void StartingScreenSaver(); - void ClosingScreenSaver(); - -protected: - void mouseMoveEvent(QMouseEvent*){ - QTimer::singleShot(0,this, SLOT(newInputEvent())); - } - -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.cpp deleted file mode 100644 index abbe5a5a..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.cpp +++ /dev/null @@ -1,204 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LXcbEventFilter.h" - -//================================================== -// NOTE: All the XCB interactions and atoms are accessed via: -// LWM::SYSTEM->EWMH.(atom name) -// LWM::SYSTEM->(do something) -// (LWM::SYSTEM is the global XCB structure) -//================================================== - -#include <LuminaX11.h> -#include <QDebug> - -//#include <xcb/screensaver.h> - -#define DEBUG 1 -// Also keep the root window/screen around for use in the filters -namespace L_XCB{ - xcb_screen_t *root_screen; - xcb_window_t root; -} - -//Constructor for the Event Filter wrapper -EventFilter::EventFilter() : QObject(){ - EF = new XCBEventFilter(this); - L_XCB::root_screen = xcb_aux_get_screen(QX11Info::connection(), QX11Info::appScreen()); - L_XCB::root = L_XCB::root_screen->root; - SSLocked = false; - WMFlag = 0; -} - -void EventFilter::start(){ - if(DEBUG){ qDebug() << " - Install event filter..."; } - QCoreApplication::instance()->installNativeEventFilter(EF); - if(DEBUG){ qDebug() << " - Run request check..."; } - if(!LWM::SYSTEM->setupEventsForRoot()){ - qCritical() << "[ERROR] Unable to setup WM event retrieval. Is another WM running?"; - exit(1); - } - if(DEBUG){ qDebug() << " - Create WM ID Window"; } - WMFlag = LWM::SYSTEM->WM_CreateWindow(); - LWM::SYSTEM->setupEventsForRoot(WMFlag); - LWM::SYSTEM->WM_Set_Supporting_WM(WMFlag); - QCoreApplication::instance()->flush(); -} - -//Constructor for the XCB event filter -XCBEventFilter::XCBEventFilter(EventFilter *parent) : QAbstractNativeEventFilter(){ - obj = parent; - InitAtoms(); -} - -//This function format taken directly from the Qt5.3 documentation -bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE -{ - //if(stopping){ return false; } //don't do any parsing - //qDebug() << "New Event"; - bool stopevent = false; - if(eventType=="xcb_generic_event_t"){ - //Convert to known event type (for X11 systems) - xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); - //Now parse the event and emit signals as necessary - switch( ev->response_type & ~0x80){ -//============================== -// INTERACTIVITY EVENTS -//============================== - case XCB_KEY_PRESS: - //This is a keyboard key press - //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"; - 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"; - obj->emit NewInputEvent(); - stopevent = BlockInputEvent( ((xcb_button_press_event_t *) ev)->root ); //use the main "root" window - not the child widget - if(!stopevent){ - //Activate the window right now if needed - if(LWM::SYSTEM->WM_Get_Active_Window()!=((xcb_button_press_event_t *) ev)->root){ - LWM::SYSTEM->WM_Set_Active_Window( ((xcb_button_press_event_t *) ev)->root); - } - } - break; - case XCB_BUTTON_RELEASE: - //This is a mouse button release - //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; - case XCB_MOTION_NOTIFY: - //This is a mouse movement event - //qDebug() << "Motion Notify Event"; - obj->emit NewInputEvent(); - stopevent = BlockInputEvent( ((xcb_motion_notify_event_t *) ev)->root ); //use the main "root" window - not the child widget); - break; - case XCB_ENTER_NOTIFY: - //This is a mouse movement event when mouse goes over a new window - //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"; - obj->emit NewInputEvent(); - stopevent = BlockInputEvent(); - break; -//============================== - case XCB_EXPOSE: - //qDebug() << "Expose Notify Event:"; - //qDebug() << " - Given Window:" << ((xcb_property_notify_event_t*)ev)->window; - break; -//============================== - case XCB_MAP_NOTIFY: - 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); - break; -//============================== - case XCB_CREATE_NOTIFY: - qDebug() << "Window Create Event"; - break; -//============================== - case XCB_UNMAP_NOTIFY: - qDebug() << "Window Unmap Event"; - obj->emit ModifyWindow( ((xcb_unmap_notify_event_t *)ev)->window, LWM::Hide); - break; -//============================== - case XCB_DESTROY_NOTIFY: - qDebug() << "Window Closed Event"; - obj->emit WindowClosed( ((xcb_destroy_notify_event_t *) ev)->window ); - break; -//============================== - case XCB_FOCUS_IN: - //qDebug() << "Focus In Event:"; - break; -//============================== - case XCB_FOCUS_OUT: - //qDebug() << "Focus Out Event:"; - break; -//============================== - case XCB_PROPERTY_NOTIFY: - //qDebug() << "Property Notify Event:"; - //qDebug() << " - Given Window:" << ((xcb_property_notify_event_t*)ev)->window; - break; -//============================== - case XCB_CLIENT_MESSAGE: - //qDebug() << "Client Message Event"; - //qDebug() << " - Given Window:" << ((xcb_client_message_event_t*)ev)->window; - break; -//============================== - case XCB_CONFIGURE_NOTIFY: - //qDebug() << "Configure Notify Event"; - break; -//============================== - case XCB_CONFIGURE_REQUEST: - //qDebug() << "Configure Request Event"; - break; -//============================== - case XCB_SELECTION_CLEAR: - //qDebug() << "Selection Clear Event"; - break; -//============================== - case 85: //not sure what event this is - but it seems to come up very often (just hide the notice) - case 0: - case XCB_GE_GENERIC: - break; //generic event - don't do anything special - default: - qDebug() << "Default Event:" << (ev->response_type & ~0x80); -//============================== - } - } - return false; - //never stop event handling (this will not impact the X events themselves - just the internal screensaver/WM/widgets) -} - -bool XCBEventFilter::BlockInputEvent(WId win){ - //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(obj->SSLocked){ 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) ){ - //If this event is for an app underneath a fullscreen window - stop it - if(obj->FS_WINS.length() == QApplication::desktop()->screenCount()){ qDebug() << "Screens Covered"; return true; } //all screens covered right now - } - } - return false; -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.h b/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.h deleted file mode 100644 index b68eedf5..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LXcbEventFilter.h +++ /dev/null @@ -1,130 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class provides the XCB ->Xlib conversion necessary for Qt5 usage -//=========================================== -#ifndef _LUMINA_DESKTOP_XCB_FILTER_H -#define _LUMINA_DESKTOP_XCB_FILTER_H - -#include "GlobalDefines.h" - - -/* -List of XCB response types (since almost impossible to find good docs on XCB) -switch (xcb_generic_event_t*->response_type & ~0x80) -case values: -XCB_KEY_[PRESS | RELEASE] -XCB_BUTTON_[PRESS | RELEASE] -XCB_MOTION_NOTIFY -XCB_ENTER_NOTIFY -XCB_LEAVE_NOTIFY -XCB_FOCUS_[IN | OUT] -XCB_KEYMAP_NOTIFY -XCB_EXPOSE -XCB_GRAPHICS_EXPOSURE -XCB_VISIBILITY_NOTIFY -XCB_CREATE_NOTIFY -XCB_DESTROY_NOTIFY -XCB_UNMAP_NOTIFY -XCB_MAP_[NOTIFY | REQUEST] -XCB_REPARENT_NOTIFY -XCB_CONFIGURE_[NOTIFY | REQUEST] -XCB_GRAVITY_NOTIFY -XCB_RESIZE_REQUEST -XCB_CIRCULATE_[NOTIFY | REQUEST] -XCB_PROPERTY_NOTIFY -XCB_SELECTION_[CLEAR | REQUEST | NOTIFY] -XCB_COLORMAP_NOTIFY -XCB_CLIENT_MESSAGE -*/ - -//SYSTEM TRAY STANDARD DEFINITIONS -//#define SYSTEM_TRAY_REQUEST_DOCK 0 -//#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -//#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - - -class EventFilter : public QObject{ - Q_OBJECT -private: - QAbstractNativeEventFilter* EF; - WId WMFlag; //used to flag a running WM process - -public: - EventFilter(); - ~EventFilter(){} - - void start(); - - //Public variables for the event filter to use/check - QList<WId> FS_WINS; //Full-screen windows (1 per monitor) - used for hiding non-app events as needed - bool SSLocked; - -public slots: - void StartedSS(){ SSLocked = true; } - void StoppedSS(){ SSLocked = false; } - void FullScreenChanged(QList<WId> fslist){ FS_WINS = fslist; } - -signals: - void NewInputEvent(); - void NewManagedWindow(WId); - void WindowClosed(WId); - void ModifyWindow(WId win, LWM::WindowAction); -}; - -class XCBEventFilter : public QAbstractNativeEventFilter{ -public: - XCBEventFilter(EventFilter *parent); - ~XCBEventFilter(){} - - virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *); - -private: - EventFilter *obj; - QList<xcb_atom_t> WinNotifyAtoms, SysNotifyAtoms; - - void InitAtoms(){ - //Initialize any special atoms that we need to save/use regularly - //NOTE: All the EWMH atoms are already saved globally in LWM::SYSTEM->EWMH - WinNotifyAtoms.clear(); - WinNotifyAtoms << LWM::SYSTEM->EWMH._NET_WM_NAME \ - << LWM::SYSTEM->EWMH._NET_WM_VISIBLE_NAME \ - << LWM::SYSTEM->EWMH._NET_WM_ICON_NAME \ - << LWM::SYSTEM->EWMH._NET_WM_VISIBLE_ICON_NAME \ - << LWM::SYSTEM->EWMH._NET_WM_ICON \ - << LWM::SYSTEM->EWMH._NET_WM_ICON_GEOMETRY; - - SysNotifyAtoms.clear(); - SysNotifyAtoms << LWM::SYSTEM->EWMH._NET_CLIENT_LIST \ - << LWM::SYSTEM->EWMH._NET_CLIENT_LIST_STACKING \ - << LWM::SYSTEM->EWMH._NET_CURRENT_DESKTOP \ - << LWM::SYSTEM->EWMH._NET_WM_STATE \ - << LWM::SYSTEM->EWMH._NET_ACTIVE_WINDOW \ - << LWM::SYSTEM->EWMH._NET_WM_ICON \ - << LWM::SYSTEM->EWMH._NET_WM_ICON_GEOMETRY; - - } - - bool BlockInputEvent(WId win = 0); //Checks the current state of the WM and sets the stop flag as needed - - //Longer Event handling functions - //bool ParseKeyPressEvent(); - //bool ParseKeyReleaseEvent(); - //bool ParseButtonPressEvent(); - //bool ParseButtonReleaseEvent(); - //bool ParseMotionEvent(); - //bool ParsePropertyEvent(); - //bool ParseClientMessageEvent(); - //bool ParseDestroyEvent(); - //bool ParseConfigureEvent(); - //bool ParseKeySelectionClearEvent(); - - - - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.cpp deleted file mode 100644 index 83b82ff8..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== - -#include "SSBaseWidget.h" - -#define DEBUG 1 - -static QStringList validPlugs; -// ======== -// PUBLIC -// ======== -SSBaseWidget::SSBaseWidget(QWidget *parent, QSettings *set) : QWidget(parent){ - if(validPlugs.isEmpty()){ validPlugs << "none"; } //add more later - settings = set; //needed to pass along for plugins to read any special options/settings - this->setObjectName("LuminaBaseSSWidget"); - ANIM = 0; - this->setMouseTracking(true); -} - -SSBaseWidget::~SSBaseWidget(){ - if(ANIM!=0){ this->stopPainting(); } -} - -void SSBaseWidget::setPlugin(QString plug){ - plug = plug.toLower(); - if(validPlugs.contains(plug) || plug=="random"){ plugType = plug; } - else{ plugType = "none"; } -} - -// ============= -// PUBLIC SLOTS -// ============= -void SSBaseWidget::startPainting(){ - cplug = plugType; - //free up any old animation instance - if(ANIM!=0){ - ANIM->stop(); ANIM->clear(); - delete ANIM; ANIM = 0; - } - //If a random plugin - grab one of the known plugins - if(cplug=="random"){ - QStringList valid = BaseAnimGroup::KnownAnimations(); - if(valid.isEmpty()){ cplug = "none"; } //no known plugins - else{ cplug = valid[ qrand()%valid.length() ]; } //grab a random plugin - } - if(DEBUG){ qDebug() << " - Screen Saver:" << cplug; } - //Now list all the various plugins and start them appropriately - QString style; - if(cplug=="none"){ - style = "background: transparent;"; //show the underlying black parent widget - }else{ - style = "background: black;"; - } - this->setStyleSheet("QWidget#LuminaBaseSSWidget{ "+style+"}"); - this->repaint(); - //If not a stylesheet-based plugin - set it here - if(cplug!="none"){ - ANIM = BaseAnimGroup::NewAnimation(cplug, this, settings); - connect(ANIM, SIGNAL(finished()), this, SLOT(startPainting()) ); //repeat the plugin as needed - ANIM->LoadAnimations(); - } - //Now start the animation(s) - if(ANIM!=0){ - //if(DEBUG){ qDebug() << " - Starting SS Plugin:" << cplug << ANIM->animationCount() << ANIM->duration() << ANIM->loopCount(); } - if(ANIM->animationCount()>0){ - if(DEBUG){ qDebug() << " - Starting SS Plugin:" << cplug << ANIM->animationCount() << ANIM->duration() << ANIM->loopCount(); } - ANIM->start(); - } - } -} - -void SSBaseWidget::stopPainting(){ - if(ANIM!=0){ - ANIM->stop(); - ANIM->clear(); - delete ANIM; - ANIM = 0; - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.h b/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.h deleted file mode 100644 index a6574679..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/SSBaseWidget.h +++ /dev/null @@ -1,55 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the widget which provides the screensaver painting/plugin functionality -//=========================================== -#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_BASE_WIDGET_H -#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_WIDGET_H - -#include "GlobalDefines.h" -#include "animations/BaseAnimGroup.h" - -class SSBaseWidget : public QWidget{ - Q_OBJECT -public: - SSBaseWidget(QWidget *parent, QSettings *set); - ~SSBaseWidget(); - - void setPlugin(QString); - -public slots: - void startPainting(); - void stopPainting(); - -private: - QString plugType, cplug; //type of custom painting to do - BaseAnimGroup *ANIM; - QSettings *settings; - -private slots: - -signals: - void InputDetected(); //just in case no event handling setup at the WM level - -protected: - void mouseMoveEvent(QMouseEvent *ev){ - ev->accept(); - emit InputDetected(); - } - void keyPressEvent(QKeyEvent *ev){ - ev->accept(); - emit InputDetected(); - } - void paintEvent(QPaintEvent*){ - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - } - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.cpp deleted file mode 100644 index 1e55dc76..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "BaseAnimGroup.h" - -//Include all the known subclasses here, then add a unique ID for it to the functions at the bottom -#include "SampleAnimation.h" - -//============================== -// PLUGIN LOADING/LISTING -//============================== -BaseAnimGroup* BaseAnimGroup::NewAnimation(QString type, QWidget *parent, QSettings *set){ - //This is where we place all the known plugin ID's, and load the associated subclass - if(type == "sample"){ - return (new SampleAnimation(parent, set)); - }else{ - //Unknown screensaver, return a blank animation group - return (new BaseAnimGroup(parent, set)); - } -} - -QStringList BaseAnimGroup::KnownAnimations(){ - return (QStringList() << "sample"); -}
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.h b/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.h deleted file mode 100644 index dd7269d4..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/animations/BaseAnimGroup.h +++ /dev/null @@ -1,37 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the container which provides the screensaver animations -// and should be subclassed for each of the various animation types -//=========================================== -#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H -#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_ANIMATION_GROUP_H - -#include "GlobalDefines.h" - -class BaseAnimGroup : public QParallelAnimationGroup{ - Q_OBJECT -public: - QWidget *canvas; - QSettings *settings; - - virtual void LoadAnimations(){} //This is the main function which needs to be subclassed - - BaseAnimGroup(QWidget *parent, QSettings *set){ - canvas = parent; - settings = set; - } - ~BaseAnimGroup(){} - - //============================== - // PLUGIN LOADING/LISTING (Change in the .cpp file) - //============================== - static BaseAnimGroup* NewAnimation(QString type, QWidget *parent, QSettings *set); - static QStringList KnownAnimations(); - -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/animations/SampleAnimation.h b/src-qt5/core/lumina-desktop-unified/src-WM/animations/SampleAnimation.h deleted file mode 100644 index e0f11ba5..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/animations/SampleAnimation.h +++ /dev/null @@ -1,45 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the sample plugin for a ScreenSaver animation -//=========================================== -#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_SAMPLE_ANIMATION_H -#define _LUMINA_DESKTOP_SCREEN_SAVER_SAMPLE_ANIMATION_H - -#include "GlobalDefines.h" -#include "BaseAnimGroup.h" - -class SampleAnimation : public BaseAnimGroup{ - Q_OBJECT -private: - QWidget *ball; - -public: - SampleAnimation(QWidget *parent, QSettings *set) : BaseAnimGroup(parent, set){} - ~SampleAnimation(){ this->stop(); delete ball; } - - void LoadAnimations(){ - //qDebug() << "Loading Sample Animation"; - ball = new QWidget(canvas); - //This creates a red "ball" on the widget which is going to expand/contract in the center of the screen - ball->setStyleSheet("background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.341, fy:0.796, stop:0.00531915 rgba(107, 10, 10, 255), stop:0.521277 rgba(170, 10, 10, 255), stop:0.957447 rgba(200, 0, 0, 255), stop:0.994681 rgba(0, 0, 0, 225), stop:1 rgba(255, 255, 255, 0));"); - //Now setup the movements - QPropertyAnimation *move = new QPropertyAnimation(ball,"geometry"); - QPoint ctr(canvas->width()/2, canvas->height()/2); - QRect initgeom(ctr-QPoint(12,12), QSize(24,24) ); - move->setKeyValueAt(0, initgeom ); //starting point - move->setKeyValueAt(1, initgeom ); //ending point (same as start for continuity) - int size = canvas->width(); - if(size > canvas->height()){ size = canvas->height(); } - move->setKeyValueAt(0.5, QRect(ctr-QPoint(size/2, size/2), QSize(size,size))); //touch the edge of the screen - move->setDuration(10000); //10 seconds - this->addAnimation(move); - this->setLoopCount(10); //repeat 10 times - ball->show(); - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/animations/animations.pri b/src-qt5/core/lumina-desktop-unified/src-WM/animations/animations.pri deleted file mode 100644 index 5473d4e1..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/animations/animations.pri +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES += $$PWD/BaseAnimGroup.cpp - -HEADERS += $$PWD/BaseAnimGroup.h \ - $$PWD/SampleAnimation.h - -FORMS +=
\ No newline at end of file |