diff options
author | q5sys <jt@obs-sec.com> | 2017-07-21 09:52:24 -0400 |
---|---|---|
committer | q5sys <jt@obs-sec.com> | 2017-07-21 09:52:24 -0400 |
commit | 4a4d63f45cfc8fe0b0495615e399b57c41713d06 (patch) | |
tree | 8861bb1de14b2015dcf7407e8b5cfa1ddf5319a2 /src-qt5/core | |
parent | clean up lthemeengine-style pages (diff) | |
parent | Fix up some multi-monitor issues with Lumina2 (Qt auto-scaling is a really ba... (diff) | |
download | lumina-4a4d63f45cfc8fe0b0495615e399b57c41713d06.tar.gz lumina-4a4d63f45cfc8fe0b0495615e399b57c41713d06.tar.bz2 lumina-4a4d63f45cfc8fe0b0495615e399b57c41713d06.zip |
Merge branch 'master' of https://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/DesktopSettings.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/DesktopSettings.h | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.cpp | 74 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.h | 7 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow-animations.cpp | 97 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 69 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 7 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 17 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.pri | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/main.cpp | 2 |
12 files changed, 213 insertions, 76 deletions
diff --git a/src-qt5/core/libLumina/DesktopSettings.cpp b/src-qt5/core/libLumina/DesktopSettings.cpp index 47dc29de..8bda1ac5 100644 --- a/src-qt5/core/libLumina/DesktopSettings.cpp +++ b/src-qt5/core/libLumina/DesktopSettings.cpp @@ -238,6 +238,8 @@ QString DesktopSettings::rel_path(DesktopSettings::File file){ name="keys"; break; case DesktopSettings::Theme: name="theme"; break; + case DesktopSettings::Animation: + name="animations"; break; } return FILEPREFIX+name+".conf"; } diff --git a/src-qt5/core/libLumina/DesktopSettings.h b/src-qt5/core/libLumina/DesktopSettings.h index 57a85791..dcb10bb6 100644 --- a/src-qt5/core/libLumina/DesktopSettings.h +++ b/src-qt5/core/libLumina/DesktopSettings.h @@ -25,7 +25,7 @@ class DesktopSettings : public QObject{ Q_OBJECT public: - enum File{ System, Favorites, Environment, Session, Desktop, ContextMenu, Keys, Theme }; + enum File{ System, Favorites, Environment, Session, Desktop, ContextMenu, Keys, Theme, Animation }; DesktopSettings(QObject *parent = 0); ~DesktopSettings(); diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index 34501f2a..ed0fd89c 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -37,8 +37,8 @@ inline void registerClientEvents(WId id){ // ============ //Simplification functions for the XCB/XLib interactions void NativeEmbedWidget::syncWinSize(QSize sz){ - if(WIN==0){ return; } - if(!sz.isValid()){ sz = this->size(); } //use the current widget size + if(WIN==0 ){ return; } + else if(!sz.isValid()){ sz = this->size(); } //use the current widget size //qDebug() << "Sync Window Size:" << sz; if(sz == winSize){ return; } //no change const uint32_t valList[2] = {(uint32_t) sz.width(), (uint32_t) sz.height()}; @@ -58,9 +58,11 @@ void NativeEmbedWidget::hideWindow(){ void NativeEmbedWidget::showWindow(){ xcb_map_window(QX11Info::connection(), WIN->id()); + QTimer::singleShot(0,this, SLOT(repaintWindow())); } QImage NativeEmbedWidget::windowImage(QRect geom){ + //if(paused){ return QImage(); } //Pull the XCB pixmap out of the compositing layer xcb_pixmap_t pix = xcb_generate_id(QX11Info::connection()); xcb_composite_name_window_pixmap(QX11Info::connection(), WIN->id(), pix); @@ -85,7 +87,8 @@ QImage NativeEmbedWidget::windowImage(QRect geom){ // ============ NativeEmbedWidget::NativeEmbedWidget(QWidget *parent) : QWidget(parent){ WIN = 0; //nothing embedded yet - this->setSizeIncrement(2,2); + paused = false; + //this->setSizeIncrement(2,2); } bool NativeEmbedWidget::embedWindow(NativeWindow *window){ @@ -141,9 +144,22 @@ bool NativeEmbedWidget::isEmbedded(){ // ============== // PUBLIC SLOTS // ============== +//Pause/resume +void NativeEmbedWidget::pause(){ + if(winImage.isNull()){ repaintWindow(); } //make sure we have one image already cached first + paused = true; +} + +void NativeEmbedWidget::resume(){ + paused = false; + //syncWinSize(); + //showWindow(); + repaintWindow(); //update the cached image right away +} + void NativeEmbedWidget::resyncWindow(){ if(WIN==0){ return; } - return; //skip the stuff below (not working) + /*return; //skip the stuff below (not working) QRect geom = WIN->geometry(); //Send an artificial configureNotify event to the window with the global position/size included xcb_configure_notify_event_t event; @@ -158,17 +174,28 @@ void NativeEmbedWidget::resyncWindow(){ event.event = WIN->id(); event.response_type = XCB_CONFIGURE_NOTIFY; xcb_send_event(QX11Info::connection(), false, WIN->id(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, (const char *) &event); - - xcb_flush(QX11Info::connection()); + */ + //Just jitter the window size by 1 pixel really quick so the window knows to update it's geometry + QSize sz = this->size(); + uint32_t valList[2] = {(uint32_t) sz.width()-1, (uint32_t) sz.height()}; + uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); + xcb_flush(QX11Info::connection()); + valList[0] = (uint32_t) sz.width(); + xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); + xcb_flush(QX11Info::connection()); + syncWinSize(); + QTimer::singleShot(0, this, SLOT(repaintWindow()) ); } void NativeEmbedWidget::repaintWindow(){ - qDebug() << "Update Window Image"; - QImage tmp = windowImage( QRect(QPoint(0,0), this->size()) ); - if(!tmp.isNull()){ - winImage = tmp; - }else{ qDebug() << "Got Null Image!!"; } - this->update(); + //qDebug() << "Update Window Image:" << !paused; + if(paused){ return; } + QImage tmp = windowImage( QRect(QPoint(0,0), this->size()) ); + if(!tmp.isNull()){ + winImage = tmp; + }//else{ qDebug() << "Got Null Image!!"; } + this->parentWidget()->update(); } // ============== // PROTECTED @@ -191,17 +218,30 @@ void NativeEmbedWidget::hideEvent(QHideEvent *ev){ } void NativeEmbedWidget::paintEvent(QPaintEvent *ev){ - if(this->size()!=winSize){ return; } //do not paint here - waiting to re-sync the sizes if(WIN==0){ QWidget::paintEvent(ev); return; } + else if( winImage.isNull() ){ /*QTimer::singleShot(0, this, SLOT(repaintWindow()) );*/ return; } + else if(paused){ return; } + //else if(this->size()!=winSize){ QTimer::singleShot(0,this, SLOT(syncWinSize())); return; } //do not paint here - waiting to re-sync the sizes + //else if(this->size() != winImage.size()){ QTimer::singleShot(0, this, SLOT(repaintWindow()) ); return; } //Need to paint the image from the window onto the widget as an overlay QRect geom = ev->rect(); //atomic updates - geom.adjust(-1,-1,1,1); //add an additional pixel in each direction to be painted + geom.adjust(-10,-10,10,10); //add an additional few pixels in each direction to be painted geom = geom.intersected(QRect(0,0,this->width(), this->height())); //ensure intersection with actual window - if(!winImage.isNull()){ if( !QRect(QPoint(0,0),winImage.size()).contains(geom) ){ QTimer::singleShot(0,this, SLOT(repaintWindow()) );return; } QPainter P(this); - P.drawImage( geom , winImage, geom, Qt::NoOpaqueDetection); //1-to-1 mapping + P.setClipping(true); + P.setClipRect(0,0,this->width(), this->height()); + //qDebug() << "Paint Embed Window:" << geom << winImage.size(); + if(winImage.size() == this->size()){ + P.drawImage( geom , winImage, geom, Qt::NoOpaqueDetection); //1-to-1 mapping + //Note: Qt::NoOpaqueDetection Speeds up the paint by bypassing the checks to see if there are [semi-]transparent pixels + // Since this is an embedded image - we fully expect there to be transparency all/most of the time. + }else{ + P.drawImage( geom , winImage); + } + //else{ QImage scaled = winImage.scaled(geom.size()); P.drawImage(geom, scaled); } + //P.drawImage( geom , winImage, geom, Qt::NoOpaqueDetection); //1-to-1 mapping //Note: Qt::NoOpaqueDetection Speeds up the paint by bypassing the checks to see if there are [semi-]transparent pixels // Since this is an embedded image - we fully expect there to be transparency all/most of the time. - } + } diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.h b/src-qt5/core/libLumina/NativeEmbedWidget.h index 756c8317..65e03c51 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.h +++ b/src-qt5/core/libLumina/NativeEmbedWidget.h @@ -25,6 +25,7 @@ private: NativeWindow *WIN; QSize winSize; QImage winImage; + bool paused; private slots: //Simplification functions @@ -42,7 +43,13 @@ public: bool detachWindow(); bool isEmbedded(); //status of the embed + + public slots: + //Pause/resume + void pause(); + void resume(); + void resyncWindow(); void repaintWindow(); diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 94d39cb7..48d0380b 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -89,11 +89,11 @@ QRect NativeWindow::geometry(){ QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), hash.value(NativeWindow::Size).toSize() ); //Now adjust the window geom by the frame margins QList<int> frame = hash.value(NativeWindow::FrameExtents).value< QList<int> >(); //Left,Right,Top,Bottom - qDebug() << "Calculate Geometry:" << geom << frame; + //qDebug() << "Calculate Geometry:" << geom << frame; if(frame.length()==4){ geom = geom.adjusted( -frame[0], -frame[2], frame[1], frame[3] ); } - qDebug() << " - Total:" << geom; + //qDebug() << " - Total:" << geom; return geom; } // ==== PUBLIC SLOTS === diff --git a/src-qt5/core/libLumina/RootSubWindow-animations.cpp b/src-qt5/core/libLumina/RootSubWindow-animations.cpp new file mode 100644 index 00000000..ac813e3a --- /dev/null +++ b/src-qt5/core/libLumina/RootSubWindow-animations.cpp @@ -0,0 +1,97 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootSubWindow.h" +#include <QDebug> + +QStringList RootSubWindow::validAnimations(NativeWindow::Property prop){ + QStringList valid; + if(prop == NativeWindow::Visible){ + valid << "zoom" << "wipe-center-vertical" << "wipe-center-horizontal" << "shade-top" << "shade-right" << "shade-left" << "shade-bottom"; + } + return valid; +} + +void RootSubWindow::loadAnimation(QString name, NativeWindow::Property prop, QVariant nval){ + animResetProp.clear(); + //Special case - random animation each time + if(name=="random"){ + QStringList valid = validAnimations(prop); + name = valid.at(qrand()%valid.length()); + } + //Now setup the animation + if(prop == NativeWindow::Visible){ + //NOTE: Assigns values for "invisible->visible" animation: will reverse it afterwards as needed + anim->setPropertyName("geometry"); + QRect geom = this->geometry(); + if(name == "zoom"){ + //Zoom to/from the center point + anim->setStartValue( QRect(geom.center(), QSize(0,0)) ); + anim->setEndValue(geom); + }else if(name == "wipe-center-vertical"){ + anim->setStartValue( QRect( geom.center().x(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else if(name == "wipe-center-horizontal"){ + anim->setStartValue( QRect( geom.x(), geom.center().y(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-top"){ + anim->setStartValue( QRect( geom.x(), geom.y(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-bottom"){ + anim->setStartValue( QRect( geom.x(), geom.y()+geom.height(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-left"){ + anim->setStartValue( QRect( geom.x(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else if(name == "shade-right"){ + anim->setStartValue( QRect( geom.x()+geom.width(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else{ + //Invalid/None animation + if(nval.toBool()){ this->show(); } + else{ this->hide(); } + return; + } + if(nval.toBool()){ + this->setGeometry( anim->startValue().toRect() ); //ensure the window is the initial geom before it becomes visible + }else{ + QVariant tmp = anim->startValue(); + anim->setStartValue(anim->endValue()); + anim->setEndValue(tmp); + animResetProp = anim->startValue(); + QTimer::singleShot(anim->duration(), this, SLOT(hide()) ); + } + WinWidget->pause(); + anim->start(); + this->show(); + } //end of Visibility animation +} + +void RootSubWindow::animFinished(){ + if(closing){ this->close(); return;} + else if(anim->propertyName()=="geometry"){ + if(!animResetProp.isNull()){ + /*qDebug() << "Animation Finished, Reset Geometry:" << animResetProp.toRect(); + qDebug() << " - Starting Value:" << anim->startValue().toRect(); + qDebug() << " - Ending Value:" << anim->endValue().toRect();*/ + this->setGeometry( animResetProp.toRect() ); + //Also ensure that the proper geometry is saved to the window structure + QRect curg = this->geometry(); + QRect wing = WIN->geometry(); + //qDebug() << " - After Animation Reset:" << curg << wing; + if(curg!=wing){ + QRect clientg = clientGlobalGeom(); + //qDebug() << "Sub Window geometry:" << clientg; + WIN->setProperties(QList< NativeWindow::Property>() << NativeWindow::Size << NativeWindow::GlobalPos, + QList<QVariant>() << clientg.size() << clientg.topLeft() ); + WinWidget->resyncWindow(); //also let the window know about the current geometry + } + } + } + animResetProp = QVariant(); //clear the variable + WinWidget->resume(); + +} diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 9ef6464e..c2da8aef 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -14,6 +14,7 @@ #define WIN_BORDER 5 #include <LIconCache.h> +#include <DesktopSettings.h> // === PUBLIC === RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ @@ -246,6 +247,14 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ propertiesChanged(list, vals); } +QRect RootSubWindow::clientGlobalGeom(){ + QRect tot = this->geometry(); + QList<int> frame = WIN->property(NativeWindow::FrameExtents).value< QList<int> >(); + //Now adjust this to take out the frame + tot.adjust(frame[0], frame[2], -frame[1], -frame[3]); + return tot; +} + // === PUBLIC SLOTS === void RootSubWindow::clientClosed(){ //qDebug() << "Client Closed"; @@ -296,6 +305,7 @@ void RootSubWindow::startMoving(){ activeState = Move; offset = this->mapFromGlobal(curpt); setMouseCursor(activeState, true); //this one is an override cursor + //WinWidget->pause(); //Also need to capture the mouse this->grabMouse(); } @@ -312,24 +322,8 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList switch(props[i]){ case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); - if(vals[i].toBool()){ - if(lastGeom.isNull()){ animResetProp = this->geometry(); } - else{ animResetProp = lastGeom; } - anim->setPropertyName("geometry"); - anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); - anim->setEndValue(animResetProp); - this->setGeometry( anim->startValue().toRect() ); //ensure the window is the initial geom before it becomes visible - anim->start(); - this->show(); - }else{ - animResetProp = this->geometry(); //hide event - should already be the right geom - lastGeom = this->geometry(); - anim->setPropertyName("geometry"); - anim->setStartValue(this->geometry()); - anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); - anim->start(); - QTimer::singleShot(anim->duration(), this, SLOT(hide()) ); - } + if(vals[i].toBool()){ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/appear", "random").toString(), NativeWindow::Visible, vals[i]); } + else{ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/disappear", "random").toString(), NativeWindow::Visible, vals[i]); } break; case NativeWindow::Title: titleLabel->setText(vals[i].toString()); @@ -340,11 +334,6 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList else{ otherB->setIcon(vals[i].value<QIcon>()); } break; case NativeWindow::GlobalPos: - //qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); - if(activeState == RootSubWindow::Normal){ - this->move( WIN->geometry().topLeft() ); - } - break; case NativeWindow::Size: //qDebug() << " - SIZE CHANGE"; if(WIN->property(NativeWindow::FrameExtents).isNull() && (i<props.indexOf(NativeWindow::FrameExtents)) ){ @@ -353,11 +342,8 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running ){ - if(vals[i].toSize() != WinWidget->size() && activeState==Normal){ - //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + if(vals[i].toSize() != WinWidget->size() && activeState==Normal && vals[i]==WIN->property(NativeWindow::Size)){ + this->setGeometry(WIN->geometry()); } } break; @@ -388,20 +374,6 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList } } -void RootSubWindow::animFinished(){ - if(closing){ this->close(); return;} - else if(anim->propertyName()=="geometry"){ - if(!animResetProp.isNull()){ - /*qDebug() << "Animation Finished, Reset Geometry:" << animResetProp; - qDebug() << " - Starting Value:" << anim->startValue(); - qDebug() << " - Ending Value:" << anim->endValue(); - qDebug() << " - Current Value:" << this->geometry();*/ - this->setGeometry( animResetProp.toRect() ); - } - } - animResetProp = QVariant(); //clear the variable -} - // === PROTECTED === void RootSubWindow::mousePressEvent(QMouseEvent *ev){ activate(); @@ -409,7 +381,7 @@ void RootSubWindow::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->activate(); + //this->activate(); if(this->childAt(ev->pos())!=0){ //Check for any non-left-click event and skip it if(ev->button()!=Qt::LeftButton){ return; } @@ -420,6 +392,8 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){ activeState = getStateAtPoint(ev->pos(), true); //also have it set the offset variable } setMouseCursor(activeState, true); //this one is an override cursor + //if(activeState!=Normal){WinWidget->pause(); } + if(activeState!=Normal && activeState!=Move){WinWidget->pause(); } QFrame::mousePressEvent(ev); } @@ -498,7 +472,9 @@ void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ default: break; } - this->setGeometry(geom); + //if( (geom.width()%2==0 && geom.height()%2==0) || activeState==Move){ + this->setGeometry(geom); + //} } QFrame::mouseMoveEvent(ev); } @@ -511,6 +487,8 @@ void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){ otherM->popup(ev->globalPos()); return; } + if(activeState!=Normal){ WinWidget->resume(); } + if(activeState!=Normal && activeState!=Move){WinWidget->resume(); } activeState = Normal; QApplication::restoreOverrideCursor(); setMouseCursor( getStateAtPoint(ev->pos()) ); @@ -529,8 +507,5 @@ void RootSubWindow::moveEvent(QMoveEvent *ev){ QFrame::moveEvent(ev); if(!closing && anim->state()!=QAbstractAnimation::Running){ moveTimer->start(); - //WinWidget->resyncWindow(); - //WIN->requestProperty(NativeWindow::GlobalPos, ev->pos() ); } - } diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index de6aba89..079a6201 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -39,6 +39,7 @@ private: //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 + //Native window embed objects NativeWindow *WIN; NativeEmbedWidget *WinWidget; @@ -60,10 +61,14 @@ private: void LoadProperties( QList< NativeWindow::Property> list); + static QStringList validAnimations(NativeWindow::Property); + public slots: void clientClosed(); void LoadAllProperties(); + QRect clientGlobalGeom(); + //Button Actions - public so they can be tied to key shortcuts and stuff as well void toggleMinimize(); void toggleMaximize(); @@ -77,6 +82,8 @@ public slots: private slots: void propertiesChanged(QList<NativeWindow::Property>, QList<QVariant>); + + void loadAnimation(QString name, NativeWindow::Property, QVariant nval); //new val void animFinished(); protected: diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 31faaf50..90ad8739 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -10,6 +10,8 @@ #include <QScreen> #include <QDebug> +#define DEBUG 1 + // === PUBLIC === RootWindow::RootWindow() : QWidget(0, Qt::Window | Qt::BypassWindowManagerHint | Qt::WindowStaysOnBottomHint){ qRegisterMetaType<WId>("WId"); @@ -100,12 +102,14 @@ void RootWindow::updateScreenPixmap(screeninfo *info){ // === PUBLIC SLOTS === void RootWindow::ResizeRoot(){ + if(DEBUG){ qDebug() << "Resize Root..."; } QList<QScreen*> scrns = QApplication::screens(); //Update all the screen locations and ID's in the WALLPAPERS list QRect fullscreen; QStringList valid; //Update the size of the rootWindow itself for(int i=0; i<scrns.length(); i++){ + if(DEBUG){ qDebug() << " - Found Screen:" << scrns[i]->name() << scrns[i]->geometry(); } fullscreen = fullscreen.united(scrns[i]->geometry()); valid << scrns[i]->name(); for(int j=0; j<WALLPAPERS.length(); j++){ @@ -129,11 +133,13 @@ void RootWindow::ResizeRoot(){ } } //Trigger a repaint and send out any signals + if(DEBUG){ qDebug() << " - FullScreen Geometry:" << fullscreen; } this->setGeometry(fullscreen); this->update(); emit RootResized(fullscreen); if(!valid.isEmpty()){ emit NewScreens(valid); } if(!invalid.isEmpty()){ emit RemovedScreens(invalid); } + if(DEBUG){ qDebug() << " - Geom after change:" << this->geometry(); } } void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QString file){ @@ -148,6 +154,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin } } if(!found){ + ResizeRoot(); //Need to create a new screeninfo structure QList<QScreen*> scrns = QApplication::screens(); for(int i=0; i<scrns.length(); i++){ @@ -169,7 +176,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin void RootWindow::NewWindow(NativeWindow *win){ RootSubWindow *subwin = 0; - qDebug() << "Got New Window:" << win->property(NativeWindow::Title); + //qDebug() << "Got New Window:" << win->property(NativeWindow::Title); for(int i=0; i<WINDOWS.length() && subwin==0; i++){ if(WINDOWS[i]->id() == win->id()){ subwin = WINDOWS[i]; } } @@ -185,7 +192,7 @@ void RootWindow::NewWindow(NativeWindow *win){ void RootWindow::CloseWindow(WId win){ for(int i=0; i<WINDOWS.length(); i++){ - if(WINDOWS[i]->id() == win){ qDebug() << "Remove Window From Root List"; WINDOWS.takeAt(i)->clientClosed(); break; } + if(WINDOWS[i]->id() == win){ WINDOWS.takeAt(i)->clientClosed(); break; } } } @@ -196,10 +203,12 @@ void RootWindow::paintEvent(QPaintEvent *ev){ //qDebug() << "RootWindow: PaintEvent:" << ev->rect(); //<< QDateTime::currentDateTime()->toString(QDateTime::ShortDate); bool found = false; QPainter painter(this); + QRect geom = ev->rect(); + geom.adjust(-10,-10,10,10); //give it a few more pixels in each direction to repaint (noticing some issues in Qt 5.7.1) for(int i=0; i<WALLPAPERS.length(); i++){ - if(WALLPAPERS[i].area.intersects(ev->rect()) ){ + if(WALLPAPERS[i].area.intersects(geom) ){ found = true; - QRect intersect = WALLPAPERS[i].area.intersected(ev->rect()); + QRect intersect = WALLPAPERS[i].area.intersected(geom); painter.drawPixmap( intersect, WALLPAPERS[i].wallpaper, intersect.translated(-WALLPAPERS[i].area.x(), -WALLPAPERS[i].area.y()) ); } } diff --git a/src-qt5/core/libLumina/RootWindow.pri b/src-qt5/core/libLumina/RootWindow.pri index e4d5f00b..b83240e5 100644 --- a/src-qt5/core/libLumina/RootWindow.pri +++ b/src-qt5/core/libLumina/RootWindow.pri @@ -1,7 +1,8 @@ # Files SOURCES *= $${PWD}/RootWindow.cpp \ - $${PWD}/RootSubWindow.cpp + $${PWD}/RootSubWindow.cpp \ + $${PWD}/RootSubWindow-animations.cpp HEADERS *= $${PWD}/RootWindow.h \ $${PWD}/RootSubWindow.h @@ -12,3 +13,4 @@ INCLUDEPATH *= ${PWD} include(LUtils.pri) include(NativeWindow.pri) include(LIconCache.pri) +include(DesktopSettings.pri) diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 0b9a9b35..60ed1a39 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -18,8 +18,6 @@ NativeWindowSystem* Lumina::NWS = 0; NativeEventFilter* Lumina::NEF = 0; LScreenSaver* Lumina::SS = 0; -//DesktopSettings* Lumina::SETTINGS = 0; -//Lumina::WM = 0; QThread* Lumina::EVThread = 0; RootWindow* Lumina::ROOTWIN = 0; XDGDesktopList* Lumina::APPLIST = 0; @@ -49,7 +47,6 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu //Now initialize the global objects (but do not start them yet) Lumina::NEF = new NativeEventFilter(); Lumina::NWS = new NativeWindowSystem(); - //Lumina::SETTINGS = new DesktopSettings(); Lumina::SS = new LScreenSaver(); //Now put the Native Window System into it's own thread to keep things snappy Lumina::EVThread = new QThread(); @@ -67,7 +64,6 @@ LSession::~LSession(){ //Clean up the global objects as needed if(Lumina::NEF!=0){ Lumina::NEF->deleteLater(); } if(Lumina::NWS!=0){ Lumina::NWS->deleteLater(); } - //if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); } if(Lumina::SS!=0){ Lumina::SS->deleteLater(); } if(Lumina::EVThread!=0){ if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); } diff --git a/src-qt5/core/lumina-desktop-unified/main.cpp b/src-qt5/core/lumina-desktop-unified/main.cpp index 0b67de46..8e40f7eb 100644 --- a/src-qt5/core/lumina-desktop-unified/main.cpp +++ b/src-qt5/core/lumina-desktop-unified/main.cpp @@ -30,6 +30,8 @@ int main(int argc, char ** argv) setenv("XDG_CURRENT_DESKTOP","Lumina",1); setenv("QT_NO_GLIB", "1", 1); //Disable the glib event loop within Qt at runtime (performance hit + bugs) unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... + unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //need exact-pixel measurements (no fake scaling) + //Startup the session if(DEBUG){ qDebug() << "Starting unified session"; } LSession a(argc, argv); |