diff options
author | q5sys <jt@ixsystems.com> | 2017-09-20 12:23:40 -0400 |
---|---|---|
committer | q5sys <jt@ixsystems.com> | 2017-09-20 12:23:40 -0400 |
commit | f7a4440c81397051cebef64fbb9fb5b65a5eea2f (patch) | |
tree | af804a0084544c970c13febfd00a0b0e60d6a050 /src-qt5/core | |
parent | set LTE unsaved changes close dialog to follow the industry standard (diff) | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-f7a4440c81397051cebef64fbb9fb5b65a5eea2f.tar.gz lumina-f7a4440c81397051cebef64fbb9fb5b65a5eea2f.tar.bz2 lumina-f7a4440c81397051cebef64fbb9fb5b65a5eea2f.zip |
Merge branch 'master' of http://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.cpp | 23 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 22 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 18 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 2 |
5 files changed, 44 insertions, 23 deletions
diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index ff0f4734..57b6edde 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -331,11 +331,13 @@ void NativeEmbedWidget::hideEvent(QHideEvent *ev){ } void NativeEmbedWidget::paintEvent(QPaintEvent *ev){ + QPainter P(this); + P.setClipping(true); + P.setClipRect(0,0,this->width(), this->height()); + P.fillRect(ev->rect(), Qt::transparent); if(WIN==0){ return; } QRect geom = ev->rect(); //atomic updates //qDebug() << "Paint Rect:" << geom; - //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 QImage img; if(!paused){ img = windowImage(geom); } else if(!winImage.isNull()){ @@ -343,23 +345,8 @@ void NativeEmbedWidget::paintEvent(QPaintEvent *ev){ else{ img = winImage.scaled(geom.size()); } //this is a fast transformation - might be slightly distorted } //Need to paint the image from the window onto the widget as an overlay + P.drawImage( geom , img, QRect(QPoint(0,0), img.size()), Qt::NoOpaqueDetection); //1-to-1 mapping - QPainter P(this); - P.setClipping(true); - P.setClipRect(0,0,this->width(), this->height()); - //if(DISABLE_COMPOSITING){ P.fillRect(geom, Qt::black); } //get weird effects when partial-compositing is enabled if you layer transparent window frames above other windows - //qDebug() << "Paint Embed Window:" << geom << winImage.size(); - //if(winImage.size() == this->size()){ - P.drawImage( geom , img, QRect(QPoint(0,0), img.size()), 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); //auto-scale it to fit (transforming a static image while paused?) - // } - //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/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index 0ee65929..e8e9655a 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -492,7 +492,27 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native } if(props.contains(NativeWindow::WinTypes)){ QList< NativeWindow::Type> types; - types << NativeWindow::T_NORMAL; //make this load appropriately later + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_window_type_unchecked(&obj->EWMH, win->id()); + xcb_ewmh_get_atoms_reply_t reply; + if(1==xcb_ewmh_get_wm_window_type_reply(&obj->EWMH, cookie, &reply, NULL) ){ + for(unsigned int i=0; i<reply.atoms_len; i++){ + if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_DESKTOP){ types << NativeWindow::T_DESKTOP; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_DOCK){ types << NativeWindow::T_DOCK; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_TOOLBAR){ types << NativeWindow::T_TOOLBAR; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_MENU){ types << NativeWindow::T_MENU; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_UTILITY){ types << NativeWindow::T_UTILITY; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_SPLASH){ types << NativeWindow::T_SPLASH; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_DIALOG){ types << NativeWindow::T_DIALOG; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_DROPDOWN_MENU){ types << NativeWindow::T_DROPDOWN_MENU; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_POPUP_MENU){ types << NativeWindow::T_POPUP_MENU; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_TOOLTIP){ types << NativeWindow::T_TOOLTIP; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_NOTIFICATION){ types << NativeWindow::T_NOTIFICATION; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_COMBO){ types << NativeWindow::T_COMBO; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_DND){ types << NativeWindow::T_DND; } + else if(reply.atoms[i]==obj->EWMH._NET_WM_WINDOW_TYPE_NORMAL){ types << NativeWindow::T_NORMAL; } + } + } + if(types.isEmpty()){ types << NativeWindow::T_NORMAL; } win->setProperty(NativeWindow::WinTypes, QVariant::fromValue< QList<NativeWindow::Type> >(types) ); } } diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 5fb8ece4..5040f2f9 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -242,6 +242,16 @@ void RootSubWindow::enableFrame(bool on){ WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList<int> >(extents) ); //save to structure now } +void RootSubWindow::enableFrame(QList<NativeWindow::Type> types){ + static QList<NativeWindow::Type> noframe; + if(noframe.isEmpty()){ noframe << NativeWindow::T_DESKTOP << NativeWindow::T_DOCK << NativeWindow::T_TOOLBAR << NativeWindow::T_MENU << NativeWindow::T_SPLASH << NativeWindow::T_DROPDOWN_MENU << NativeWindow::T_POPUP_MENU << NativeWindow::T_TOOLTIP << NativeWindow::T_NOTIFICATION << NativeWindow::T_COMBO << NativeWindow::T_DND; } + for(int i=0; i<types.length(); i++){ + if(noframe.contains(types[i])){ enableFrame(false); return; } + } + enableFrame(true); + //Now make buttons visible as appropriate for the type + //NativeWindow::T_UTILITY, NativeWindow::T_DIALOG, , NativeWindow::T_NORMAL +} void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList<QVariant> vals; //Always ensure that visibility changes are evaluated last @@ -370,7 +380,7 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList switch(props[i]){ case NativeWindow::Visible: if(!WinWidget->isPaused() && (this->isVisible()!=vals[i].toBool()) && activeState==Normal ){ - qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); + //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); 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]); } } @@ -397,7 +407,7 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList i--; }else if(!WinWidget->isPaused() && activeState==Normal){ if(WIN->property(NativeWindow::Size).toSize() != WinWidget->size()){ - qDebug() << "Got Direct Geometry Change:" << WIN->geometry(); + //qDebug() << "Got Direct Geometry Change:" << WIN->geometry(); this->setGeometry( QRect(this->geometry().topLeft(), WIN->geometry().size()) ); WinWidget->resyncWindow(); } @@ -434,8 +444,8 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList mainLayout->setContentsMargins( vals[i].value< QList<int> >().at(0),vals[i].value< QList<int> >().at(2) - titleLabel->height(),vals[i].value< QList<int> >().at(1),vals[i].value< QList<int> >().at(3)); break;*/ case NativeWindow::WinTypes: - qDebug() << "Got Window Types:" << vals[i].value< QList<NativeWindow::Type> >(); - enableFrame(vals[i].value< QList<NativeWindow::Type> >().contains(NativeWindow::T_NORMAL) ); + //qDebug() << "Got Window Types:" << vals[i].value< QList<NativeWindow::Type> >(); + enableFrame(vals[i].value< QList<NativeWindow::Type> >() ); break; default: qDebug() << "Window Property Unused:" << props[i] << vals[i]; diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index c1964724..598298e2 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -59,12 +59,14 @@ private: void initWindowFrame(); void enableFrame(bool); + void enableFrame(QList<NativeWindow::Type> types); void LoadProperties( QList< NativeWindow::Property> list); static QStringList validAnimations(NativeWindow::Property); public slots: + void ensureVisible(){ WIN->setProperty(NativeWindow::Visible, true); } void giveMouseFocus(){ WinWidget->raiseWindow(); } void removeMouseFocus(){ WinWidget->lowerWindow(); } void giveKeyboardFocus(){ WIN->requestProperty(NativeWindow::Active, true, true); } diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index fdbc1eb8..705297be 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -239,7 +239,9 @@ void RootWindow::NewWindow(NativeWindow *win){ connect(subwin, SIGNAL(windowAnimFinished()), this, SLOT(checkMouseFocus()) ); WINDOWS << subwin; } + //QApplication::processEvents(); CheckWindowPosition(win->id(), true); //first-time run + //QTimer::singleShot(300, subwin, SLOT(ensureVisible())); win->setProperty(NativeWindow::Visible, true); //win->requestProperty( NativeWindow::Active, true); //win->requestProperties(QList<NativeWindow::Property>() << NativeWindow::Visible << NativeWindow::Active, QList<QVariant>() << true << true, true); |