diff options
author | Ken Moore <moorekou@gmail.com> | 2015-09-04 09:29:29 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-09-04 09:29:29 -0400 |
commit | e75014ec60c937d42f09852d7d0e833f96ee7093 (patch) | |
tree | a4d1ee2df38b61b8c0ccd6aa79de304d4c3f2884 | |
parent | Clean out all the old XLib functions which were commented out, and start addi... (diff) | |
download | lumina-e75014ec60c937d42f09852d7d0e833f96ee7093.tar.gz lumina-e75014ec60c937d42f09852d7d0e833f96ee7093.tar.bz2 lumina-e75014ec60c937d42f09852d7d0e833f96ee7093.zip |
Commit some more work on lumina-wm:
1) The LWindow class seems to function properly for embedding/controlling a window now.
2) Add a "testwin" CLI flag to simply run a text of the window class (with a sample window). This allows testing without having to stop the currently running WM.
3) Setup the XCB access class so it is globally accessible to the individual classes in the WM (no need to constantly be passing the structure around).
4) Already include built-in support for simple window animations/effects (3-lines per effect is all that is needed). Will need to define animation flags/settings for use later, probably with an abstracted function to "performAnimation(type, size)"
-rw-r--r-- | lumina-wm-INCOMPLETE/GlobalDefines.h | 64 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LWindow.cpp | 325 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LWindow.h | 40 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LXcbEventFilter.cpp | 1 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LXcbEventFilter.h | 43 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/WMSession.cpp | 1 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/WMSession.h | 3 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/lumina-wm.pro | 9 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/main.cpp | 38 |
9 files changed, 445 insertions, 79 deletions
diff --git a/lumina-wm-INCOMPLETE/GlobalDefines.h b/lumina-wm-INCOMPLETE/GlobalDefines.h new file mode 100644 index 00000000..f78f9cbd --- /dev/null +++ b/lumina-wm-INCOMPLETE/GlobalDefines.h @@ -0,0 +1,64 @@ +//=========================================== +// 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 <QWindow> +#include <QBackingStore> + +// 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 100 //animation time in milliseconds +//Global flags/structures +namespace LWM{ + //Flags/enumerations + enum WindowAction{MoveResize, Show, Hide, TryClose, Closed}; + + //Data structures + extern LXCB *SYSTEM; +}; + + + +#endif
\ No newline at end of file diff --git a/lumina-wm-INCOMPLETE/LWindow.cpp b/lumina-wm-INCOMPLETE/LWindow.cpp index 3d15393d..d6ad188c 100644 --- a/lumina-wm-INCOMPLETE/LWindow.cpp +++ b/lumina-wm-INCOMPLETE/LWindow.cpp @@ -8,11 +8,22 @@ LWindow::LWindow(WId client) : QFrame(){ activeState = LWindow::Normal; + CID = client; + qDebug() << "New Window:" << CID << "Frame:" << this->winId(); this->setMouseTracking(true); //need this to determine mouse location when not clicked this->setObjectName("LWindowFrame"); - this->setWindowFlags(Qt::Window | Qt::X11BypassWindowManagerHint); //ensure that this frame does not get a frame itself + this->setStyleSheet("LWindow#LWindowFrame{ border: 2px solid white; border-radius:3px; } QWidget#TitleBar{background: grey; } QLabel{ color: black; }"); + //this->setAttribute(Qt::WA_TranslucentBackground, true); + //this->setAttribute(Qt::WA_StyledBackground, true); + this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); //Qt::X11BypassWindowManagerHint); //ensure that this frame does not get a frame itself InitWindow(); //initially create all the child widgets updateAppearance(); //this loads the appearance based on window/theme settings + QApplication::processEvents(); + //Now set the frame size on this window + SyncSize(); + SyncText(); + //LWM::SYSTEM->RestoreWindow(CID); + this->show(); } LWindow::~LWindow(){ @@ -31,75 +42,359 @@ bool LWindow::hasFrame(){ return this->isEnabled(); } // PRIVATE // ================= void LWindow::InitWindow(){ + anim = new QPropertyAnimation(this); //For simple window animations + anim->setTargetObject(this); + anim->setDuration(ANIMTIME); //In milliseconds titleBar = new QLabel(this); //This is the "container" for all the title buttons/widgets titleBar->setObjectName("TitleBar"); + titleBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); title = new QLabel(this); //Shows the window title/text title->setObjectName("Title"); - title->setCursor(Qt::SizeAllCursor); + title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + title->setCursor(Qt::ArrowCursor); icon = new QLabel(this); //Contains the window icon icon->setObjectName("Icon"); + icon->setCursor(Qt::ArrowCursor); minB = new QToolButton(this); //Minimize Button minB->setObjectName("Minimize"); + minB->setCursor(Qt::ArrowCursor); connect(minB, SIGNAL(clicked()), this, SLOT(minClicked()) ); maxB = new QToolButton(this); //Maximize Button maxB->setObjectName("Maximize"); + maxB->setCursor(Qt::ArrowCursor); connect(maxB, SIGNAL(clicked()), this, SLOT(maxClicked()) ); closeB = new QToolButton(this); closeB->setObjectName("Close"); + closeB->setCursor(Qt::ArrowCursor); connect(closeB, SIGNAL(clicked()), this, SLOT(closeClicked()) ); otherB = new QToolButton(this); //Button to place any other actions otherB->setObjectName("Options"); - otherB->setToolButtonPopupMode(QToolButton::InstantPopup); + otherB->setCursor(Qt::ArrowCursor); + otherB->setPopupMode(QToolButton::InstantPopup); + otherB->setStyleSheet("QToolButton::menu-indicator{ image: none; }"); 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); + VL->addWidget(titleBar); + VL->setAlignment(titleBar, Qt::AlignTop); + VL->setContentsMargins(0,0,0,0); + VL->setSpacing(0); + //Now embed the native window into the frame + WIN = QWindow::fromWinId(CID); + //WINBACK = new QBackingStore(WIN); //create a data backup for the widget + this->layout()->addWidget( QWidget::createWindowContainer( WIN, this) ); + //this->layout()-> //set the container as expanding + VL->setStretch(1,1); } -ModStatus LWindow::getStateAtPoint(QPoint pt){ +LWindow::ModState LWindow::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() < this->height()/3){ + //One of the top options + if(pt.x() < this->width()/3){ + if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner + return ResizeTopLeft; + }else if(pt.x() > (2*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() > (2*this->height())/3){ + //One of the bottom options + if(pt.x() < this->width()/3){ + if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner + return ResizeBottomLeft; + }else if(pt.x() > (2*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() < this->width()/2){ + if(setoffset){ offset.setX(pt.x()); offset.setY(0); } //difference from left edge (Y does not matter) + return ResizeLeft; + }else{ + if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(0); } //difference from right edge (Y does not matter) + return ResizeRight; + } + } + } + return Normal; +} +void LWindow::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); + } } -void LWindow::setMouseCursor(ModStatus state){ - +// ========================== +// WINDOW INTERACTIONS +//========================== +void LWindow::SyncSize(){ + //sync the window/frame geometries (generally only done before embedding the client window) + int frame = this->frameWidth(); + int TH = titleBar->height(); + //SYSTEM->SetFrameValues(CID, frame, frame, frame, frame); + //Now load the information about the window and adjust the frame to match + lastGeom = LWM::SYSTEM->WindowGeometry(CID,false); + 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)); + 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); } +void LWindow::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); } + title->setText(txt); +} + +// SIMPLE ANIMATIONS +void LWindow::showAnimation(LWM::WindowAction act){ + bool useanimation = true; //placeholder for the actual setting check + //Setup the animation routine + if(act==LWM::Show){ + if(useanimation){ + if(lastGeom.isEmpty()){ lastGeom = this->geometry(); } //such as for a first showing + //Expand out from center point + anim->setPropertyName("geometry"); + anim->setStartValue( QRect(lastGeom.center(), QSize(0,0) ) ); + anim->setEndValue( QRect(lastGeom) ); + //Fade in gradually + //anim->setPropertyName("windowOpacity"); + //anim->setStartValue( 0.0 ); + //anim->setEndValue( 1.0 ); + }else{ + 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; + //WIN->destroy(); //clean up any data + if(this->layout()->count()>1){ delete this->layout()->takeAt(1); } + 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{ + this->close(); //just hide it right away + } + } + if(useanimation){ + this->show(); + anim->start(); + //Also set any final values + if(act==LWM::Hide){ QTimer::singleShot(ANIMTIME, this, SLOT(hide()) ); } + if(act==LWM::Closed){ QTimer::singleShot(ANIMTIME, this, SLOT(close()) ); } + }; +} // ================= // PUBLIC SLOTS // ================= void LWindow::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 LWindow::windowChanged(LWM::WindowAction act){ + //A window property was changed - update accordingly + switch(act){ + case LWM::Hide: + case LWM::Show: + case LWM::Closed: + showAnimation(act); + break; + case LWM::MoveResize: + //Re-adjust to the new position/size of the window + + break; + } +} // ================= // PRIVATE SLOTS // ================= void LWindow::closeClicked(){ - + qDebug() << "Closing Window"; + //First try the close event to let the client app do cleanup/etc + WIN->hide(); + LWM::SYSTEM->WM_CloseWindow(CID); + showAnimation(LWM::Closed); //temporary testing line - should be run after destroy event automatically later } void LWindow::minClicked(){ - + qDebug() << "Minimize Window"; + this->showMinimized(); } void LWindow::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 LWindow::otherClicked(QAction* act){ - + QString action = act->whatsThis(); } // ===================== // PROTECTED // ===================== void LWindow::mousePressEvent(QMouseEvent *ev){ - + qDebug() << "Mouse Press Event"; + offset.setX(0); offset.setY(0); + if(activeState != Normal){ return; } // do nothing - already in a state of grabbed mouse + 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 LWindow::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; + } + this->setGeometry(geom); + } } void LWindow::mouseReleaseEvent(QMouseEvent *ev){ - -} + //Check for a right-click 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()) ); +}
\ No newline at end of file diff --git a/lumina-wm-INCOMPLETE/LWindow.h b/lumina-wm-INCOMPLETE/LWindow.h index af5a8054..61345736 100644 --- a/lumina-wm-INCOMPLETE/LWindow.h +++ b/lumina-wm-INCOMPLETE/LWindow.h @@ -4,16 +4,10 @@ // 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 +#ifndef _LUMINA_DESKTOP_WINDOW_FRAME_H +#define _LUMINA_DESKTOP_WINDOW_FRAME_H -#include <QFrame> -#include <QLabel> -#include <QToolButton> -#include <QMenu> -#include <QMouseEvent> -#include <QAction> -#include <QPoint> +#include "GlobalDefines.h" class LWindow : public QFrame{ Q_OBJECT @@ -28,25 +22,35 @@ private: void InitWindow(); //Initialize all the internal widgets //Window status - enum ModStatus{Normal, Move, ResizeTop, ResizeTopRight, ResizeRight, ResizeBottomRight, ResizeBottom, ResizeBottomLeft, ResizeLeft, ResizeTopLeft}; - ModStatus activeState; + 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 - ModStatus getStateAtPoint(QPoint); //generally used for mouse location detection - void setMouseCursor(ModStatus); //Update the mouse cursor based on 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 + //General Properties/Modifications WId CID; //Client ID + QWindow *WIN; //Embedded window container + //QBackingStore *WINBACK; + void SyncSize(); //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); + public slots: - //These slots are generally used for the outside event watcher to + //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 propertiesChanged(); - void + void windowChanged(LWM::WindowAction); private slots: void closeClicked(); diff --git a/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp b/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp index 90b20c6d..00639a27 100644 --- a/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp +++ b/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp @@ -56,7 +56,6 @@ void EventFilter::start(){ //Constructor for the XCB event filter XCBEventFilter::XCBEventFilter(EventFilter *parent) : QAbstractNativeEventFilter(){ obj = parent; - XCB = new LXCB(); InitAtoms(); } diff --git a/lumina-wm-INCOMPLETE/LXcbEventFilter.h b/lumina-wm-INCOMPLETE/LXcbEventFilter.h index 4b2516e7..86e77939 100644 --- a/lumina-wm-INCOMPLETE/LXcbEventFilter.h +++ b/lumina-wm-INCOMPLETE/LXcbEventFilter.h @@ -9,19 +9,8 @@ #ifndef _LUMINA_DESKTOP_XCB_FILTER_H #define _LUMINA_DESKTOP_XCB_FILTER_H -#include <QAbstractNativeEventFilter> -#include <QList> -#include <QStringList> -#include <QX11Info> -#include <QCoreApplication> +#include "GlobalDefines.h" -#include <LuminaX11.h> - -#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 /* List of XCB response types (since almost impossible to find good docs on XCB) @@ -108,29 +97,29 @@ public: virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE; private: - LXCB *XCB; + //LXCB *XCB; 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 in XCB->EWMH + //NOTE: All the EWMH atoms are already saved globally in LWM::SYSTEM->EWMH WinNotifyAtoms.clear(); - WinNotifyAtoms << XCB->EWMH._NET_WM_NAME \ - << XCB->EWMH._NET_WM_VISIBLE_NAME \ - << XCB->EWMH._NET_WM_ICON_NAME \ - << XCB->EWMH._NET_WM_VISIBLE_ICON_NAME \ - << XCB->EWMH._NET_WM_ICON \ - << XCB->EWMH._NET_WM_ICON_GEOMETRY; + 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 << XCB->EWMH._NET_CLIENT_LIST \ - << XCB->EWMH._NET_CLIENT_LIST_STACKING \ - << XCB->EWMH._NET_CURRENT_DESKTOP \ - << XCB->EWMH._NET_WM_STATE \ - << XCB->EWMH._NET_ACTIVE_WINDOW \ - << XCB->EWMH._NET_WM_ICON \ - << XCB->EWMH._NET_WM_ICON_GEOMETRY; + 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; } diff --git a/lumina-wm-INCOMPLETE/WMSession.cpp b/lumina-wm-INCOMPLETE/WMSession.cpp index 5f88ea5b..b9011d8c 100644 --- a/lumina-wm-INCOMPLETE/WMSession.cpp +++ b/lumina-wm-INCOMPLETE/WMSession.cpp @@ -18,7 +18,6 @@ WMSession::WMSession(){ } WMSession::~WMSession(){ - } void WMSession::start(){ diff --git a/lumina-wm-INCOMPLETE/WMSession.h b/lumina-wm-INCOMPLETE/WMSession.h index 4bb94b1d..d90bafea 100644 --- a/lumina-wm-INCOMPLETE/WMSession.h +++ b/lumina-wm-INCOMPLETE/WMSession.h @@ -7,8 +7,7 @@ #ifndef _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H #define _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H -#include <QObject> -#include <QStringList> +#include "GlobalDefines.h" #include "LScreenSaver.h" #include "LXcbEventFilter.h" diff --git a/lumina-wm-INCOMPLETE/lumina-wm.pro b/lumina-wm-INCOMPLETE/lumina-wm.pro index df82e69b..bba49cdc 100644 --- a/lumina-wm-INCOMPLETE/lumina-wm.pro +++ b/lumina-wm-INCOMPLETE/lumina-wm.pro @@ -28,12 +28,15 @@ LRELEASE = $$QT5LIBDIR/bin/lrelease SOURCES += main.cpp \ WMSession.cpp \ LScreenSaver.cpp \ - LXcbEventFilter.cpp + LXcbEventFilter.cpp \ + LWindow.cpp -HEADERS += WMSession.h \ +HEADERS += GlobalDefines.h \ + WMSession.h \ LScreenSaver.h \ - LXcbEventFilter.h + LXcbEventFilter.h \ + LWindow.h FORMS += diff --git a/lumina-wm-INCOMPLETE/main.cpp b/lumina-wm-INCOMPLETE/main.cpp index 95771cca..e4eee4ee 100644 --- a/lumina-wm-INCOMPLETE/main.cpp +++ b/lumina-wm-INCOMPLETE/main.cpp @@ -4,25 +4,21 @@ // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== -#include <QDebug> - -#include <QFile> -#include <QDir> -#include <QString> -#include <QTextStream> -#include <QUrl> +#include "GlobalDefines.h" +//Initialize any global structures here +LXCB *LWM::SYSTEM = 0; +//Local includes #include "WMSession.h" +#include "LWindow.h" +#include <QDialog> -#include <LuminaXDG.h> //from libLuminaUtils -#include <LuminaThemes.h> -#include <LuminaSingleApplication.h> //#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 @@ -30,7 +26,25 @@ int main(int argc, char ** argv) //Setup the special settings prefix location QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); - + //Setup the global structures + LWM::SYSTEM = new LXCB(); + if(argc>1 && QString::fromLocal8Bit(argv[1])=="testwin"){ + //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.setGeometry(100,100,200,100); + dlg.setStyleSheet("background: rgba(255,255,255,100); color: black;"); + dlg.show(); + qDebug() << " - Loading window frame..."; + LWindow win(dlg.winId()); //have it wrap around the dialog + qDebug() << " - Show frame..."; + win.windowChanged(LWM::Show); + qDebug() << " - Start event loop..."; + a.setQuitOnLastWindowClosed(true); + return a.exec(); + } WMSession w; w.start(); QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) ); |