diff options
Diffstat (limited to 'src-qt5/core')
10 files changed, 0 insertions, 1172 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/DEPENDENCIES b/src-qt5/core/lumina-desktop-unified/src-WM/DEPENDENCIES deleted file mode 100644 index fa0ce486..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/DEPENDENCIES +++ /dev/null @@ -1,17 +0,0 @@ -Most dependencies required to build Lumina are listed in the -DEPENDENCIES file in the directory above this one. The following -are dependencies specific to Lumina's window manager. - - -FreeBSD/TrueOS -======================= - - - - -Linux (Debian/Ubuntu) -======================= - -libxcb-screensaver0-dev - - diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/GlobalDefines.h b/src-qt5/core/lumina-desktop-unified/src-WM/GlobalDefines.h deleted file mode 100644 index 3ec278ac..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/GlobalDefines.h +++ /dev/null @@ -1,74 +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 -//=========================================== -// Global defines and enumerations for the window manager -//=========================================== -#ifndef _LUMINA_WINDOW_MANAGER_GLOBAL_DEFINES_H -#define _LUMINA_WINDOW_MANAGER_GLOBAL_DEFINES_H - -//Qt includes -#include <QObject> -#include <QFrame> -#include <QLabel> -#include <QToolButton> -#include <QMenu> -#include <QHBoxLayout> -#include <QMouseEvent> -#include <QAction> -#include <QPoint> -#include <QFile> -#include <QDir> -#include <QString> -#include <QTextStream> -#include <QUrl> -#include <QDebug> -#include <QStringList> -#include <QAbstractNativeEventFilter> -#include <QList> -#include <QX11Info> -#include <QCoreApplication> -#include <QPropertyAnimation> -#include <QAnimationGroup> -#include <QParallelAnimationGroup> -#include <QWindow> -#include <QWidget> -#include <QBackingStore> -#include <QPaintEvent> -#include <QPainter> -#include <QSettings> -#include <QHostInfo> -#include <QDesktopWidget> -#include <QStyleOption> -#include <QThread> - -// libLumina includes -#include <LuminaX11.h> -#include <LuminaXDG.h> -#include <LuminaOS.h> -#include <LuminaThemes.h> -#include <LuminaUtils.h> -#include <LuminaSingleApplication.h> - -//XCB Includes -#include <xcb/xcb.h> -#include <xcb/xproto.h> -#include <xcb/damage.h> -#include <xcb/xcb_atom.h> -#include <xcb/xcb_aux.h> //included in libxcb-util.so - -#define ANIMTIME 80 //animation time in milliseconds -//Global flags/structures -namespace LWM{ - //Flags/enumerations - enum WindowAction{MoveResize, Show, Hide, TryClose, Closed, WA_NONE}; - - //Data structures - extern LXCB *SYSTEM; -}; - - - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.cpp deleted file mode 100644 index 84ff2ffd..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.cpp +++ /dev/null @@ -1,474 +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 "LWindow.h" - -LWindowFrame::LWindowFrame(WId client, QWidget *parent) : QFrame(parent, Qt::X11BypassWindowManagerHint){ - activeState = LWindowFrame::Normal; - CID = client; - lastAction = LWM::WA_NONE; - Closing = false; - //qDebug() << "New Window:" << CID << "Frame:" << this->winId(); - this->setMouseTracking(true); //need this to determine mouse location when not clicked - this->setObjectName("LWindowFrame"); - this->setStyleSheet("LWindowFrame#LWindowFrame{ border: 2px solid white; border-radius:3px; } QWidget#TitleBar{background: grey; } QLabel{ color: black; }"); - InitWindow(); //initially create all the child widgets - //LWM::SYSTEM->setupEventsForFrame(this->winId()); - updateAppearance(); //this loads the appearance based on window/theme settings - //QApplication::processEvents(); - //Now set the frame size on this window - SyncSize(); - SyncText(); - this->show(); -} - -LWindowFrame::~LWindowFrame(){ -} - -// ================= -// PRIVATE -// ================= -void LWindowFrame::InitWindow(){ - anim = new QPropertyAnimation(this); //For simple window animations - anim->setTargetObject(this); - anim->setDuration(ANIMTIME); //In milliseconds - connect(anim, SIGNAL(finished()), this, SLOT(finishedAnimation()) ); - titleBar = new QLabel(this); //This is the "container" for all the title buttons/widgets - titleBar->setObjectName("TitleBar"); - titleBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); - titleBar->setFocusPolicy(Qt::NoFocus); - titleBar->setCursor(Qt::ArrowCursor); - title = new QLabel(this); //Shows the window title/text - title->setObjectName("Title"); - title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - title->setCursor(Qt::ArrowCursor); - title->setFocusPolicy(Qt::NoFocus); - icon = new QLabel(this); //Contains the window icon - icon->setObjectName("Icon"); - icon->setCursor(Qt::ArrowCursor); - icon->setFocusPolicy(Qt::NoFocus); - minB = new QToolButton(this); //Minimize Button - minB->setObjectName("Minimize"); - minB->setCursor(Qt::ArrowCursor); - minB->setFocusPolicy(Qt::NoFocus); - connect(minB, SIGNAL(clicked()), this, SLOT(minClicked()) ); - maxB = new QToolButton(this); //Maximize Button - maxB->setObjectName("Maximize"); - maxB->setCursor(Qt::ArrowCursor); - maxB->setFocusPolicy(Qt::NoFocus); - connect(maxB, SIGNAL(clicked()), this, SLOT(maxClicked()) ); - closeB = new QToolButton(this); - closeB->setObjectName("Close"); - closeB->setCursor(Qt::ArrowCursor); - closeB->setFocusPolicy(Qt::NoFocus); - connect(closeB, SIGNAL(clicked()), this, SLOT(closeClicked()) ); - otherB = new QToolButton(this); //Button to place any other actions - otherB->setObjectName("Options"); - otherB->setCursor(Qt::ArrowCursor); - otherB->setPopupMode(QToolButton::InstantPopup); - otherB->setStyleSheet("QToolButton::menu-indicator{ image: none; }"); - otherB->setFocusPolicy(Qt::NoFocus); - otherM = new QMenu(this); //menu of "other" actions for the window - otherB->setMenu(otherM); - connect(otherM, SIGNAL(triggered(QAction*)), this, SLOT(otherClicked(QAction*)) ); - //Now assemble the titlebar - QHBoxLayout *HL = new QHBoxLayout(this); - HL->setContentsMargins(0,0,0,0); - HL->addWidget(otherB); - HL->addWidget(icon); - HL->addWidget(title); - HL->addWidget(minB); - HL->addWidget(maxB); - HL->addWidget(closeB); - titleBar->setLayout(HL); - QVBoxLayout *VL = new QVBoxLayout(this); - this->setLayout(VL); - //The WinWidget container appears shifted right/down by 1 pixel for some reason - // Adjust the margins to account for this variation - VL->setContentsMargins(1,1,2,2); - VL->setSpacing(0); - //Have the window take the same initial size of the client window - QRect geom = LWM::SYSTEM->WM_Window_Geom(CID); - qDebug() << " - Load Size Hints" << "initial size:" << geom.size(); - icccm_size_hints SH = LWM::SYSTEM->WM_ICCCM_GetNormalHints(CID); - qDebug() << " - - Got Normal Hints"; - if(!SH.isValid()){ SH = LWM::SYSTEM->WM_ICCCM_GetSizeHints(CID); } - qDebug() << " - - Start resizing..."; - if(SH.base_width>geom.width() && SH.base_height>geom.height()){ this->resize(SH.base_width, SH.base_height); } - else if(SH.min_width>geom.width() && SH.min_height>geom.height()){ this->resize(SH.min_width, SH.min_height); } - else if(SH.width>geom.width() && SH.height>geom.height()){ this->resize(SH.width, SH.height); } - else if(geom.isNull()){ this->resize(100,80); } - else{ this->resize( geom.size() ); } - qDebug() << " - done"; - - //Now embed the native window into the frame - WIN = QWindow::fromWinId(CID); - WinWidget = QWidget::createWindowContainer( WIN, this); - WinWidget->setCursor(Qt::ArrowCursor); //this is just a fallback - the window itself will adjust it - //WINBACK = new QBackingStore(WIN); //create a data backup for the widget - - //Now assemble te initial layout for the window (all while still invisible) - /*VL->addWidget(titleBar); - VL->addWidget(WinWidget); - VL->setStretch(1,1);*/ -} - -LWindowFrame::ModState LWindowFrame::getStateAtPoint(QPoint pt, bool setoffset){ - //Note: pt should be in widget-relative coordinates, not global - if(!this->layout()->geometry().contains(pt)){ - //above the frame itself - need to figure out which quadrant it is in (8-directions) - if(pt.y() < 3){ - //One of the top options - if(pt.x() < 3){ - if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner - return ResizeTopLeft; - }else if(pt.x() > (this->width()-3)){ - if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(pt.y()); } //difference from top-right corner - return ResizeTopRight; - }else{ - if(setoffset){ offset.setX(0); offset.setY(pt.y()); } //difference from top edge (X does not matter) - return ResizeTop; - } - }else if(pt.y() > (this->height()-3) ){ - //One of the bottom options - if(pt.x() < 3){ - if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner - return ResizeBottomLeft; - }else if(pt.x() > (this->width()-3)){ - if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-right corner - return ResizeBottomRight; - }else{ - if(setoffset){ offset.setX(0); offset.setY(this->height() - pt.y()); } //difference from bottom edge (X does not matter) - return ResizeBottom; - } - }else{ - //One of the side options - if(pt.x() < 3){ - if(setoffset){ offset.setX(pt.x()); offset.setY(0); } //difference from left edge (Y does not matter) - return ResizeLeft; - }else if(pt.x() > (this->width()-3) ){ - if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(0); } //difference from right edge (Y does not matter) - return ResizeRight; - }else{ - return Normal; - } - } - } - return Normal; -} - -void LWindowFrame::setMouseCursor(ModState state, bool override){ - Qt::CursorShape shape; - switch(state){ - case Normal: - shape = Qt::ArrowCursor; - break; - case Move: - shape = Qt::SizeAllCursor; - break; - case ResizeTop: - shape = Qt::SizeVerCursor; - break; - case ResizeTopRight: - shape = Qt::SizeBDiagCursor; - break; - case ResizeRight: - shape = Qt::SizeHorCursor; - break; - case ResizeBottomRight: - shape = Qt::SizeFDiagCursor; - break; - case ResizeBottom: - shape = Qt::SizeVerCursor; - break; - case ResizeBottomLeft: - shape = Qt::SizeBDiagCursor; - break; - case ResizeLeft: - shape = Qt::SizeHorCursor; - break; - case ResizeTopLeft: - shape = Qt::SizeFDiagCursor; - break; - } - if(override){ - QApplication::setOverrideCursor(QCursor(shape)); - }else{ - this->setCursor(shape); - } -} - -// ========================== -// WINDOW INTERACTIONS -//========================== -void LWindowFrame::SyncSize(bool fromwin){ - //sync the window/frame geometries (generally only done before embedding the client window) - int frame = this->frameWidth(); - int TH = titleBar->height(); - //Now load the information about the window and adjust the frame to match - if(fromwin){ lastGeom = LWM::SYSTEM->WM_Window_Geom(CID); } - else{ lastGeom = this->geometry(); } - qDebug() << "Initial Size:" << lastGeom << frame << TH; - //Add in the frame size - lastGeom.moveTop(lastGeom.y()-frame-TH); - lastGeom.setHeight(lastGeom.height()+(2*frame)+TH); - lastGeom.moveLeft(lastGeom.x()-frame); - lastGeom.setWidth( lastGeom.width()+(2*frame)); - QList<unsigned int> margins; - margins << frame << frame << frame+TH << frame; //L/R/Top/Bottom - qDebug() << " - With Frame:" << lastGeom; - //Now adjust for a out-of-bounds location - if(lastGeom.x() < 0){ lastGeom.moveLeft(0); } - if(lastGeom.y() < 0){ lastGeom.moveTop(0); } - qDebug() << " - Adjusted:" << lastGeom; - this->setGeometry(lastGeom); - LWM::SYSTEM->WM_Set_Frame_Extents(CID, margins); -} - -void LWindowFrame::SyncText(){ - QString txt = WIN->title(); - if(txt.isEmpty()){ txt = LWM::SYSTEM->WindowName(CID); } - if(txt.isEmpty()){ txt = LWM::SYSTEM->OldWindowName(CID); } - if(txt.isEmpty()){ txt = LWM::SYSTEM->WindowVisibleName(CID); } - if(txt.isEmpty()){ txt = LWM::SYSTEM->WindowIconName(CID); } - if(txt.isEmpty()){ txt = LWM::SYSTEM->WindowVisibleIconName(CID); } - if(txt.isEmpty()){ txt = LWM::SYSTEM->WM_ICCCM_GetClass(CID); } - title->setText(txt); -} - -// SIMPLE ANIMATIONS -void LWindowFrame::showAnimation(LWM::WindowAction act){ - bool useanimation = (act!=lastAction); - if(anim->state()==QAbstractAnimation::Running){ - qDebug() << "New Animation Event:" << act; - return; - } - //Setup the animation routine - if(act==LWM::Show){ - if(useanimation){ - lastGeom = this->geometry(); - //Expand out from center point - anim->setPropertyName("geometry"); - anim->setStartValue( QRect(lastGeom.center(), QSize(0,0) ) ); - anim->setEndValue( this->geometry() ); - //Fade in gradually - //anim->setPropertyName("windowOpacity"); - //anim->setStartValue( 0.0 ); - //anim->setEndValue( 1.0 ); - }else{ - ShowClient(true); - this->raise(); - this->show(); //just show it right away - } - - }else if(act==LWM::Hide){ - if(useanimation){ - //Collapse in on center point - lastGeom = this->geometry(); - anim->setPropertyName("geometry"); - anim->setStartValue( QRect(this->geometry()) ); - anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); - }else{ - this->hide(); //just hide it right away - } - }else if(act==LWM::Closed){ - //Need to clean up the container widget first to prevent XCB errors - //qDebug() << "Window Closed:" << WIN->winId() << CID; - if(useanimation){ - //Collapse in on center line - lastGeom = this->geometry(); - anim->setPropertyName("geometry"); - anim->setStartValue( QRect(this->geometry()) ); - anim->setEndValue( QRect(this->geometry().x(), this->geometry().center().y(), this->width(), 0 ) ); - }else{ - CloseAll(); //just hide it right away - } - } - if(useanimation){ - ShowClient(false); - this->show(); - qDebug() << " - Starting Animation:" << act; - lastAction = act; - anim->start(); - }; -} - -void LWindowFrame::ShowClient(bool show){ - if(show && this->layout()->indexOf(WinWidget)<0 && !Closing){ - while(this->layout()->count()>0){ this->layout()->removeItem(0); } - this->layout()->addWidget(titleBar); - this->layout()->setAlignment(titleBar, Qt::AlignTop); - this->layout()->addWidget(WinWidget); - static_cast<QVBoxLayout*>(this->layout())->setStretch(1,1); - LWM::SYSTEM->WM_ShowWindow(CID); - }else if( !show && this->layout()->indexOf(WinWidget)>=0){ - LWM::SYSTEM->WM_HideWindow(CID); - this->layout()->removeWidget(WinWidget); - } -} - -void LWindowFrame::finishedAnimation(){ - //Also set any final values - qDebug() << " - Finished Animation:" << lastAction; - switch(lastAction){ - case LWM::Show: - ShowClient(true); - break; - case LWM::Closed: - case LWM::Hide: - this->lower(); - this->hide(); - LWM::SYSTEM->WM_HideWindow(this->winId()); - default: - break; - } - if(Closing){ - qDebug() << "Emitting finished signal"; - emit Finished(); - } -} - -// ================= -// PUBLIC SLOTS -// ================= -void LWindowFrame::updateAppearance(){ - //Reload any button icons and such - minB->setIcon(LXDG::findIcon("window-suppressed","")); - maxB->setIcon(LXDG::findIcon("view-fullscreen","")); - closeB->setIcon(LXDG::findIcon("application-exit","")); - otherB->setIcon(LXDG::findIcon("configure","")); -} - -void LWindowFrame::windowChanged(LWM::WindowAction act){ - //A window property was changed - update accordingly - switch(act){ - case LWM::Closed: - Closing = true; - case LWM::Hide: - case LWM::Show: - showAnimation(act); - break; - case LWM::MoveResize: - //Re-adjust to the new position/size of the window - SyncSize(true); - break; - default: - break; //do nothing - } -} -// ================= -// PRIVATE SLOTS -// ================= -void LWindowFrame::closeClicked(){ - qDebug() << "Closing Window" << LWM::SYSTEM->WM_ICCCM_GetClass(CID); - //First try the close event to let the client app do cleanup/etc - LWM::SYSTEM->WM_CloseWindow(CID); -} - -void LWindowFrame::minClicked(){ - qDebug() << "Minimize Window"; - windowChanged(LWM::Hide); -} - -void LWindowFrame::maxClicked(){ - if(normalGeom.isNull()){ - qDebug() << "Maximize Window"; - normalGeom = this->geometry(); //save for later - this->showMaximized(); - }else{ - qDebug() << "Restore Window"; - this->showNormal(); - this->setGeometry(normalGeom); - normalGeom = QRect(); //clear it - } -} - -void LWindowFrame::otherClicked(QAction* act){ - QString action = act->whatsThis(); -} - -void LWindowFrame::CloseAll(){ - qDebug() << " - Closing Frame"; - this->hide(); - emit Finished(); -} -// ===================== -// PROTECTED -// ===================== -void LWindowFrame::mousePressEvent(QMouseEvent *ev){ - qDebug() << "Frame Mouse Press Event"; - offset.setX(0); offset.setY(0); - if(activeState != Normal){ return; } // do nothing - already in a state of grabbed mouse - this->activateWindow(); - LWM::SYSTEM->WM_Set_Active_Window(CID); - if(this->childAt(ev->pos())!=0){ - //Check for any non-left-click event and skip it - if(ev->button()!=Qt::LeftButton){ return; } - activeState = Move; - offset.setX(ev->pos().x()); offset.setY(ev->pos().y()); - }else{ - //Clicked on the frame somewhere - activeState = getStateAtPoint(ev->pos(), true); //also have it set the offset variable - } - setMouseCursor(activeState, true); //this one is an override cursor - -} - -void LWindowFrame::mouseMoveEvent(QMouseEvent *ev){ - ev->accept(); - if(activeState == Normal){ - setMouseCursor( getStateAtPoint(ev->pos()) ); //just update the mouse cursor - - }else{ - //Currently in a modification state - QRect geom = this->geometry(); - switch(activeState){ - case Move: - geom.moveTopLeft(ev->globalPos()-offset); //will not change size - break; - case ResizeTop: - geom.setTop(ev->globalPos().y()-offset.y()); - break; - case ResizeTopRight: - geom.setTopRight(ev->globalPos()-offset); - break; - case ResizeRight: - geom.setRight(ev->globalPos().x()-offset.x()); - break; - case ResizeBottomRight: - geom.setBottomRight(ev->globalPos()-offset); - break; - case ResizeBottom: - geom.setBottom(ev->globalPos().y()-offset.y()); - break; - case ResizeBottomLeft: - geom.setBottomLeft(ev->globalPos()-offset); - break; - case ResizeLeft: - geom.setLeft(ev->globalPos().x()-offset.x()); - break; - case ResizeTopLeft: - geom.setTopLeft(ev->globalPos()-offset); - break; - default: - break; - } - this->setGeometry(geom); - } -} - -void LWindowFrame::mouseReleaseEvent(QMouseEvent *ev){ - //Check for a right-click event - qDebug() << "Frame Mouse Release Event"; - ev->accept(); - if( (activeState==Normal) && (this->childAt(ev->pos())==titleBar) && (ev->button()==Qt::RightButton) ){ - otherM->popup(ev->globalPos()); - return; - } - activeState = Normal; - QApplication::restoreOverrideCursor(); - setMouseCursor( getStateAtPoint(ev->pos()) ); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.h b/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.h deleted file mode 100644 index ceefca83..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LWindow.h +++ /dev/null @@ -1,114 +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_WINDOW_FRAME_H -#define _LUMINA_DESKTOP_WINDOW_FRAME_H - -#include "GlobalDefines.h" - -class LWindowFrame : public QFrame{ - Q_OBJECT -public: - LWindowFrame(WId client, QWidget *parent = 0); //MUST have a valid client window - ~LWindowFrame(); - -private: - void InitWindow(); //Initialize all the internal widgets - - //Window status - enum ModState{Normal, Move, ResizeTop, ResizeTopRight, ResizeRight, ResizeBottomRight, ResizeBottom, ResizeBottomLeft, ResizeLeft, ResizeTopLeft}; - ModState activeState; - QPoint offset; //needed for movement calculations (offset from mouse click to movement point) - //Functions for getting/setting state - ModState getStateAtPoint(QPoint pt, bool setoffset = false); //generally used for mouse location detection - void setMouseCursor(ModState, bool override = false); //Update the mouse cursor based on state - - //General Properties/Modifications - WId CID; //Client ID - QWindow *WIN; //Embedded window container - QWidget *WinWidget; - bool Closing; - LWM::WindowAction lastAction; - //QBackingStore *WINBACK; - void SyncSize(bool fromwin = false); //sync the window/frame geometries - void SyncText(); - - //Window Frame Widgets/Items - QLabel *titleBar, *title, *icon; - QToolButton *minB, *maxB, *closeB, *otherB; - QMenu *otherM; //menu of "other" actions for the window - QRect normalGeom; //used for restoring back to original size after maximization/fullscreen - - //Animations - QPropertyAnimation *anim; //used for appear/disappear animations - QRect lastGeom; //used for appear/disappear animations - void showAnimation(LWM::WindowAction); //sets lastAction - void ShowClient(bool show); - -public slots: - //These slots are generally used for the outside event watcher to prod for changes - void updateAppearance(); //reload the theme and change styling as necessary - void windowChanged(LWM::WindowAction); - -private slots: - void finishedAnimation(); //uses lastAction - void closeClicked(); - void minClicked(); - void maxClicked(); - void otherClicked(QAction*); - - void CloseAll(); - -protected: - void mousePressEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - -signals: - void Finished(); //This means the window is completely finished (with animations and such) and should be removed from any lists - -}; - -class LWindow : public QObject{ - Q_OBJECT -signals: - void Finished(WId client); //ready to be removed -private: - WId CID; - LWindowFrame *FID; - bool needsFrame(QList<LXCB::WINDOWTYPE> list){ - if(list.isEmpty()){ return !LWM::SYSTEM->WM_ICCCM_GetClass(CID).contains("Lumina-DE"); } //assume a normal window (fallback) - return !(list.contains(LXCB::T_DESKTOP) || list.contains(LXCB::T_DOCK) || list.contains(LXCB::T_TOOLBAR) \ - || list.contains(LXCB::T_SPLASH) || list.contains(LXCB::T_DROPDOWN_MENU) \ - || list.contains(LXCB::T_TOOLTIP) || list.contains(LXCB::T_POPUP_MENU) || list.contains(LXCB::T_TOOLTIP) \ - || list.contains(LXCB::T_COMBO) || list.contains(LXCB::T_DND) ); - } -private slots: - void frameclosed(){ - qDebug() << " - Window got frame closed signal"; - //FID->close(); - //delete FID; - emit Finished(CID); - } -public: - LWindow(WId client){ - FID= 0; - CID = client; - if( needsFrame(LWM::SYSTEM->WM_Get_Window_Type(CID)) ){ - FID = new LWindowFrame(CID); - connect(FID, SIGNAL(Finished()), this, SLOT(frameclosed()) ); - } - } - ~LWindow(){ - if(FID!=0){delete FID;} - } - - WId clientID(){ return CID; } - bool hasFrame(){ return FID!=0; } - LWindowFrame* frame(){ return FID; } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.cpp deleted file mode 100644 index 14ce6897..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.cpp +++ /dev/null @@ -1,186 +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 "LWindowManager.h" - -#define DEBUG 1 - -LWindowManager::LWindowManager(){ - -} - -LWindowManager::~LWindowManager(){ - -} - -bool LWindowManager::start(){ - //Setup the initial screen/session values - LWM::SYSTEM->WM_Set_Root_Supported(); - LWM::SYSTEM->WM_SetNumber_Desktops(1); - LWM::SYSTEM->WM_Set_Current_Desktop(0); - LWM::SYSTEM->WM_Set_Desktop_Names(QStringList() << "one"); - QRect totgeom; - QList<QPoint> viewports; - QList<QRect> geoms; - for(int i=0; i<QApplication::desktop()->screenCount(); i++){ - geoms << QApplication::desktop()->screen(i)->geometry(); - viewports << QPoint(0,0); - totgeom = QApplication::desktop()->screen(i)->geometry(); - } - LWM::SYSTEM->WM_Set_Desktop_Geometry(totgeom.size()); - LWM::SYSTEM->WM_Set_Desktop_Viewport(viewports); - LWM::SYSTEM->WM_Set_Workarea(geoms); - //Should probably do a quick loop over any existing windows with the root as parent (just in case) - QList<WId> initial = LWM::SYSTEM->WM_RootWindows(); - for(int i=0; i<initial.length(); i++){ - NewWindow(initial[i], false); //These ones did not explicitly request to be mapped - } - RestackWindows(); - return true; -} - -void LWindowManager::stop(){ - for(int i=0; i<WINS.length(); i++){ - if(WINS[i]->hasFrame()){ - LWM::SYSTEM->UnembedWindow(WINS[i]->clientID()); - WINS[i]->frame()->close(); - } - } -} -//=============== -// PUBLIC SLOTS -//=============== -void LWindowManager::NewWindow(WId win, bool requested){ - //Verify that this window can/should be managed first - //if(DEBUG){ qDebug() << "New Window:" << LWM::SYSTEM->WM_ICCCM_GetClass(win); } - QString wclass = LWM::SYSTEM->WM_ICCCM_GetClass(win); - if( wclass.contains("lumina-wm",Qt::CaseInsensitive) ){ return; } //just in case: prevent recursion - else{ - bool ok = (wclass.isEmpty() ? false : LWM::SYSTEM->WM_ManageWindow(win, requested) ); - if(!ok){ - //See if this window is just a transient pointing to some other window - WId tran = LWM::SYSTEM->WM_ICCCM_GetTransientFor(win); - if(tran!=win && tran!=0){ - win = tran; - ok = LWM::SYSTEM->WM_ManageWindow(win); - } - } - if(!ok){ return; } - } - if(DEBUG){ qDebug() << "New Managed Window:" << LWM::SYSTEM->WM_ICCCM_GetClass(win); } - LWM::SYSTEM->WM_Set_Active_Window(win); - LWindow *lwin = new LWindow(win); - connect(lwin, SIGNAL(Finished(WId)), this, SLOT(FinishedWindow(WId)) ); - WINS << lwin; - if(lwin->hasFrame()){ - lwin->frame()->windowChanged(LWM::Show); //Make sure to show it right away - }else{ - LWM::SYSTEM->WM_ShowWindow(win); //just map the window right now - } -} - -void LWindowManager::ClosedWindow(WId win){ - for(int i=0; i<WINS.length(); i++){ - if(WINS[i]->clientID()==win){ - qDebug() << " - Closed Window"; - if(WINS[i]->hasFrame()){ WINS[i]->frame()->windowChanged(LWM::Closed); } //do any animations/cleanup - else{ FinishedWindow(win); } - break; - } - } -} - -void LWindowManager::ModifyWindow(WId win, LWM::WindowAction act){ - for(int i=0; i<WINS.length(); i++){ - if(WINS[i]->clientID()==win){ - if(WINS[i]->hasFrame()){ WINS[i]->frame()->windowChanged(act); } - return; - } - } - //If it gets this far - it is an unmanaged window - if(act==LWM::Show){ - NewWindow(win); - } - RestackWindows(); -} - -void LWindowManager::RestackWindows(){ - Stack_Desktop.clear(); Stack_Below.clear(); Stack_Normal.clear(); Stack_Above.clear(); Stack_Fullscreen.clear(); - QList<WId> currwins; - int cwork = LWM::SYSTEM->WM_Get_Current_Desktop(); - int winwork = -1; - QList<LXCB::WINDOWSTATE> states; - QList<LXCB::WINDOWTYPE> types; - for(int i=0; i<WINS.length(); i++){ - //Only show windows on the current desktop - winwork = LWM::SYSTEM->WM_Get_Desktop(WINS[i]->clientID()); - states = LWM::SYSTEM->WM_Get_Window_States(WINS[i]->clientID()); - types = LWM::SYSTEM->WM_Get_Window_Type(WINS[i]->clientID()); - WId id = WINS[i]->clientID(); - if(WINS[i]->hasFrame()){ id = WINS[i]->frame()->winId(); } - if(winwork<0 || winwork == cwork || states.contains(LXCB::S_STICKY) ){ - //Now check the state/type and put it in the proper stack - currwins << WINS[i]->clientID(); //add this to the overall "age" list - //Now add it to the proper stack - if(types.contains(LXCB::T_DESKTOP)){ Stack_Desktop << id; } - else if(states.contains(LXCB::S_BELOW)){ Stack_Below << id; } - else if(types.contains(LXCB::T_DOCK) || states.contains(LXCB::S_ABOVE) ){ Stack_Above << id; } - else if(states.contains(LXCB::S_FULLSCREEN)){ Stack_Fullscreen << id; } - else{ Stack_Normal << id; } - } - } - //Active Window management - WId active = LWM::SYSTEM->WM_Get_Active_Window(); - if(Stack_Desktop.contains(active)){ Stack_Desktop.removeAll(active); Stack_Desktop << active; } - else if(Stack_Below.contains(active)){ Stack_Below.removeAll(active); Stack_Below << active; } - else if(Stack_Normal.contains(active)){ Stack_Normal.removeAll(active); Stack_Normal << active; } - else if(Stack_Above.contains(active)){ Stack_Above.removeAll(active); Stack_Above << active; } - else if(Stack_Fullscreen.contains(active)){ Stack_Fullscreen.removeAll(active); Stack_Fullscreen << active; } - - //Now set the root properties for these lists - LWM::SYSTEM->WM_Set_Client_List(currwins, false); //age-ordered version - LWM::SYSTEM->WM_Set_Client_List(QList<WId>() << Stack_Desktop << Stack_Below << Stack_Normal << Stack_Above << Stack_Fullscreen, true); //stacking order version - //Now re-paint (in order) the windows - RepaintWindows(); -} - -void LWindowManager::RepaintWindows(){ - //Go through all the current windows (in stacking order) and re-paint them - for(int i=0; i<Stack_Desktop.length(); i++){ - LWM::SYSTEM->WM_ShowWindow(Stack_Desktop[i]); - } - for(int i=0; i<Stack_Below.length(); i++){ - LWM::SYSTEM->WM_ShowWindow(Stack_Below[i]); - } - for(int i=0; i<Stack_Normal.length(); i++){ - LWM::SYSTEM->WM_ShowWindow(Stack_Normal[i]); - } - for(int i=0; i<Stack_Above.length(); i++){ - LWM::SYSTEM->WM_ShowWindow(Stack_Above[i]); - } - for(int i=0; i<Stack_Fullscreen.length(); i++){ - LWM::SYSTEM->WM_ShowWindow(Stack_Fullscreen[i]); - } -} - -//================= -// PRIVATE SLOTS -//================= -void LWindowManager::FinishedWindow(WId win){ - for(int i=0; i<WINS.length(); i++){ - if(WINS[i]->clientID() == win){ - qDebug() << " - Finished Window"; - if(win == LWM::SYSTEM->WM_Get_Active_Window()){ - if(i==0 && WINS.length()>1){ LWM::SYSTEM->WM_Set_Active_Window(WINS[i+1]->clientID()); } - else if(i>0){ LWM::SYSTEM->WM_Set_Active_Window(WINS[i-1]->clientID()); } - else{ LWM::SYSTEM->WM_Set_Active_Window( QX11Info::appRootWindow()); } - } - delete WINS.takeAt(i); break; - } - } - //Now update the list of clients - RestackWindows(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.h b/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.h deleted file mode 100644 index 203efa1b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/LWindowManager.h +++ /dev/null @@ -1,40 +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_WINDOW_MANAGER_MAIN_CLASS_H -#define _LUMINA_DESKTOP_WINDOW_MANAGER_MAIN_CLASS_H - -#include "GlobalDefines.h" -#include "LWindow.h" - -class LWindowManager : public QObject{ - Q_OBJECT -public: - LWindowManager(); - ~LWindowManager(); - - bool start(); - void stop(); - -private: - QList<LWindow*> WINS; - QList<WId> Stack_Desktop, Stack_Below, Stack_Normal, Stack_Above, Stack_Fullscreen; -public slots: - void NewWindow(WId win, bool requested = true); - void ClosedWindow(WId win); - void ModifyWindow(WId win, LWM::WindowAction act); - - void RestackWindows(); - void RepaintWindows(); - -private slots: - void FinishedWindow(WId win); //This is used for LWindow connections/animations - -signals: - void NewFullScreenWindows(QList<WId>); -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.cpp deleted file mode 100644 index 4a7c6e02..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.cpp +++ /dev/null @@ -1,62 +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 "WMSession.h" - -#define DEBUG 1 -// ========== -// PUBLIC -// ========== -WMSession::WMSession(){ - if(DEBUG){ qDebug() << "Creating Event Filter..."; } - EFILTER = new EventFilter(); - if(DEBUG){ qDebug() << "Creating Screen Saver..."; } - SS = new LScreenSaver(); - if(DEBUG){ qDebug() << "Creating Window Manager..."; } - WM = new LWindowManager(); - EVThread = new QThread(); - EFILTER->moveToThread(EVThread); - //Setup connections - connect(EFILTER, SIGNAL(NewInputEvent()), SS, SLOT(newInputEvent()) ); - connect(EFILTER, SIGNAL(NewManagedWindow(WId)), WM, SLOT(NewWindow(WId)) ); - connect(EFILTER, SIGNAL(WindowClosed(WId)), WM, SLOT(ClosedWindow(WId)) ); - connect(EFILTER, SIGNAL(ModifyWindow(WId, LWM::WindowAction)), WM, SLOT(ModifyWindow(WId,LWM::WindowAction)) ); - connect(SS, SIGNAL(StartingScreenSaver()), EFILTER, SLOT(StartedSS()) ); - connect(SS, SIGNAL(ClosingScreenSaver()), EFILTER, SLOT(StoppedSS()) ); - connect(WM, SIGNAL(NewFullScreenWindows(QList<WId>)), EFILTER, SLOT(FullScreenChanged(QList<WId>)) ); -} - -WMSession::~WMSession(){ -} - -void WMSession::start(bool SSONLY){ - //Get the screensaver initialized/ready - if(DEBUG){ qDebug() << "Starting Screen Saver..."; } - SS->start(); - if(SSONLY){ return; } - //Now start pulling/filtering events - if(DEBUG){ qDebug() << "Starting Window Manager..."; } - WM->start(); - if(DEBUG){ qDebug() << "Starting Event Filter..."; } - EVThread->start(); - EFILTER->start(); - if(DEBUG){ qDebug() << "Done Starting WM session..."; } -} - -// ========== -// Public Slots -// ========== -void WMSession::reloadIcons(){ - -} - -void WMSession::newInputsAvailable(QStringList inputs){ - for(int i=0; i<inputs.length(); i++){ - if(inputs[i]=="--lock-now" || inputs[i]=="--test-ss"){ - QTimer::singleShot(0,SS, SLOT(LockScreenNow()) ); - } - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.h b/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.h deleted file mode 100644 index 5b511326..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/WMSession.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_WINDOW_MANAGER_SESSION_H -#define _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H - -#include "GlobalDefines.h" - -#include "LScreenSaver.h" -#include "LXcbEventFilter.h" -#include "LWindowManager.h" - -class WMSession : public QObject{ - Q_OBJECT -public: - WMSession(); - ~WMSession(); - - void start(bool SSONLY = false); - -private: - //XCB Event Watcher - EventFilter *EFILTER; - //ScreenSaver - LScreenSaver *SS; - //Window Manager - LWindowManager *WM; - - QThread *EVThread; //X Event thread - -public slots: - void reloadIcons(); - void newInputsAvailable(QStringList); - -private slots: - -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/lumina-wm.pro b/src-qt5/core/lumina-desktop-unified/src-WM/lumina-wm.pro deleted file mode 100644 index 928f8744..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/lumina-wm.pro +++ /dev/null @@ -1,107 +0,0 @@ -include("$${PWD}/../../OS-detect.pri") - -QT += core gui network -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras - -TARGET = lumina-wm -target.path = $${L_BINDIR} - -LIBS += -lLuminaUtils -lxcb -lxcb-damage -lxcb-composite -lxcb-screensaver -lxcb-util - -DEPENDPATH += ../libLumina - -SOURCES += main.cpp \ - WMSession.cpp \ - LScreenSaver.cpp \ - SSBaseWidget.cpp \ - LLockScreen.cpp \ - LXcbEventFilter.cpp \ - LWindow.cpp \ - LWindowManager.cpp - - -HEADERS += GlobalDefines.h \ - WMSession.h \ - LScreenSaver.h \ - SSBaseWidget.h \ - LLockScreen.h \ - LXcbEventFilter.h \ - LWindow.h \ - LWindowManager.h - -FORMS += LLockScreen.ui - -#Now add in all the screensaver animation plugins -include(animations/animations.pri) - -TRANSLATIONS = i18n/lumina-wm_af.ts \ - i18n/lumina-wm_ar.ts \ - i18n/lumina-wm_az.ts \ - i18n/lumina-wm_bg.ts \ - i18n/lumina-wm_bn.ts \ - i18n/lumina-wm_bs.ts \ - i18n/lumina-wm_ca.ts \ - i18n/lumina-wm_cs.ts \ - i18n/lumina-wm_cy.ts \ - i18n/lumina-wm_da.ts \ - i18n/lumina-wm_de.ts \ - i18n/lumina-wm_el.ts \ - i18n/lumina-wm_en_GB.ts \ - i18n/lumina-wm_en_ZA.ts \ - i18n/lumina-wm_es.ts \ - i18n/lumina-wm_et.ts \ - i18n/lumina-wm_eu.ts \ - i18n/lumina-wm_fa.ts \ - i18n/lumina-wm_fi.ts \ - i18n/lumina-wm_fr.ts \ - i18n/lumina-wm_fr_CA.ts \ - i18n/lumina-wm_gl.ts \ - i18n/lumina-wm_he.ts \ - i18n/lumina-wm_hi.ts \ - i18n/lumina-wm_hr.ts \ - i18n/lumina-wm_hu.ts \ - i18n/lumina-wm_id.ts \ - i18n/lumina-wm_is.ts \ - i18n/lumina-wm_it.ts \ - i18n/lumina-wm_ja.ts \ - i18n/lumina-wm_ka.ts \ - i18n/lumina-wm_ko.ts \ - i18n/lumina-wm_lt.ts \ - i18n/lumina-wm_lv.ts \ - i18n/lumina-wm_mk.ts \ - i18n/lumina-wm_mn.ts \ - i18n/lumina-wm_ms.ts \ - i18n/lumina-wm_mt.ts \ - i18n/lumina-wm_nb.ts \ - i18n/lumina-wm_nl.ts \ - i18n/lumina-wm_pa.ts \ - i18n/lumina-wm_pl.ts \ - i18n/lumina-wm_pt.ts \ - i18n/lumina-wm_pt_BR.ts \ - i18n/lumina-wm_ro.ts \ - i18n/lumina-wm_ru.ts \ - i18n/lumina-wm_sk.ts \ - i18n/lumina-wm_sl.ts \ - i18n/lumina-wm_sr.ts \ - i18n/lumina-wm_sv.ts \ - i18n/lumina-wm_sw.ts \ - i18n/lumina-wm_ta.ts \ - i18n/lumina-wm_tg.ts \ - i18n/lumina-wm_th.ts \ - i18n/lumina-wm_tr.ts \ - i18n/lumina-wm_uk.ts \ - i18n/lumina-wm_uz.ts \ - i18n/lumina-wm_vi.ts \ - i18n/lumina-wm_zh_CN.ts \ - i18n/lumina-wm_zh_HK.ts \ - i18n/lumina-wm_zh_TW.ts \ - i18n/lumina-wm_zu.ts - -dotrans.path=$${L_SHAREDIR}/lumina-desktop/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/i18n/ - -INSTALLS += target - -WITH_I18N{ - INSTALLS += dotrans -} diff --git a/src-qt5/core/lumina-desktop-unified/src-WM/main.cpp b/src-qt5/core/lumina-desktop-unified/src-WM/main.cpp deleted file mode 100644 index 02e48b7b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-WM/main.cpp +++ /dev/null @@ -1,56 +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 "GlobalDefines.h" -//Initialize any global structures here -LXCB *LWM::SYSTEM = 0; - -//Local includes -#include "WMSession.h" -#include "LWindow.h" -#include <QDialog> - - -//#define DEBUG 0 -int main(int argc, char ** argv) -{ - qDebug() << "Starting lumina-wm..."; - LTHEME::LoadCustomEnvSettings(); - LSingleApplication a(argc, argv, "lumina-wm"); - if(!a.isPrimaryProcess()){ return 0; } //Inputs forwarded on to the primary already - LuminaThemeEngine themes(&a); - - //Setup the global structures - LWM::SYSTEM = new LXCB(); - if( a.inputlist.contains("--test-win") ){ - //Simple override to test out the window class - qDebug() << "Starting window test..."; - QLabel dlg(0, Qt::Window | Qt::BypassWindowManagerHint); //this test should be ignored by the current WM - dlg.setText("Sample Window"); - dlg.setWindowTitle("Test"); - dlg.resize(200,100); - dlg.setStyleSheet("background: rgba(255,255,255,100); color: black;"); - dlg.move(100,100); - dlg.show(); - //dlg.move(100,100); - qDebug() << " - Loading window frame..."; - LWindow win(dlg.winId()); //have it wrap around the dialog - qDebug() << " - Show frame..."; - win.frame()->windowChanged(LWM::Show); - qDebug() << " - Start event loop..."; - a.setQuitOnLastWindowClosed(true); - return a.exec(); - } - WMSession w; - w.start(a.inputlist.contains("--test-ss")); - QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) ); - QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(newInputsAvailable(QStringList)) ); - if(!a.inputlist.isEmpty()){ w.newInputsAvailable(a.inputlist); } - int retCode = a.exec(); - - return retCode; -} |