diff options
author | Ken Moore <ken@pcbsd.org> | 2014-12-18 07:47:48 -0500 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2014-12-18 07:47:48 -0500 |
commit | 71c2fda95224f0a04316c5f1059628d33564ca43 (patch) | |
tree | ca74dbe49dd2f555e73893e7f5f06154d6dab763 /lumina-desktop | |
parent | Oops, forgot to add knowledge of the new "Wine" app category to the userbutton. (diff) | |
download | lumina-71c2fda95224f0a04316c5f1059628d33564ca43.tar.gz lumina-71c2fda95224f0a04316c5f1059628d33564ca43.tar.bz2 lumina-71c2fda95224f0a04316c5f1059628d33564ca43.zip |
Commit a checkpoint on the conversion of Lumina to Qt5.
It is functional at the moment, but still has a few rough edges with regards to the X11 background interface (due to the move from XLib to XCB in Qt5). This reulst in some of the window manager interactions not behaving properly (such as sticky status on panels).
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 24 | ||||
-rw-r--r-- | lumina-desktop/LPanel.cpp | 14 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 95 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 24 | ||||
-rw-r--r-- | lumina-desktop/LWinInfo.h | 1 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 8 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 6 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/LPPlugin.h | 1 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/LTBWidget.h | 17 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 14 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.h | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp | 22 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp | 27 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | 14 |
16 files changed, 182 insertions, 91 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 9db4eac7..07225fad 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -11,6 +11,8 @@ #include <LuminaX11.h> #include "LWinInfo.h" +#define DEBUG 1 + LDesktop::LDesktop(int deskNum) : QObject(){ DPREFIX = "desktop-"+QString::number(deskNum)+"/"; @@ -103,9 +105,9 @@ void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ // ===================== void LDesktop::InitDesktop(){ //This is called *once* during the main initialization routines - qDebug() << "Init Desktop:" << desktopnumber; + if(DEBUG){ qDebug() << "Init Desktop:" << desktopnumber; } connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int))); - qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); + if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); } deskMenu = new QMenu(0); connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); winMenu = new QMenu(0); @@ -124,17 +126,20 @@ void LDesktop::InitDesktop(){ watcher->addPath(settings->fileName()); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) ); + if(DEBUG){ qDebug() << "Create bgWindow"; } bgWindow = new QWidget(); bgWindow->setObjectName("bgWindow"); bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); + bgWindow->setWindowFlags(Qt::FramelessWindowHint); LX11::SetAsDesktop(bgWindow->winId()); bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); + if(DEBUG){ qDebug() << "Create bgDesktop"; } bgDesktop = new QMdiArea(bgWindow); //Make sure the desktop area is transparent to show the background bgDesktop->setBackground( QBrush(Qt::NoBrush) ); bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" ); - qDebug() << " - Desktop Init Done:" << desktopnumber; + if(DEBUG){ qDebug() << " - Desktop Init Done:" << desktopnumber; } //Start the update processes QTimer::singleShot(10,this, SLOT(UpdateMenu()) ); QTimer::singleShot(0,this, SLOT(UpdateBackground()) ); @@ -155,10 +160,10 @@ void LDesktop::SettingsChanged(){ } void LDesktop::UpdateMenu(bool fast){ - //qDebug() << " - Update Menu:" << desktopnumber; + if(DEBUG){ qDebug() << " - Update Menu:" << desktopnumber; } //Put a label at the top int num = LX11::GetCurrentDesktop(); - //qDebug() << "Found desktop number:" << num; + if(DEBUG){ qDebug() << "Found workspace number:" << num; } if(num < 0){ workspacelabel->setText( "<b>"+tr("Lumina Desktop")+"</b>"); } else{ workspacelabel->setText( "<b>"+QString(tr("Workspace %1")).arg(QString::number(num+1))+"</b>"); } if(fast && usewinmenu){ UpdateWinMenu(); } @@ -216,7 +221,7 @@ void LDesktop::winClicked(QAction* act){ } void LDesktop::UpdateDesktop(){ - qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; + if(DEBUG){ qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; } if(deskupdating){ return; } //make sure to only run this once deskupdating = true; QStringList plugins = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList(); @@ -372,7 +377,7 @@ void LDesktop::DesktopPluginRemoved(QString ID){ } void LDesktop::UpdatePanels(){ - qDebug() << " - Update Panels For Screen:" << desktopnumber; + if(DEBUG){ qDebug() << " - Update Panels For Screen:" << desktopnumber; } int panels = settings->value(DPREFIX+"panels", -1).toInt(); if(panels==-1 && defaultdesktop){ panels=1; } //need at least 1 panel on the primary desktop //Remove all extra panels @@ -394,7 +399,7 @@ void LDesktop::UpdatePanels(){ } } if(!found){ - qDebug() << " -- Create panel "<< i; + if(DEBUG){ qDebug() << " -- Create panel "<< i; } //New panel LPanel *pan = new LPanel(settings, desktopnumber, i, bgWindow); PANELS << pan; @@ -412,6 +417,7 @@ void LDesktop::UpdateDesktopPluginArea(){ } //Now make sure the desktop plugin area is only the visible area QRect rec = visReg.boundingRect(); + //LSession::handle()->XCB->SetScreenWorkArea((unsigned int) desktopnumber, rec); //Now remove the X offset to place it on the current screen (needs widget-coords, not global) rec.moveTopLeft( QPoint( rec.x()-desktop->screenGeometry(desktopnumber).x() , rec.y() ) ); //qDebug() << "DPlug Area:" << rec.x() << rec.y() << rec.width() << rec.height(); @@ -426,7 +432,7 @@ void LDesktop::UpdateBackground(){ //Get the current Background if(bgupdating || bgWindow==0){ return; } //prevent multiple calls to this at the same time bgupdating = true; - qDebug() << " - Update Desktop Background for screen:" << desktopnumber; + if(DEBUG){ qDebug() << " - Update Desktop Background for screen:" << desktopnumber; } //Get the list of background(s) to show QStringList bgL = settings->value(DPREFIX+"background/filelist", QStringList()).toStringList(); //qDebug() << " - List:" << bgL << CBG; diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp index 138a8d77..afef1e13 100644 --- a/lumina-desktop/LPanel.cpp +++ b/lumina-desktop/LPanel.cpp @@ -34,12 +34,13 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); this->setFocusPolicy(Qt::NoFocus); this->setWindowTitle(""); - this->setAttribute(Qt::WA_X11NetWmWindowTypeDock); //Reserve as panel/dock + //this->setAttribute(Qt::WA_X11NetWmWindowTypeDock); //Reserve as panel/dock this->setAttribute(Qt::WA_AlwaysShowToolTips); this->setObjectName("LuminaPanelWidget"); panelArea->setObjectName("LuminaPanelPluginWidget"); - //LX11::SetAsPanel(this->winId()); //set proper type of window for a panel since Qt can't do it - LX11::SetAsSticky(this->winId()); + LX11::SetAsPanel(this->winId()); //set proper type of window for a panel since Qt can't do it + LSession::handle()->XCB->SetAsSticky(this->winId()); + //LX11::SetAsSticky(this->winId()); layout = new QBoxLayout(QBoxLayout::LeftToRight); layout->setContentsMargins(0,0,0,0); layout->setSpacing(1); @@ -86,7 +87,7 @@ void LPanel::UpdatePanel(){ this->setGeometry(xloc,0,xwid, ht ); if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), ht, "top"); } else{ - LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), 2, "top"); + LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), 2, "top"); hidepoint = QPoint(xloc, 2-ht); showpoint = QPoint(xloc, 0); this->move(hidepoint); //Could bleed over onto the screen above @@ -128,6 +129,9 @@ void LPanel::UpdatePanel(){ this->move(hidepoint); //Could bleed over onto the screen right } } + //With QT5, we need to make sure to reset window properties on occasion + LSession::handle()->XCB->SetAsSticky(this->winId()); + LX11::SetAsPanel(this->winId()); //Now update the appearance of the toolbar QString color = settings->value(PPREFIX+"color", "rgba(255,255,255,160)").toString(); QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 3px; border: 1px solid %1; }"; @@ -233,7 +237,7 @@ void LPanel::paintEvent(QPaintEvent *event){ //qDebug() << "Global Rec:" << rec.x() << rec.y() << screennum; rec.moveTo( rec.x()-screen->screenGeometry(screennum).x(), rec.y() ); //qDebug() << "Adjusted Global Rec:" << rec.x() << rec.y(); - painter->drawPixmap(event->rect(), QPixmap::grabWidget(bgWindow, rec) ); + painter->drawPixmap(event->rect(), bgWindow->grab(rec) ); QWidget::paintEvent(event); //now pass the event along to the normal painting event } diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index de3d9307..c8b98b22 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -8,6 +8,10 @@ #include <LuminaOS.h> #include <QTime> +#include "LXcbEventFilter.h" + +//LibLumina X11 class +#include <LuminaX11.h> //X includes (these need to be last due to Qt compile issues) #include <X11/Xlib.h> @@ -17,9 +21,11 @@ #include <X11/extensions/Xdamage.h> #ifndef DEBUG -#define DEBUG 0 +#define DEBUG 1 #endif +XCBEventFilter *evFilter = 0; + LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ this->setApplicationName("Lumina Desktop Environment"); this->setApplicationVersion("0.7.2"); @@ -33,14 +39,18 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ SystemTrayID = 0; VisualTrayID = 0; TrayDmgEvent = 0; TrayDmgError = 0; + XCB = 0; //initialize the empty internal pointers to 0 appmenu = 0; settingsmenu = 0; currTranslator=0; mediaObj=0; - audioOut=0; + //audioOut=0; audioThread=0; sessionsettings=0; + //Setup the event filter for Qt5 + evFilter = new XCBEventFilter(this); + this->installNativeEventFilter( evFilter ); } LSession::~LSession(){ @@ -53,13 +63,15 @@ LSession::~LSession(){ delete appmenu; delete currTranslator; if(mediaObj!=0){delete mediaObj;} - if(audioOut!=0){delete audioOut; } + //if(audioOut!=0){delete audioOut; } } void LSession::setupSession(){ qDebug() << "Initializing Session"; QTime* timer = 0; if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();} + //Initialize the XCB interface backend + XCB = new LXCB(); //Seed random number generator (if needed) qsrand( QTime::currentTime().msec() ); //Setup the QSettings default paths @@ -260,7 +272,7 @@ void LSession::SessionEnding(){ stopSystemTray(); } -bool LSession::x11EventFilter(XEvent *event){ +/*bool LSession::x11EventFilter(XEvent *event){ //Detect X Event types and send the appropriate signal(s) switch(event->type){ // ------------------------- @@ -335,7 +347,7 @@ bool LSession::x11EventFilter(XEvent *event){ // ----------------------- //Now continue on with the event handling (don't change it) return false; -} +}*/ //=============== // SYSTEM ACCESS @@ -368,23 +380,73 @@ void LSession::playAudioFile(QString filepath){ //Setup the audio output systems for the desktop //return; //Disable this for now: too many issues with Phonon at the moment (hangs the session) bool init = false; + if(DEBUG){ qDebug() << "Play Audio File"; } if(audioThread==0){ qDebug() << " - Initialize audio systems"; audioThread = new QThread(); init = true; } - if(mediaObj==0){ qDebug() << " - Initialize Phonon media Object"; mediaObj = new Phonon::MediaObject(); init = true;} - if(audioOut==0){ qDebug() << " - Initialize Phonon audio output"; audioOut = new Phonon::AudioOutput(); init=true;} - if(mediaObj && audioOut && init){ //in case Phonon errors for some reason - qDebug() << " -- Create path between audio objects"; - Phonon::createPath(mediaObj, audioOut); + //if(mediaObj==0){ qDebug() << " - Initialize Phonon media Object"; mediaObj = new Phonon::MediaObject(); init = true;} + if(mediaObj==0){ qDebug() << " - Initialize media player"; mediaObj = new QMediaPlayer(); init = true;} + //if(audioOut==0){ qDebug() << " - Initialize Phonon audio output"; audioOut = new Phonon::AudioOutput(); init=true;} + if(mediaObj && init){ //in case it errors for some reason + //qDebug() << " -- Create path between audio objects"; + //Phonon::createPath(mediaObj, audioOut); qDebug() << " -- Move audio objects to separate thread"; mediaObj->moveToThread(audioThread); - audioOut->moveToThread(audioThread); + //audioOut->moveToThread(audioThread); + audioThread->start(); } - if(mediaObj !=0 && audioOut!=0){ - mediaObj->setCurrentSource(QUrl(filepath)); + if(mediaObj !=0 ){//&& audioOut!=0){ + //mediaObj->setCurrentSource(QUrl(filepath)); + mediaObj->setMedia(QUrl::fromLocalFile(filepath)); + mediaObj->setVolume(100); mediaObj->play(); - audioThread->start(); + //audioThread->start(); } + if(DEBUG){ qDebug() << " - Done with Audio File"; } +} +// ======================= +// XCB EVENT FILTER FUNCTIONS +// ======================= +void LSession::WindowPropertyEvent(){ + if(DEBUG){ qDebug() << "Window Property Event"; } + LSession::restoreOverrideCursor(); //restore the mouse cursor back to normal (new window opened?) + emit WindowListEvent(); } +void LSession::SysTrayDockRequest(WId win){ + attachTrayWindow(win); //Check to see if the window is already registered +} + +void LSession::WindowClosedEvent(WId win){ + removeTrayWindow(win); //Check to see if the window is a tray app +} + +void LSession::WindowConfigureEvent(WId win){ + for(int i=0; i<RunningTrayApps.length(); i++){ + if(win==RunningTrayApps[i]){ + if(DEBUG){ qDebug() << "SysTray: Configure Event"; } + emit TrayIconChanged(RunningTrayApps[i]); //trigger a repaint event + break; + } + } +} + +void LSession::WindowDamageEvent(WId win){ + for(int i=0; i<RunningTrayApps.length(); i++){ + if(win==RunningTrayApps[i]){ + if(DEBUG){ qDebug() << "SysTray: Damage Event"; } + emit TrayIconChanged(RunningTrayApps[i]); //trigger a repaint event + break; + } + } +} + +void LSession::WindowSelectionClearEvent(WId win){ + if(win==SystemTrayID){ + qDebug() << "Stopping system tray"; + stopSystemTray(true); //make sure to detach all windows + } +} + + //====================== // SYSTEM TRAY FUNCTIONS //====================== @@ -422,7 +484,9 @@ void LSession::startSystemTray(){ if(SystemTrayID!=0){ XSelectInput(QX11Info::display(), SystemTrayID, InputOutput); //make sure TrayID events get forwarded here XDamageQueryExtension( QX11Info::display(), &TrayDmgEvent, &TrayDmgError); + evFilter->setTrayDamageFlag(TrayDmgEvent); qDebug() << "System Tray Started Successfully"; + if(DEBUG){ qDebug() << " - System Tray Flags:" << TrayDmgEvent << TrayDmgError; } } } @@ -445,6 +509,7 @@ void LSession::attachTrayWindow(WId win){ if(TrayStopping){ return; } if(RunningTrayApps.contains(win)){ return; } //already managed RunningTrayApps << win; + if(DEBUG){ qDebug() << "Tray List Changed"; } emit TrayListChanged(); /*//Now try to embed the window into the tray //(NOT USED - Breaks visuals due to X11 graphics constraints - need to do embed in a single visual tray instead) @@ -476,4 +541,4 @@ void LSession::removeTrayWindow(WId win){ break; } } -}
\ No newline at end of file +} diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index 1e773f74..68916a77 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -18,8 +18,7 @@ #include <QDesktopWidget> #include <QList> #include <QThread> -#include <Phonon/MediaObject> -#include <Phonon/AudioOutput> +#include <QMediaPlayer> #include <QThread> #include <QUrl> @@ -29,8 +28,8 @@ #include "SystemWindow.h" #include "LDesktop.h" #include "WMProcess.h" +//#include "LXcbEventFilter.h" -//LibLumina X11 class #include <LuminaX11.h> //SYSTEM TRAY STANDARD DEFINITIONS @@ -54,7 +53,7 @@ public: //Functions to be called during startup void setupSession(); - virtual bool x11EventFilter(XEvent *event); + //virtual bool x11EventFilter(XEvent *event); bool LoadLocale(QString); @@ -63,6 +62,15 @@ public: bool registerVisualTray(WId); void unregisterVisualTray(WId); + //Special functions for XCB event filter parsing only + // (DO NOT USE MANUALLY) + void WindowPropertyEvent(); + void SysTrayDockRequest(WId); + void WindowClosedEvent(WId); + void WindowConfigureEvent(WId); + void WindowDamageEvent(WId); + void WindowSelectionClearEvent(WId); + //System Access //Return a pointer to the current session static LSession* handle(){ @@ -74,7 +82,8 @@ public: AppMenu* applicationMenu(); void systemWindow(); SettingsMenu* settingsMenu(); - + LXCB *XCB; //class for XCB usage + QSettings* sessionSettings(); //Play System Audio @@ -84,13 +93,12 @@ private: WMProcess *WM; QList<LDesktop*> DESKTOPS; QFileSystemWatcher *watcher; - + //XCBEventFilter *evFilter; //Internal variable for global usage AppMenu *appmenu; SettingsMenu *settingsmenu; QTranslator *currTranslator; - Phonon::MediaObject *mediaObj; - Phonon::AudioOutput *audioOut; + QMediaPlayer *mediaObj; QThread *audioThread; QSettings *sessionsettings; diff --git a/lumina-desktop/LWinInfo.h b/lumina-desktop/LWinInfo.h index 750ab508..ae67499b 100644 --- a/lumina-desktop/LWinInfo.h +++ b/lumina-desktop/LWinInfo.h @@ -19,6 +19,7 @@ // Local includes #include "Globals.h" //For the STATES enumeration definition +//#include "LSession.h" class LWinInfo{ diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp index ae52378f..d3e1e10d 100644 --- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -11,7 +11,7 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID) vlay->setContentsMargins(3,3,3,3); frame = new QFrame(this); frame->setObjectName("notepadbase"); - frame->setStyleSheet("QFrame#notepadbase{border-size: 1px; background: rgba(255,255,255,50); color: black;} QFrame{ border: none; border-radius: 3px; background: rgba(255,255,255,100); color: black;}"); + frame->setStyleSheet("QFrame#notepadbase{border-width: 1px; background: rgba(255,255,255,50); color: black;} QFrame{ border: none; border-radius: 3px; background: rgba(255,255,255,100); color: black;}"); this->layout()->addWidget(frame); frame->setLayout(vlay); diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 8772b661..02581bdc 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -1,5 +1,6 @@ -QT += core gui network phonon +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia TARGET = Lumina-DE isEmpty(PREFIX) { @@ -7,7 +8,7 @@ isEmpty(PREFIX) { } target.path = $$PREFIX/bin -LIBS += -L../libLumina -lLuminaUtils -lXdamage -lX11 +LIBS += -L../libLumina -lLuminaUtils -lXdamage -lX11 -lxcb -lxcb-damage QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../libLumina @@ -16,7 +17,7 @@ TEMPLATE = app openbsd-g++4 { LRELEASE = lrelease4 } else { - LRELEASE = lrelease-qt4 + LRELEASE = /usr/local/lib/qt5/bin/lrelease } SOURCES += main.cpp \ @@ -47,6 +48,7 @@ SOURCES += main.cpp \ HEADERS += Globals.h \ WMProcess.h \ + LXcbEventFilter.h \ LSession.h \ LDesktop.h \ LPanel.h \ diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 884e9441..8305be60 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -23,10 +23,10 @@ #include <LuminaThemes.h> #include <LuminaOS.h> -#define DEBUG 0 +#define DEBUG 1 QFile logfile(QDir::homePath()+"/.lumina/logs/runtime.log"); -void MessageOutput(QtMsgType type, const char *msg){ +void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){ QString txt; switch(type){ case QtDebugMsg: @@ -76,7 +76,7 @@ int main(int argc, char ** argv) if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); } LuminaThemeEngine theme(&a); //Setup Log File - qInstallMsgHandler(MessageOutput); + qInstallMessageHandler(MessageOutput); if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); } a.setupSession(); if(DEBUG){ qDebug() << "Load Locale:" << timer->elapsed(); } diff --git a/lumina-desktop/panel-plugins/LPPlugin.h b/lumina-desktop/panel-plugins/LPPlugin.h index ae4e7fbc..c8347a8e 100644 --- a/lumina-desktop/panel-plugins/LPPlugin.h +++ b/lumina-desktop/panel-plugins/LPPlugin.h @@ -28,6 +28,7 @@ public: plugintype=ptype; this->setContentsMargins(0,0,0,0); this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + this->setFocusPolicy(Qt::NoFocus); //no keyboard focus on the panel/plugins if(horizontal){LY = new QBoxLayout(QBoxLayout::LeftToRight, this); } else{ LY = new QBoxLayout(QBoxLayout::TopToBottom, this); } LY->setContentsMargins(0,0,0,0); diff --git a/lumina-desktop/panel-plugins/LTBWidget.h b/lumina-desktop/panel-plugins/LTBWidget.h index 5252c619..7ca46d0d 100644 --- a/lumina-desktop/panel-plugins/LTBWidget.h +++ b/lumina-desktop/panel-plugins/LTBWidget.h @@ -12,20 +12,21 @@ #include <QWheelEvent> #include "Globals.h" +#include <LuminaX11.h> class LTBWidget : public QToolButton{ Q_OBJECT private: - Lumina::STATES cstate; + LXCB::WINDOWSTATE cstate; QString rawstyle; void updateBackground(){ QString background = "background: transparent; "; //default value QString border = "border: 1px solid transparent;"; - if(cstate == Lumina::NONE){ } //just use the defaults - else if(cstate == Lumina::VISIBLE){ background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 240), stop:0.505682 rgba(240, 240, 240, 150), stop:1 rgba(210, 210, 210, 55));"; border="border: 1px solid transparent;"; } - else if(cstate == Lumina::INVISIBLE){background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(215, 215, 215, 240), stop:0.505682 rgba(184, 185, 186, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } - else if(cstate == Lumina::ACTIVE){ background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(241, 233, 156, 240), stop:0.355682 rgba(255, 243, 127, 150), stop:1 rgba(221, 246, 255, 55));"; border ="border: 1px solid transparent;"; } - else if(cstate == Lumina::NOTIFICATION){ background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(252, 187, 127, 240), stop:0.505682 rgba(255, 222, 197, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } + if(cstate == LXCB::IGNORE){ } //just use the defaults + else if(cstate == LXCB::VISIBLE){ background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 240), stop:0.505682 rgba(240, 240, 240, 150), stop:1 rgba(210, 210, 210, 55));"; border="border: 1px solid transparent;"; } + else if(cstate == LXCB::INVISIBLE){background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(215, 215, 215, 240), stop:0.505682 rgba(184, 185, 186, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } + else if(cstate == LXCB::ACTIVE){ background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(241, 233, 156, 240), stop:0.355682 rgba(255, 243, 127, 150), stop:1 rgba(221, 246, 255, 55));"; border ="border: 1px solid transparent;"; } + else if(cstate == LXCB::ATTENTION){ background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(252, 187, 127, 240), stop:0.505682 rgba(255, 222, 197, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } QString raw = rawstyle; this->setStyleSheet( raw.replace("%1",background).replace("%2", border) ); } @@ -37,7 +38,7 @@ signals: public: LTBWidget(QWidget* parent) : QToolButton(parent){ //this->setStyleSheet( this->styleSheet()+" LTBWidget::menu-indicator{image: none;}"); - cstate = Lumina::NONE; + cstate = LXCB::IGNORE; this->setPopupMode(QToolButton::InstantPopup); this->setAutoRaise(true); @@ -48,7 +49,7 @@ public: ~LTBWidget(){ } - void setState(Lumina::STATES newstate){ + void setState(LXCB::WINDOWSTATE newstate){ cstate = newstate; updateBackground(); } diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index dacb7b55..1eafffee 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -53,7 +53,7 @@ void LSysTray::start(){ isRunning = LSession::handle()->registerVisualTray(this->winId()); qDebug() << "Visual Tray Started:" << this->type() << isRunning; if(isRunning){ - upTimer->start(); + //upTimer->start(); QTimer::singleShot(0,this, SLOT(checkAll()) ); } //Make sure we catch all events right away @@ -169,6 +169,7 @@ void LSysTray::checkAll(){ if(!isRunning || stopping || checking){ return; } //Don't check if not running at the moment checking = true; //qDebug() << "System Tray: Check tray apps"; + bool listChanged = false; QList<WId> wins = LSession::handle()->currentTrayApps(this->winId()); for(int i=0; i<trayIcons.length(); i++){ int index = wins.indexOf(trayIcons[i]->appID()); @@ -179,6 +180,7 @@ void LSysTray::checkAll(){ LI->removeWidget(cont); delete cont; i--; //List size changed + listChanged = true; //Re-adjust the maximum widget size to account for what is left if(this->layout()->direction()==QBoxLayout::LeftToRight){ this->setMaximumSize( trayIcons.length()*this->height(), 10000); @@ -217,9 +219,17 @@ void LSysTray::checkAll(){ LI->removeWidget(cont); delete cont; continue; - } + }else{ + listChanged = true; + } LI->update(); //make sure there is no blank space in the layout } + /*if(listChanged){ + //Icons got moved around: be sure to re-draw all of them to fix visuals + for(int i=0; i<trayIcons.length(); i++){ + trayIcons[i]->update(); + } + }*/ //qDebug() << " - System Tray: check done"; checking = false; } diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/lumina-desktop/panel-plugins/systemtray/LSysTray.h index f45a52ad..1b482ef7 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.h +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.h @@ -12,7 +12,7 @@ #include <QHBoxLayout> #include <QDebug> #include <QX11Info> -#include <QX11EmbedContainer> +//#include <QX11EmbedContainer> #include <QCoreApplication> //Local includes diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp index 64c7c77d..716a49ed 100644 --- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp +++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp @@ -6,11 +6,13 @@ //=========================================== #include "TrayIcon.h" -#include <X11/Xlib.h> -#include <X11/Xutil.h> +//#include <X11/Xlib.h> +//#include <X11/Xutil.h> #include <X11/extensions/Xdamage.h> -static Damage dmgID = 0; +//#include <xcb/damage.h> +//static xcb_damage_damage_t dmgID; +static int dmgID = 0; TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){ AID = 0; //nothing yet @@ -36,10 +38,10 @@ void TrayIcon::attachApp(WId id){ if( LX11::EmbedWindow(AID, IID) ){ LX11::RestoreWindow(AID); //make it visible //XSelectInput(QX11Info::display(), AID, StructureNotifyMask); + //xcb_damage_create(QX11Info::connection(), dmgID, AID, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); dmgID = XDamageCreate( QX11Info::display(), AID, XDamageReportRawRectangles ); - updateIcon(); qDebug() << "New System Tray App:" << AID; - QTimer::singleShot(500, this, SLOT(updateIcon()) ); + QTimer::singleShot(1000, this, SLOT(updateIcon()) ); }else{ qWarning() << "Could not Embed Tray Application:" << AID; //LX11::DestroyWindow(IID); @@ -64,9 +66,9 @@ void TrayIcon::detachApp(){ //Now detach the application window and clean up qDebug() << " - Unembed"; LX11::UnembedWindow(tmp); - if(dmgID!=0){ - XDamageDestroy(QX11Info::display(), dmgID); - } + //if(dmgID!=0){ + //XDamageDestroy(QX11Info::display(), dmgID); + //} qDebug() << " - finished app:" << tmp; //if(IID!=this->winId()){ LX11::DestroyWindow(IID); } IID = 0; @@ -98,6 +100,7 @@ void TrayIcon::updateIcon(){ //Make sure the icon is square QSize icosize = this->size(); LX11::ResizeWindow(AID, icosize.width(), icosize.height()); + QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment } // ============= @@ -115,7 +118,7 @@ void TrayIcon::paintEvent(QPaintEvent *event){ QPixmap pix = LX11::WindowImage(AID, false); if(pix.isNull()){ //Try to grab the window directly with Qt - //qDebug() << " - - Grab window directly"; + qDebug() << " - - Grab window directly"; pix = QPixmap::grabWindow(AID); } //qDebug() << " - Pix size:" << pix.size().width() << pix.size().height(); @@ -138,6 +141,7 @@ void TrayIcon::resizeEvent(QResizeEvent *event){ //qDebug() << "Resize Event:" << event->size().width() << event->size().height(); if(AID!=0){ LX11::ResizeWindow(AID, event->size().width(), event->size().height()); + QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment } } diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp index 6ea7854e..9dfc0979 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp @@ -5,6 +5,7 @@ // See the LICENSE file for full details //=========================================== #include "LTaskButton.h" +#include "LSession.h" LTaskButton::LTaskButton(QWidget *parent) : LTBWidget(parent){ actMenu = new QMenu(this); @@ -71,7 +72,7 @@ void LTaskButton::UpdateButton(){ LWINLIST = WINLIST; winMenu->clear(); - Lumina::STATES showstate = Lumina::NOSHOW; + LXCB::WINDOWSTATE showstate = LXCB::IGNORE; for(int i=0; i<WINLIST.length(); i++){ if(WINLIST[i].windowID() == 0){ WINLIST.removeAt(i); @@ -88,31 +89,19 @@ void LTaskButton::UpdateButton(){ if(cname.contains(" - ")){ cname = cname.section(" - ",-1); } } this->setToolTip(cname); - /* - if(this->icon().isNull()){ - this->setIcon( LXDG::findIcon(cname.toLower(),"") ); - if(this->icon().isNull()){ - this->setIcon( LXDG::findIcon("preferences-system-windows","") ); - noicon=true; - }else{ - noicon = false; - } - }else{ - noicon = false; - }*/ } bool junk; QAction *tmp = winMenu->addAction( WINLIST[i].icon(junk), WINLIST[i].text() ); tmp->setData(i); //save which number in the WINLIST this entry is for - Lumina::STATES stat = WINLIST[i].status(); - if(stat==Lumina::NOTIFICATION){ showstate = stat; } //highest priority - else if( stat==Lumina::ACTIVE && showstate != Lumina::NOTIFICATION){ showstate = stat; } //next priority - else if( stat==Lumina::Lumina::VISIBLE && showstate != Lumina::NOTIFICATION && showstate != Lumina::ACTIVE){ showstate = stat; } - else if(showstate == Lumina::INVISIBLE || showstate == Lumina::NOSHOW){ showstate = stat; } //anything is the same/better + LXCB::WINDOWSTATE stat = LSession::handle()->XCB->WindowState(WINLIST[i].windowID()); + if(stat==LXCB::ATTENTION){ showstate = stat; } //highest priority + else if( stat==LXCB::ACTIVE && showstate != LXCB::ATTENTION){ showstate = stat; } //next priority + else if( stat==LXCB::VISIBLE && showstate != LXCB::ATTENTION && showstate != LXCB::ACTIVE){ showstate = stat; } + else if(showstate == LXCB::INVISIBLE || showstate == LXCB::IGNORE){ showstate = stat; } //anything is the same/better } //Now setup the button appropriately // - visibility - if(showstate == Lumina::NOSHOW || WINLIST.length() < 1){ this->setVisible(false); } + if(showstate == LXCB::IGNORE || WINLIST.length() < 1){ this->setVisible(false); } else{ this->setVisible(true); } // - functionality if(WINLIST.length() == 1){ diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp index 674c9088..8f131c9e 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp @@ -31,7 +31,7 @@ void LTaskManagerPlugin::UpdateButtons(){ //Make sure this only runs one at a time updating=true; //Get the current window list - QList<WId> winlist = LX11::WindowList(); + QList<WId> winlist = LSession::handle()->XCB->WindowList(); //qDebug() << "Update Buttons:" << winlist; //Now go through all the current buttons first for(int i=0; i<BUTTONS.length(); i++){ diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 7a1983d2..9bfbbb8d 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -13,24 +13,24 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir, bo bool ok = false; XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok); if(ok){ - icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(30,30) ); + icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, 180) ); }else{ - icon->setPixmap( LXDG::findIcon("unknown","").pixmap(30,30) ); + icon->setPixmap( LXDG::findIcon("unknown","").pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) ); } }else if(isDir){ if(itemPath.endsWith("/")){ itemPath.chop(1); } if(goback){ - icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(30,30) ); + icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(32,32) ); name->setText( tr("Go Back") ); }else{ - icon->setPixmap( LXDG::findIcon("folder","").pixmap(30,30) ); + icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) ); } }else{ if(itemPath.endsWith("/")){ itemPath.chop(1); } - icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1).section(".",-1)).pixmap(30,30) ); + icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1).section(".",-1)).pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) ); } linkPath = QFile::symLinkTarget(itemPath); @@ -48,7 +48,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent linkPath = QFile::symLinkTarget(item.filePath); isShortcut = item.filePath.contains("/home/") && (item.filePath.contains("/Desktop/") || item.filePath.contains("/.lumina/favorites/") ); //Now fill it appropriately - icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(30,30) ); + icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(32,32) ); name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, 180) ); icon->setWhatsThis(item.filePath); //Now setup the button appropriately @@ -70,7 +70,7 @@ void UserItemWidget::createWidget(){ button->setIconSize( QSize(14,14) ); button->setAutoRaise(true); icon = new QLabel(this); - icon->setFixedSize( QSize(30,30) ); + icon->setFixedSize( QSize(34,34) ); name = new QLabel(this); //Add them to the layout this->setLayout(new QHBoxLayout()); |