diff options
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 43 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.h | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.cpp | 48 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.h | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktopBackground.cpp | 42 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktopBackground.h | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp | 40 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktopPluginSpace.h | 20 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LPanel.cpp | 19 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 2 |
12 files changed, 161 insertions, 64 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index ecaa83d2..3708af6d 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -531,6 +531,49 @@ uint LXCB::GenerateDamageID(WId win){ return ( (uint) dmgID ); } +// === paintRoot() === +void LXCB::paintRoot(QRect area, const QPixmap *pix){ + //Generate a graphics context for this paint + xcb_gcontext_t gc = xcb_generate_id(QX11Info::connection()); + xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(QX11Info::connection())).data; + uint32_t values[1]; + values[0] = screen->black_pixel; + + xcb_create_gc(QX11Info::connection(), + gc, + screen->root, + XCB_GC_BACKGROUND, + values ); + //Convert the QPixmap to a xcb_drawable_t + QImage qimage = pix->toImage().convertToFormat(QImage::Format_ARGB32); + xcb_image_t *image = xcb_image_create(pix->width(), pix->height(), XCB_IMAGE_FORMAT_XY_PIXMAP, + 32, qimage.depth(), 32, 32, XCB_IMAGE_ORDER_LSB_FIRST, XCB_IMAGE_ORDER_LSB_FIRST, + 0, qimage.byteCount(), qimage.bits()); + + + //Now paint on the root window + xcb_image_put(QX11Info::connection(), + screen->root, //where to put it + gc, + image, + area.x(), + area.y(), + 0); + /*xcb_copy_area(QX11Info::connection(), + //static_cast<xcb_drawable_t>( pix.handle() ) , //image to copy + *image, + screen->root, //where to put it + gc, //graphics context for destination + 0, //x origin of picture + 0, // y origin of picture + area.x(), //x origin of where to place it + area.y(), //y origin of where to place it + area.width(), + area.height() );*/ + //Apply the change right now + xcb_flush(QX11Info::connection()); + xcb_image_destroy(image); +} // === SetAsSticky() === void LXCB::SetAsSticky(WId win){ diff --git a/src-qt5/core/libLumina/LuminaX11.h b/src-qt5/core/libLumina/LuminaX11.h index b7310abd..7b6cce3c 100644 --- a/src-qt5/core/libLumina/LuminaX11.h +++ b/src-qt5/core/libLumina/LuminaX11.h @@ -133,6 +133,7 @@ public: // - SubStructure simplifications (not commonly used) void SelectInput(WId win, bool isEmbed = false); //XSelectInput replacement (to see window events) uint GenerateDamageID(WId); + void paintRoot(QRect area, const QPixmap *pix); // - General Window Modifications void SetAsSticky(WId); //Stick to all workspaces diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index 8258dbb6..8b1bd825 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -30,7 +30,7 @@ LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ settings = new QSettings(QSettings::UserScope, "lumina-desktop","desktopsettings", this); //qDebug() << " - Desktop Settings File:" << settings->fileName(); if(!QFile::exists(settings->fileName())){ settings->setValue(DPREFIX+"background/filelist",QStringList()<<"default"); settings->sync(); } - bgWindow = 0; + //bgWindow = 0; bgDesktop = 0; QTimer::singleShot(1,this, SLOT(InitDesktop()) ); @@ -39,7 +39,7 @@ LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ LDesktop::~LDesktop(){ delete deskMenu; delete winMenu; - delete bgWindow; + //delete bgWindow; delete workspacelabel; delete wkspaceact; } @@ -49,13 +49,13 @@ int LDesktop::Screen(){ } void LDesktop::show(){ - if(bgWindow!=0){ bgWindow->show(); } + //if(bgWindow!=0){ bgWindow->show(); } if(bgDesktop!=0){ bgDesktop->show(); } for(int i=0; i<PANELS.length(); i++){ PANELS[i]->show(); } } void LDesktop::hide(){ - if(bgWindow!=0){ bgWindow->hide(); } + //if(bgWindow!=0){ bgWindow->hide(); } if(bgDesktop!=0){ bgDesktop->hide(); } for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); } } @@ -71,7 +71,7 @@ void LDesktop::prepareToClose(){ } WId LDesktop::backgroundID(){ - if(bgWindow!=0){ return bgWindow->winId(); } + if(bgDesktop!=0){ return bgDesktop->winId(); } else{ return QX11Info::appRootWindow(); } } @@ -90,7 +90,7 @@ void LDesktop::UpdateGeometry(){ //Now update the screen // NOTE: This functionality is highly event-driven based on X changes - so we need to keep things in order (no signals/slots) //qDebug() << "Changing Desktop Geom:" << desktopnumber; - bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); + //bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); //qDebug() << " - Update Desktop Plugin Area"; UpdateDesktopPluginArea(); //qDebug() << " - Done With Desktop Geom Updates"; @@ -213,25 +213,28 @@ void LDesktop::InitDesktop(){ connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) ); connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(UpdateBackground()) ); - if(DEBUG){ qDebug() << "Create bgWindow"; } - bgWindow = new LDesktopBackground(); + //if(DEBUG){ qDebug() << "Create bgWindow"; } + /*bgWindow = new QWidget(); //LDesktopBackground(); bgWindow->setObjectName("bgWindow"); bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); bgWindow->setFocusPolicy(Qt::StrongFocus); bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); LSession::handle()->XCB->SetAsDesktop(bgWindow->winId()); bgWindow->setGeometry(LSession::handle()->screenGeom(desktopnumber)); - connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); + bgWindow->setWindowOpacity(0.0); + connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );*/ if(DEBUG){ qDebug() << "Create bgDesktop"; } - bgDesktop = new LDesktopPluginSpace(bgWindow); //new QMdiArea(bgWindow); + bgDesktop = new LDesktopPluginSpace(); int grid = settings->value(DPREFIX+"GridSize",-1).toInt(); - if(grid<0 && bgWindow->height() > 2000){ grid = 200; } + if(grid<0 &&desktop->screenGeometry(desktopnumber).height() > 2000){ grid = 200; } else if(grid<0){ grid = 100; } bgDesktop->SetIconSize( grid ); + bgDesktop->setContextMenuPolicy(Qt::CustomContextMenu); connect(bgDesktop, SIGNAL(PluginRemovedByUser(QString)), this, SLOT(RemoveDeskPlugin(QString)) ); connect(bgDesktop, SIGNAL(IncreaseIcons()), this, SLOT(IncreaseDesktopPluginIcons()) ); connect(bgDesktop, SIGNAL(DecreaseIcons()), this, SLOT(DecreaseDesktopPluginIcons()) ); connect(bgDesktop, SIGNAL(HideDesktopMenu()), deskMenu, SLOT(hide())); + connect(bgDesktop, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); if(DEBUG){ qDebug() << " - Desktop Init Done:" << desktopnumber; } //Start the update processes QTimer::singleShot(10,this, SLOT(UpdateMenu()) ); @@ -376,7 +379,7 @@ void LDesktop::RemoveDeskPlugin(QString ID){ void LDesktop::IncreaseDesktopPluginIcons(){ int cur = settings->value(DPREFIX+"GridSize",-1).toInt(); - if(cur<0 && bgWindow->height() > 2000){ cur = 200; } + if(cur<0 && desktop->screenGeometry(desktopnumber).height() > 2000){ cur = 200; } else if(cur<0){ cur = 100; } cur+=16; issyncing=true; //don't let the change cause a refresh @@ -388,7 +391,7 @@ void LDesktop::IncreaseDesktopPluginIcons(){ void LDesktop::DecreaseDesktopPluginIcons(){ int cur = settings->value(DPREFIX+"GridSize",-1).toInt(); - if(cur<0 && bgWindow->height() > 2000){ cur = 200; } + if(cur<0 && desktop->screenGeometry(desktopnumber).height() > 2000){ cur = 200; } else if(cur<0){ cur = 100; } if(cur<32){ return; } //cannot get smaller than 16x16 cur-=16; @@ -426,7 +429,7 @@ void LDesktop::UpdatePanels(){ if(!found){ if(DEBUG){ qDebug() << " -- Create panel "<< i; } //New panel - LPanel *pan = new LPanel(settings, desktopnumber, i, bgWindow); + LPanel *pan = new LPanel(settings, desktopnumber, i, bgDesktop); PANELS << pan; pan->show(); } @@ -436,7 +439,7 @@ void LDesktop::UpdatePanels(){ } void LDesktop::UpdateDesktopPluginArea(){ - QRegion visReg( bgWindow->geometry() ); //visible region (not hidden behind a panel) + QRegion visReg( desktop->screenGeometry(desktopnumber) ); //visible region (not hidden behind a panel) QRect rawRect = visReg.boundingRect(); //initial value (screen size) //qDebug() << "Update Desktop Plugin Area:" << bgWindow->geometry(); for(int i=0; i<PANELS.length(); i++){ @@ -467,17 +470,18 @@ void LDesktop::UpdateDesktopPluginArea(){ rec.moveTopLeft( QPoint( rec.x()-desktop->screenGeometry(desktopnumber).x() , rec.y()-desktop->screenGeometry(desktopnumber).y() ) ); //qDebug() << "DPlug Area:" << rec << bgDesktop->geometry() << LSession::handle()->desktop()->availableGeometry(bgDesktop); if(rec.size().isNull() || rec == bgDesktop->geometry()){return; } //nothing changed - bgDesktop->setGeometry( rec ); + bgDesktop->setGeometry(desktop->screenGeometry(desktopnumber)); + bgDesktop->setDesktopArea( rec ); bgDesktop->UpdateGeom(); //just in case the plugin space itself needs to do anything //Re-paint the panels (just in case a plugin was underneath it and the panel is transparent) - for(int i=0; i<PANELS.length(); i++){ PANELS[i]->update(); } + //for(int i=0; i<PANELS.length(); i++){ PANELS[i]->update(); } //Make sure to re-disable any WM control flags - LSession::handle()->XCB->SetDisableWMActions(bgWindow->winId()); + LSession::handle()->XCB->SetDisableWMActions(bgDesktop->winId()); } void LDesktop::UpdateBackground(){ //Get the current Background - if(bgupdating || bgWindow==0){ return; } //prevent multiple calls to this at the same time + if(bgupdating || bgDesktop==0){ return; } //prevent multiple calls to this at the same time bgupdating = true; if(DEBUG){ qDebug() << " - Update Desktop Background for screen:" << desktopnumber; } //Get the list of background(s) to show @@ -494,7 +498,7 @@ void LDesktop::UpdateBackground(){ //qDebug() << "BG List:" << bgL << oldBGL << CBG << bgtimer->isActive(); if(bgL==oldBGL && !CBG.isEmpty() && bgtimer->isActive()){ //No background change scheduled - just update the widget - bgWindow->update(); + bgDesktop->update(); bgupdating=false; return; } @@ -513,7 +517,9 @@ void LDesktop::UpdateBackground(){ if( (bgFile.toLower()=="default")){ bgFile = LOS::LuminaShare()+"desktop-background.jpg"; } //Now set this file as the current background QString format = settings->value(DPREFIX+"background/format","stretch").toString(); - bgWindow->setBackground(bgFile, format); + //bgWindow->setBackground(bgFile, format); + QPixmap backPix = LDesktopBackground::setBackground(bgFile, format, LSession::handle()->screenGeom(desktopnumber)); + bgDesktop->setBackground(backPix); //Now reset the timer for the next change (if appropriate) if(bgtimer->isActive()){ bgtimer->stop(); } if(bgL.length() > 1){ diff --git a/src-qt5/core/lumina-desktop/LDesktop.h b/src-qt5/core/lumina-desktop/LDesktop.h index 52505b12..c576a805 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.h +++ b/src-qt5/core/lumina-desktop/LDesktop.h @@ -68,7 +68,7 @@ private: QStringList oldBGL; QList<LPanel*> PANELS; LDesktopPluginSpace *bgDesktop; //desktop plugin area - LDesktopBackground *bgWindow; //full screen background + //QWidget *bgWindow; //full screen background QMenu *deskMenu, *winMenu; QLabel *workspacelabel; QWidgetAction *wkspaceact; diff --git a/src-qt5/core/lumina-desktop/LDesktopBackground.cpp b/src-qt5/core/lumina-desktop/LDesktopBackground.cpp index ed12bcf0..6b458c24 100644 --- a/src-qt5/core/lumina-desktop/LDesktopBackground.cpp +++ b/src-qt5/core/lumina-desktop/LDesktopBackground.cpp @@ -10,27 +10,30 @@ #include <QPaintEvent> #include <QDebug> +#include "LSession.h" + void LDesktopBackground::paintEvent(QPaintEvent *ev) { + //return; //do nothing - always invisible if (bgPixmap != NULL) { //qDebug() << "Wallpaper paint Event:" << ev->rect(); - QPainter painter(this); - painter.setBrush(*bgPixmap); - painter.drawRect(ev->rect().adjusted(-1,-1,2,2)); + //QPainter painter(this); + //painter.setBrush(*bgPixmap); + //painter.drawRect(ev->rect().adjusted(-1,-1,2,2)); }else{ QWidget::paintEvent(ev); } } -void LDesktopBackground::setBackground(const QString& bgFile, const QString& format) { - if (bgPixmap != NULL) delete bgPixmap; - bgPixmap = new QPixmap(size()); +QPixmap LDesktopBackground::setBackground(const QString& bgFile, const QString& format, QRect geom) { + //if (bgPixmap != NULL) delete bgPixmap; + QPixmap bgPixmap(geom.size());// = new QPixmap(size()); if (bgFile.startsWith("rgb(")) { QStringList colors = bgFile.section(")",0,0).section("(",1,1).split(","); QColor color = QColor(colors[0].toInt(), colors[1].toInt(), colors[2].toInt()); - bgPixmap->fill(color); + bgPixmap.fill(color); } else { - bgPixmap->fill(Qt::black); + bgPixmap.fill(Qt::black); // Load the background file and scale QPixmap bgImage(bgFile); @@ -43,7 +46,7 @@ void LDesktopBackground::setBackground(const QString& bgFile, const QString& for } else { mode = Qt::KeepAspectRatio; } - if(bgImage.height() != this->height() && bgImage.width() != this->width() ){ bgImage = bgImage.scaled(size(), mode); } + if(bgImage.height() != geom.height() && bgImage.width() != geom.width() ){ bgImage = bgImage.scaled(geom.size(), mode); } //bgImage = bgImage.scaled(size(), mode); } @@ -51,32 +54,35 @@ void LDesktopBackground::setBackground(const QString& bgFile, const QString& for int dx = 0, dy = 0; int drawWidth = bgImage.width(), drawHeight = bgImage.height(); if (format == "fit" || format == "center" || format == "full") { - dx = (width() - bgImage.width()) / 2; - dy = (height() - bgImage.height()) / 2; + dx = (geom.width() - bgImage.width()) / 2; + dy = (geom.height() - bgImage.height()) / 2; } else if (format == "tile") { - drawWidth = width(); - drawHeight = height(); + drawWidth = geom.width(); + drawHeight = geom.height(); } else { if (format.endsWith("right")) { - dx = width() - bgImage.width(); + dx = geom.width() - bgImage.width(); } if (format.startsWith("bottom")) { - dy = height() - bgImage.height(); + dy = geom.height() - bgImage.height(); } } // Draw the background image - QPainter painter(bgPixmap); + QPainter painter(&bgPixmap); painter.setBrush(bgImage); painter.setBrushOrigin(dx, dy); painter.drawRect(dx, dy, drawWidth, drawHeight); } - this->repaint(); //make sure the entire thing gets repainted right away - show(); + //this->repaint(); //make sure the entire thing gets repainted right away + //LSession::handle()->XCB->paintRoot(geom, &bgPixmap); + return bgPixmap; + //show(); } LDesktopBackground::LDesktopBackground() : QWidget() { bgPixmap = NULL; + this->setWindowOpacity(0); } LDesktopBackground::~LDesktopBackground() { diff --git a/src-qt5/core/lumina-desktop/LDesktopBackground.h b/src-qt5/core/lumina-desktop/LDesktopBackground.h index a9ce64fa..a2e46748 100644 --- a/src-qt5/core/lumina-desktop/LDesktopBackground.h +++ b/src-qt5/core/lumina-desktop/LDesktopBackground.h @@ -18,7 +18,7 @@ public: virtual ~LDesktopBackground(); virtual void paintEvent(QPaintEvent*); - void setBackground(const QString&, const QString&); + static QPixmap setBackground(const QString&, const QString&, QRect geom); private: QPixmap *bgPixmap; diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp index ff460125..592f3481 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp @@ -16,16 +16,20 @@ // =================== // PUBLIC // =================== -LDesktopPluginSpace::LDesktopPluginSpace(QWidget *parent) : QWidget(parent){ +LDesktopPluginSpace::LDesktopPluginSpace() : QWidget(){ this->setObjectName("LuminaDesktopPluginSpace"); + this->setAttribute(Qt::WA_TranslucentBackground); + //this->setAttribute(Qt::WA_NoSystemBackground); + this->setAutoFillBackground(false); this->setStyleSheet("QWidget#LuminaDesktopPluginSpace{ border: none; background: transparent; }"); + this->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); this->setAcceptDrops(true); this->setContextMenuPolicy(Qt::NoContextMenu); this->setMouseTracking(true); TopToBottom = true; GRIDSIZE = 100.0; //default value if not set plugsettings = LSession::handle()->DesktopPluginSettings(); - + //this->setWindowOpacity(0.0); } LDesktopPluginSpace::~LDesktopPluginSpace(){ @@ -38,6 +42,7 @@ void LDesktopPluginSpace::LoadItems(QStringList plugs, QStringList files){ if(plugs != plugins){ plugins = plugs; changes = true; } if(files != deskitems){ deskitems = files; changes = true; } if(changes){ QTimer::singleShot(0,this, SLOT(reloadPlugins())); } + this->show(); } void LDesktopPluginSpace::SetIconSize(int size){ @@ -61,11 +66,21 @@ void LDesktopPluginSpace::cleanup(){ deskitems.clear(); this->hide(); } + +void LDesktopPluginSpace::setBackground(QPixmap pix){ + wallpaper = pix; + this->repaint(); +} + +void LDesktopPluginSpace::setDesktopArea(QRect area){ + desktopRect = area; +} + // =================== // PUBLIC SLOTS // =================== void LDesktopPluginSpace::UpdateGeom(int oldgrid){ - if(DEBUG){ qDebug() << "Updated Desktop Geom:" << this->size() << GRIDSIZE << this->size()/GRIDSIZE; } + if(DEBUG){ qDebug() << "Updated Desktop Geom:" << desktopRect.size() << GRIDSIZE << desktopRect.size()/GRIDSIZE; } //Go through and check the locations/sizes of all items (particularly the ones on the bottom/right edges) //bool reload = false; for(int i=0; i<ITEMS.length(); i++){ @@ -105,6 +120,7 @@ void LDesktopPluginSpace::addDesktopPlugin(QString plugID){ if(DEBUG){ qDebug() << "Adding Desktop Plugin:" << plugID; } LDPlugin *plug = NewDP::createPlugin(plugID, this); if(plug==0){ return; } //invalid plugin + //plug->setAttribute(Qt::WA_TranslucentBackground); plug->setWhatsThis(plugID); //Now get the geometry for the plugin QRect geom = plug->loadPluginGeometry(); //in pixel coords @@ -149,8 +165,8 @@ QRect LDesktopPluginSpace::findOpenSpot(int gridwidth, int gridheight, int start if(col<0){ col = 0; } //just in case - since this can be recursively called bool found = false; int rowCount, colCount; - rowCount = RoundUp(this->height()/GRIDSIZE); - colCount = RoundUp(this->width()/GRIDSIZE); + rowCount = RoundUp(desktopRect.height()/GRIDSIZE); + colCount = RoundUp(desktopRect.width()/GRIDSIZE); if( (row+gridheight)>rowCount){ row = rowCount-gridheight; startRow = row; } if( (col+gridwidth)>colCount){ col = colCount-gridwidth; startCol = col; } QRect geom(0, 0, gridwidth*GRIDSIZE, gridheight*GRIDSIZE); //origin point will be adjusted in a moment @@ -300,3 +316,17 @@ void LDesktopPluginSpace::reloadPlugins(bool ForceIconUpdate ){ addDesktopItem(items[i]); } } + + +//================= +// PROTECTED +//================= +void LDesktopPluginSpace::paintEvent(QPaintEvent*ev){ + if(!wallpaper.isNull()){ + QPainter painter(this); + painter.setBrush(wallpaper); + painter.drawRect(ev->rect().adjusted(-1,-1,2,2)); + }else{ + QWidget::paintEvent(ev); + } +} diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h index 44765029..12382db8 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h @@ -33,7 +33,7 @@ signals: void HideDesktopMenu(); public: - LDesktopPluginSpace(QWidget *parent = 0); + LDesktopPluginSpace(); ~LDesktopPluginSpace(); void LoadItems(QStringList plugs, QStringList files); @@ -42,6 +42,9 @@ public: void ArrangeTopToBottom(bool ttb); //if false, will arrange left->right void cleanup(); + void setBackground(QPixmap pix); //should already be sized appropriately for this widget + void setDesktopArea(QRect area); + public slots: void UpdateGeom(int oldgrid = -1); @@ -49,6 +52,8 @@ private: QSettings *plugsettings; QStringList plugins, deskitems; QList<LDPlugin*> ITEMS; + QPixmap wallpaper; + QRect desktopRect; bool TopToBottom; float GRIDSIZE; @@ -88,7 +93,7 @@ private: //This function incorporates the bottom/right edge matchins procedures (for incomplete last grid) QRect geom(grid.x()*GRIDSIZE, grid.y()*GRIDSIZE, grid.width()*GRIDSIZE, grid.height()*GRIDSIZE); //Now check the edge conditions (last right/bottom grid points might be smaller than GRIDSIZE) - QSize areaSize = this->size(); //use the size of the area instead of the geometry - because we need this in child coordinates like "geom" above + QSize areaSize = desktopRect.size(); //use the size of the area instead of the geometry - because we need this in child coordinates like "geom" above //qDebug() << "GridToGeom:" << grid << geom << "Area size:" << areaSize; if(geom.right() > areaSize.width() && (geom.right()-areaSize.width())<GRIDSIZE ){ geom.setRight(areaSize.width()-1); //match up with the edge @@ -120,15 +125,15 @@ private: //qDebug() << "Check Valid Grid:" << grid << RoundUp(this->width()/GRIDSIZE) << RoundUp(this->height()/GRIDSIZE); //This just checks that the grid coordinates are not out of bounds - should still run ValidGeometry() below with the actual pixel geom if(grid.x()<0 || grid.y()<0 || grid.width()<0 || grid.height()<0){ return false; } - else if( (grid.x()+grid.width()) > RoundUp(this->width()/GRIDSIZE) ){ return false; } - else if( (grid.y()+grid.height()) > RoundUp(this->height()/GRIDSIZE) ){ return false; } + else if( (grid.x()+grid.width()) > RoundUp(desktopRect.width()/GRIDSIZE) ){ return false; } + else if( (grid.y()+grid.height()) > RoundUp(desktopRect.height()/GRIDSIZE) ){ return false; } return true; } bool ValidGeometry(QString id, QRect geom){ //First check that it is within the desktop area completely // Note that "this->geometry()" is not in the same coordinate space as the geometry inputs - if(!QRect(0,0,this->width(), this->height()).contains(geom)){ return false; } + if(!QRect(0,0,desktopRect.width(), desktopRect.height()).contains(geom)){ return false; } //Now check that it does not collide with any other items for(int i=0; i<ITEMS.length(); i++){ if(ITEMS[i]->whatsThis()==id){ continue; } @@ -183,9 +188,8 @@ private slots: } protected: - void paintEvent(QPaintEvent*){ - //do nothing here - the main plugin area should *always* be invisible - } + void paintEvent(QPaintEvent*ev); + //Need Drag and Drop functionality (internal movement) void dragEnterEvent(QDragEnterEvent *ev){ if(ev->mimeData()->hasFormat(MIMETYPE) ){ diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 67cba7f4..933dc778 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -20,6 +20,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ bgWindow = parent; //save for later //Setup the widget overlay for the entire panel to provide transparency effects panelArea = new QWidget(this); + //panelArea->setAttribute(Qt::WA_TranslucentBackground); QBoxLayout *tmp = new QBoxLayout(QBoxLayout::LeftToRight); tmp->setContentsMargins(0,0,0,0); this->setLayout(tmp); @@ -38,9 +39,12 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->setContentsMargins(0,0,0,0); this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); //panels cannot get keyboard focus otherwise it upsets the task manager window detection - this->setAttribute(Qt::WA_X11DoNotAcceptFocus); + //this->setAttribute(Qt::WA_X11DoNotAcceptFocus); this->setAttribute(Qt::WA_X11NetWmWindowTypeDock); this->setAttribute(Qt::WA_AlwaysShowToolTips); + this->setAttribute(Qt::WA_TranslucentBackground); + //this->setAttribute(Qt::WA_NoSystemBackground); + this->setAutoFillBackground(false); this->setWindowFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //this->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); @@ -59,8 +63,9 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ LSession::handle()->XCB->SetAsSticky(this->winId()); if(hascompositer){ //qDebug() << "Enable Panel compositing"; - this->setWindowOpacity(0.0); //fully transparent background for the main widget - panelArea->setWindowOpacity(0.0); + //this->setStyleSheet("QWidget#LuminaPanelBackgroundWidget{ background: transparent; }"); + //this->setWindowOpacity(0.5); //fully transparent background for the main widget + //panelArea->setWindowOpacity(1.0); //fully opaque for the widget on top (apply stylesheet transparencies) } QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes @@ -330,7 +335,8 @@ void LPanel::paintEvent(QPaintEvent *event){ //qDebug() << " - Rec:" << rec << hidden << this->geometry() << bgWindow->geometry(); rec.moveTo( bgWindow->mapFromGlobal( this->mapToGlobal(rec.topLeft()) ) ); //(rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y()-LSession::handle()->screenGeom(screennum).y() ); //qDebug() << " - Adjusted Window Rec:" << rec; - painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec) ); + painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec)); + //painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), QApplication::screens().at(screennum)->grabWindow(QX11Info::appRootWindow(), rec.x(), rec.y(), rec.width(), rec.height()) ); } QWidget::paintEvent(event); //now pass the event along to the normal painting event } @@ -342,7 +348,7 @@ void LPanel::enterEvent(QEvent *event){ this->move(showpoint); this->update(); } - this->activateWindow(); + //this->activateWindow(); event->accept(); //just to quiet the compile warning } @@ -355,5 +361,6 @@ void LPanel::leaveEvent(QEvent *event){ //qDebug() << "Mouse Point (local):" << pt.x() << pt.y(); qDebug() << "Contained:" << this->geometry().contains(pt);*/ checkPanelFocus(); - event->accept(); //just to quiet the compile warning + QWidget::leaveEvent(event); + //event->accept(); //just to quiet the compile warning } diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 9a985b3f..b2cdab13 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -427,11 +427,11 @@ void LSession::updateDesktops(){ } void LSession::registerDesktopWindows(){ - QList<WId> wins; + /*QList<WId> wins; for(int i=0; i<DESKTOPS.length(); i++){ wins << DESKTOPS[i]->backgroundID(); } - XCB->RegisterVirtualRoots(wins); + XCB->RegisterVirtualRoots(wins);*/ } void LSession::adjustWindowGeom(WId win, bool maximize){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp index 92b3c6ea..0a396464 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp @@ -132,6 +132,6 @@ void LStartButtonPlugin::closeMenu(){ void LStartButtonPlugin::shortcutActivated(){ if(LSession::handle()->registerStartButton(this->type())){ if(menu->isVisible()){ closeMenu(); } - else{ openMenu(); } + else{ this->activateWindow(); openMenu(); } } } diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 2647e58d..c689c9a3 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -25,7 +25,7 @@ void LSession::stopall(){ for(int i=0; i<PROCS.length(); i++){ if(PROCS[i]->state()!=QProcess::NotRunning){ PROCS[i]->terminate(); } } - //QCoreApplication::exit(0); + QCoreApplication::exit(0); } void LSession::procFinished(){ |