Changeset View
Changeset View
Standalone View
Standalone View
plugins/kdecorations/aurorae/src/aurorae.cpp
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | 337 | if (usingGL) { | |||
---|---|---|---|---|---|
349 | m_offscreenSurface->create(); | 349 | m_offscreenSurface->create(); | ||
350 | 350 | | |||
351 | } | 351 | } | ||
352 | 352 | | |||
353 | // delay rendering a little bit for better performance | 353 | // delay rendering a little bit for better performance | ||
354 | m_updateTimer.reset(new QTimer); | 354 | m_updateTimer.reset(new QTimer); | ||
355 | m_updateTimer->setSingleShot(true); | 355 | m_updateTimer->setSingleShot(true); | ||
356 | m_updateTimer->setInterval(5); | 356 | m_updateTimer->setInterval(5); | ||
357 | connect(m_updateTimer.data(), &QTimer::timeout, this, | 357 | | ||
358 | [this, usingGL] { | 358 | | ||
359 | auto updateBuffer = [this, usingGL] { | ||||
359 | if (usingGL) { | 360 | if (usingGL) { | ||
360 | if (!m_context->makeCurrent(m_offscreenSurface.data())) { | 361 | if (!m_context->makeCurrent(m_offscreenSurface.data())) { | ||
361 | return; | 362 | return; | ||
362 | } | 363 | } | ||
363 | if (m_fbo.isNull() || m_fbo->size() != m_view->size()) { | 364 | if (m_fbo.isNull() || m_fbo->size() != m_view->size()) { | ||
364 | m_fbo.reset(new QOpenGLFramebufferObject(m_view->size(), QOpenGLFramebufferObject::CombinedDepthStencil)); | 365 | m_fbo.reset(new QOpenGLFramebufferObject(m_view->size(), QOpenGLFramebufferObject::CombinedDepthStencil)); | ||
365 | if (!m_fbo->isValid()) { | 366 | if (!m_fbo->isValid()) { | ||
366 | qCWarning(AURORAE) << "Creating FBO as render target failed"; | 367 | qCWarning(AURORAE) << "Creating FBO as render target failed"; | ||
Show All 12 Lines | 379 | if (m_padding && | |||
379 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | 380 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | ||
380 | !client().data()->isMaximized()) { | 381 | !client().data()->isMaximized()) { | ||
381 | m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); | 382 | m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); | ||
382 | } | 383 | } | ||
383 | updateShadow(); | 384 | updateShadow(); | ||
384 | 385 | | |||
385 | QOpenGLFramebufferObject::bindDefault(); | 386 | QOpenGLFramebufferObject::bindDefault(); | ||
386 | update(); | 387 | update(); | ||
387 | } | 388 | }; | ||
388 | ); | 389 | connect(m_updateTimer.data(), &QTimer::timeout, this, updateBuffer); | ||
389 | auto requestUpdate = [this] { | 390 | auto requestUpdate = [this] { | ||
390 | if (m_updateTimer->isActive()) { | 391 | if (m_updateTimer->isActive()) { | ||
391 | return; | 392 | return; | ||
392 | } | 393 | } | ||
393 | m_updateTimer->start(); | 394 | m_updateTimer->start(); | ||
394 | }; | 395 | }; | ||
395 | connect(m_renderControl, &QQuickRenderControl::renderRequested, this, requestUpdate); | 396 | connect(m_renderControl, &QQuickRenderControl::renderRequested, this, requestUpdate); | ||
396 | connect(m_renderControl, &QQuickRenderControl::sceneChanged, this, requestUpdate); | 397 | connect(m_renderControl, &QQuickRenderControl::sceneChanged, this, requestUpdate); | ||
397 | 398 | | |||
398 | m_item->setParentItem(m_view->contentItem()); | 399 | m_item->setParentItem(m_view->contentItem()); | ||
399 | 400 | | |||
400 | if (usingGL) { | 401 | if (usingGL) { | ||
401 | m_context->makeCurrent(m_offscreenSurface.data()); | 402 | m_context->makeCurrent(m_offscreenSurface.data()); | ||
402 | m_renderControl->initialize(m_context.data()); | 403 | m_renderControl->initialize(m_context.data()); | ||
403 | m_context->doneCurrent(); | 404 | m_context->doneCurrent(); | ||
404 | } | 405 | } | ||
406 | updateBuffer(); | ||||
zzag: We can't do this here because m_view hasn't been resized yet.
Color attachment is considered… | |||||
405 | } | 407 | } | ||
406 | setupBorders(m_item); | 408 | setupBorders(m_item); | ||
407 | // TODO: Is there a more efficient way to react to border changes? | 409 | // TODO: Is there a more efficient way to react to border changes? | ||
408 | auto trackBorders = [this](KWin::Borders *borders) { | 410 | auto trackBorders = [this](KWin::Borders *borders) { | ||
409 | if (!borders) { | 411 | if (!borders) { | ||
410 | return; | 412 | return; | ||
411 | } | 413 | } | ||
412 | connect(borders, &KWin::Borders::leftChanged, this, &Decoration::updateBorders); | 414 | connect(borders, &KWin::Borders::leftChanged, this, &Decoration::updateBorders); | ||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Line(s) | 624 | { | |||
631 | connect(item, &QQuickItem::widthChanged, this, update); | 633 | connect(item, &QQuickItem::widthChanged, this, update); | ||
632 | connect(item, &QQuickItem::heightChanged, this, update); | 634 | connect(item, &QQuickItem::heightChanged, this, update); | ||
633 | connect(item, &QQuickItem::xChanged, this, update); | 635 | connect(item, &QQuickItem::xChanged, this, update); | ||
634 | connect(item, &QQuickItem::yChanged, this, update); | 636 | connect(item, &QQuickItem::yChanged, this, update); | ||
635 | } | 637 | } | ||
636 | 638 | | |||
637 | KDecoration2::DecoratedClient *Decoration::clientPointer() const | 639 | KDecoration2::DecoratedClient *Decoration::clientPointer() const | ||
638 | { | 640 | { | ||
639 | return client().data(); | 641 | return client().data(); | ||
640 | } | 642 | } | ||
641 | 643 | | |||
642 | ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args) | 644 | ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args) | ||
643 | : QObject(parent) | 645 | : QObject(parent) | ||
644 | { | 646 | { | ||
645 | Q_UNUSED(args) | 647 | Q_UNUSED(args) | ||
646 | init(); | 648 | init(); | ||
647 | } | 649 | } | ||
648 | 650 | | |||
649 | void ThemeFinder::init() | 651 | void ThemeFinder::init() | ||
650 | { | 652 | { | ||
651 | findAllQmlThemes(); | 653 | findAllQmlThemes(); | ||
652 | findAllSvgThemes(); | 654 | findAllSvgThemes(); | ||
653 | } | 655 | } | ||
654 | 656 | | |||
655 | void ThemeFinder::findAllQmlThemes() | 657 | void ThemeFinder::findAllQmlThemes() | ||
656 | { | 658 | { | ||
657 | const auto offers = KPackage::PackageLoader::self()->findPackages(QStringLiteral("KWin/Decoration"), s_qmlPackageFolder); | 659 | const auto offers = KPackage::PackageLoader::self()->findPackages(QStringLiteral("KWin/Decoration"), s_qmlPackageFolder); | ||
658 | for (const auto &offer : offers) { | 660 | for (const auto &offer : offers) { | ||
659 | m_themes.insert(offer.name(), offer.pluginId()); | 661 | m_themes.insert(offer.name(), offer.pluginId()); | ||
660 | } | 662 | } | ||
661 | } | 663 | } | ||
662 | 664 | | |||
663 | void ThemeFinder::findAllSvgThemes() | 665 | void ThemeFinder::findAllSvgThemes() | ||
664 | { | 666 | { | ||
665 | QStringList themes; | 667 | QStringList themes; | ||
666 | const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("aurorae/themes/"), QStandardPaths::LocateDirectory); | 668 | const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("aurorae/themes/"), QStandardPaths::LocateDirectory); | ||
667 | QStringList themeDirectories; | 669 | QStringList themeDirectories; | ||
668 | for (const QString &dir : dirs) { | 670 | for (const QString &dir : dirs) { | ||
669 | QDir directory = QDir(dir); | 671 | QDir directory = QDir(dir); | ||
zzag: Indent this code with 4 spaces, rather than 8. | |||||
670 | for (const QString &themeDir : directory.entryList(QDir::AllDirs | QDir::NoDotAndDotDot)) { | 672 | for (const QString &themeDir : directory.entryList(QDir::AllDirs | QDir::NoDotAndDotDot)) { | ||
671 | themeDirectories << dir + themeDir; | 673 | themeDirectories << dir + themeDir; | ||
672 | } | 674 | } | ||
673 | } | 675 | } | ||
674 | for (const QString &dir : themeDirectories) { | 676 | for (const QString &dir : themeDirectories) { | ||
675 | for (const QString & file : QDir(dir).entryList(QStringList() << QStringLiteral("metadata.desktop"))) { | 677 | for (const QString & file : QDir(dir).entryList(QStringList() << QStringLiteral("metadata.desktop"))) { | ||
676 | themes.append(dir + '/' + file); | 678 | themes.append(dir + '/' + file); | ||
677 | } | 679 | } | ||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
We can't do this here because m_view hasn't been resized yet.
Color attachment is considered to be incomplete if its width or height is less than 1.
https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/mesa/main/fbobject.c#L856