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) | 306 | // m_theme->setTabDragMimeType(tabDragMimeType()); | |||
---|---|---|---|---|---|
349 | trackBorders(m_maximizedBorders); | 349 | trackBorders(m_maximizedBorders); | ||
350 | if (m_extendedBorders) { | 350 | if (m_extendedBorders) { | ||
351 | updateExtendedBorders(); | 351 | updateExtendedBorders(); | ||
352 | connect(m_extendedBorders, &KWin::Borders::leftChanged, this, &Decoration::updateExtendedBorders); | 352 | connect(m_extendedBorders, &KWin::Borders::leftChanged, this, &Decoration::updateExtendedBorders); | ||
353 | connect(m_extendedBorders, &KWin::Borders::rightChanged, this, &Decoration::updateExtendedBorders); | 353 | connect(m_extendedBorders, &KWin::Borders::rightChanged, this, &Decoration::updateExtendedBorders); | ||
354 | connect(m_extendedBorders, &KWin::Borders::topChanged, this, &Decoration::updateExtendedBorders); | 354 | connect(m_extendedBorders, &KWin::Borders::topChanged, this, &Decoration::updateExtendedBorders); | ||
355 | connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders); | 355 | connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders); | ||
356 | } | 356 | } | ||
357 | connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); | 357 | | ||
358 | connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders); | 358 | auto decorationClient = clientPointer(); | ||
359 | connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); | ||||
360 | connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders); | ||||
359 | updateBorders(); | 361 | updateBorders(); | ||
360 | if (m_view) { | 362 | if (m_view) { | ||
361 | auto resizeWindow = [this] { | 363 | auto resizeWindow = [this] { | ||
362 | QRect rect(QPoint(0, 0), size()); | 364 | QRect rect(QPoint(0, 0), size()); | ||
363 | if (m_padding && !client().data()->isMaximized()) { | 365 | if (m_padding && !clientPointer()->isMaximized()) { | ||
364 | rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom()); | 366 | rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom()); | ||
365 | } | 367 | } | ||
366 | m_view->setGeometry(rect); | 368 | m_view->setGeometry(rect); | ||
367 | }; | 369 | }; | ||
368 | connect(this, &Decoration::bordersChanged, this, resizeWindow); | 370 | connect(this, &Decoration::bordersChanged, this, resizeWindow); | ||
369 | connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow); | 371 | connect(decorationClient, &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow); | ||
370 | connect(client().data(), &KDecoration2::DecoratedClient::heightChanged, this, resizeWindow); | 372 | connect(decorationClient, &KDecoration2::DecoratedClient::heightChanged, this, resizeWindow); | ||
371 | connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, resizeWindow); | 373 | connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, resizeWindow); | ||
372 | connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, resizeWindow); | 374 | connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, resizeWindow); | ||
373 | resizeWindow(); | 375 | resizeWindow(); | ||
374 | updateBuffer(); | 376 | updateBuffer(); | ||
375 | } else { | 377 | } else { | ||
376 | // create a dummy shadow for the configuration interface | 378 | // create a dummy shadow for the configuration interface | ||
377 | if (m_padding) { | 379 | if (m_padding) { | ||
378 | auto s = QSharedPointer<KDecoration2::DecorationShadow>::create(); | 380 | auto s = QSharedPointer<KDecoration2::DecorationShadow>::create(); | ||
379 | s->setPadding(*m_padding); | 381 | s->setPadding(*m_padding); | ||
380 | s->setInnerShadowRect(QRect(m_padding->left(), m_padding->top(), 1, 1)); | 382 | s->setInnerShadowRect(QRect(m_padding->left(), m_padding->top(), 1, 1)); | ||
Show All 14 Lines | 395 | { | |||
395 | m_maximizedBorders = item->findChild<KWin::Borders*>(QStringLiteral("maximizedBorders")); | 397 | m_maximizedBorders = item->findChild<KWin::Borders*>(QStringLiteral("maximizedBorders")); | ||
396 | m_extendedBorders = item->findChild<KWin::Borders*>(QStringLiteral("extendedBorders")); | 398 | m_extendedBorders = item->findChild<KWin::Borders*>(QStringLiteral("extendedBorders")); | ||
397 | m_padding = item->findChild<KWin::Borders*>(QStringLiteral("padding")); | 399 | m_padding = item->findChild<KWin::Borders*>(QStringLiteral("padding")); | ||
398 | } | 400 | } | ||
399 | 401 | | |||
400 | void Decoration::updateBorders() | 402 | void Decoration::updateBorders() | ||
401 | { | 403 | { | ||
402 | KWin::Borders *b = m_borders; | 404 | KWin::Borders *b = m_borders; | ||
403 | if (client().data()->isMaximized() && m_maximizedBorders) { | 405 | if (clientPointer()->isMaximized() && m_maximizedBorders) { | ||
404 | b = m_maximizedBorders; | 406 | b = m_maximizedBorders; | ||
405 | } | 407 | } | ||
406 | if (!b) { | 408 | if (!b) { | ||
407 | return; | 409 | return; | ||
408 | } | 410 | } | ||
409 | setBorders(*b); | 411 | setBorders(*b); | ||
410 | 412 | | |||
411 | updateExtendedBorders(); | 413 | updateExtendedBorders(); | ||
Show All 13 Lines | |||||
425 | { | 427 | { | ||
426 | if (!m_view) { | 428 | if (!m_view) { | ||
427 | return; | 429 | return; | ||
428 | } | 430 | } | ||
429 | bool updateShadow = false; | 431 | bool updateShadow = false; | ||
430 | const auto oldShadow = shadow(); | 432 | const auto oldShadow = shadow(); | ||
431 | if (m_padding && | 433 | if (m_padding && | ||
432 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | 434 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | ||
433 | !client().data()->isMaximized()) { | 435 | !clientPointer()->isMaximized()) { | ||
434 | if (oldShadow.isNull()) { | 436 | if (oldShadow.isNull()) { | ||
435 | updateShadow = true; | 437 | updateShadow = true; | ||
436 | } else { | 438 | } else { | ||
437 | // compare padding | 439 | // compare padding | ||
438 | if (oldShadow->padding() != *m_padding) { | 440 | if (oldShadow->padding() != *m_padding) { | ||
439 | updateShadow = true; | 441 | updateShadow = true; | ||
440 | } | 442 | } | ||
441 | } | 443 | } | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | |||||
559 | { | 561 | { | ||
560 | // extended sizes | 562 | // extended sizes | ||
561 | const int extSize = settings()->largeSpacing(); | 563 | const int extSize = settings()->largeSpacing(); | ||
562 | int extLeft = m_extendedBorders->left(); | 564 | int extLeft = m_extendedBorders->left(); | ||
563 | int extRight = m_extendedBorders->right(); | 565 | int extRight = m_extendedBorders->right(); | ||
564 | int extBottom = m_extendedBorders->bottom(); | 566 | int extBottom = m_extendedBorders->bottom(); | ||
565 | 567 | | |||
566 | if (settings()->borderSize() == KDecoration2::BorderSize::None) { | 568 | if (settings()->borderSize() == KDecoration2::BorderSize::None) { | ||
567 | if (!client().data()->isMaximizedHorizontally()) { | 569 | if (!clientPointer()->isMaximizedHorizontally()) { | ||
568 | extLeft = qMax(m_extendedBorders->left(), extSize); | 570 | extLeft = qMax(m_extendedBorders->left(), extSize); | ||
569 | extRight = qMax(m_extendedBorders->right(), extSize); | 571 | extRight = qMax(m_extendedBorders->right(), extSize); | ||
570 | } | 572 | } | ||
571 | if (!client().data()->isMaximizedVertically()) { | 573 | if (!clientPointer()->isMaximizedVertically()) { | ||
572 | extBottom = qMax(m_extendedBorders->bottom(), extSize); | 574 | extBottom = qMax(m_extendedBorders->bottom(), extSize); | ||
573 | } | 575 | } | ||
574 | 576 | | |||
575 | } else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !client().data()->isMaximizedHorizontally() ) { | 577 | } else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !clientPointer()->isMaximizedHorizontally() ) { | ||
576 | extLeft = qMax(m_extendedBorders->left(), extSize); | 578 | extLeft = qMax(m_extendedBorders->left(), extSize); | ||
577 | extRight = qMax(m_extendedBorders->right(), extSize); | 579 | extRight = qMax(m_extendedBorders->right(), extSize); | ||
578 | } | 580 | } | ||
579 | 581 | | |||
580 | setResizeOnlyBorders(QMargins(extLeft, 0, extRight, extBottom)); | 582 | setResizeOnlyBorders(QMargins(extLeft, 0, extRight, extBottom)); | ||
581 | } | 583 | } | ||
582 | 584 | | |||
583 | void Decoration::updateBuffer() | 585 | void Decoration::updateBuffer() | ||
584 | { | 586 | { | ||
585 | m_contentRect = QRect(QPoint(0, 0), m_view->bufferAsImage().size()); | 587 | m_contentRect = QRect(QPoint(0, 0), m_view->bufferAsImage().size()); | ||
586 | if (m_padding && | 588 | if (m_padding && | ||
587 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | 589 | (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && | ||
588 | !client().data()->isMaximized()) { | 590 | !clientPointer()->isMaximized()) { | ||
589 | m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); | 591 | m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); | ||
590 | } | 592 | } | ||
591 | updateShadow(); | 593 | updateShadow(); | ||
592 | update(); | 594 | update(); | ||
593 | } | 595 | } | ||
594 | 596 | | |||
595 | KDecoration2::DecoratedClient *Decoration::clientPointer() const | 597 | KDecoration2::DecoratedClient *Decoration::clientPointer() const | ||
596 | { | 598 | { | ||
597 | return client().data(); | 599 | return client().toStrongRef().data(); | ||
zzag: Unrelated side note: this is really wrong! | |||||
598 | } | 600 | } | ||
599 | 601 | | |||
600 | ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args) | 602 | ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args) | ||
601 | : QObject(parent) | 603 | : QObject(parent) | ||
602 | { | 604 | { | ||
603 | Q_UNUSED(args) | 605 | Q_UNUSED(args) | ||
604 | init(); | 606 | init(); | ||
605 | } | 607 | } | ||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |
Unrelated side note: this is really wrong!