From 25a056e17101d78aaea4b00e9d664dc3c154ae6f Mon Sep 17 00:00:00 2001 From: Christoph Feck Date: Fri, 31 Jul 2009 15:38:12 +0000 Subject: [PATCH] Fix preview margins * limit to 10 pixels, regardless of what the client announces * "old" clients have the same margins for consistency * use KWindowSystem::compositingActive() instead of D-Bus Reviewed by Lucas Murray svn path=/trunk/KDE/kdebase/workspace/; revision=1005231 --- kcmkwin/kwindecoration/kwindecoration.cpp | 2 +- kcmkwin/kwindecoration/preview.cpp | 31 ++++++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index 58ccf8a700..76f9c835de 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -158,7 +158,7 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList & // preview QVBoxLayout* previewLayout = new QVBoxLayout(); layout->addLayout( previewLayout ); - previewLayout->setMargin( KDialog::marginHint() ); + previewLayout->setMargin( 0 ); preview = new KDecorationPreview( this ); previewLayout->addWidget(preview); diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index 2cc3220c5f..bcad4d8821 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -23,8 +23,6 @@ #include #include #include -#include -#include #include #include //Added by qt3to4: @@ -39,6 +37,7 @@ #include #include #include +#include // FRAME the preview doesn't update to reflect the changes done in the kcm @@ -145,12 +144,24 @@ void KDecorationPreview::positionPreviews() size = QSize( width() - xoffset, height() - titleBarHeight ) .expandedTo( deco[Active]->minimumSize() ); geometry = QRect( QPoint( 0, titleBarHeight ), size ); + if (KDecorationUnstable *unstable = qobject_cast(deco[Active])) { + int padLeft, padRight, padTop, padBottom; + unstable->padding(padLeft, padRight, padTop, padBottom); + geometry.adjust(-padLeft, -padTop, padRight, padBottom); + } + geometry.adjust(10, 10, -10, -10); deco[Active]->widget()->setGeometry( QStyle::visualRect( this->layoutDirection(), this->rect(), geometry ) ); // Resize the inactive window size = QSize( width() - xoffset, height() - titleBarHeight ) .expandedTo( deco[Inactive]->minimumSize() ); geometry = QRect( QPoint( xoffset, 0 ), size ); + if (KDecorationUnstable *unstable = qobject_cast(deco[Inactive])) { + int padLeft, padRight, padTop, padBottom; + unstable->padding(padLeft, padRight, padTop, padBottom); + geometry.adjust(-padLeft, -padTop, padRight, padBottom); + } + geometry.adjust(10, 10, -10, -10); deco[Inactive]->widget()->setGeometry( QStyle::visualRect( this->layoutDirection(), this->rect(), geometry ) ); } @@ -442,21 +453,7 @@ void KDecorationPreviewBridge::grabXServer( bool ) bool KDecorationPreviewBridge::compositingActive() const { - - QDBusMessage message = QDBusMessage::createMethodCall( "org.kde.kwin", "/KWin", "org.kde.KWin", "compositingActive" ); - QDBusMessage reply = QDBusConnection::sessionBus().call( message ); - if( reply.type() != QDBusMessage::ReplyMessage ) - { - return false; - } - - if( reply.arguments().empty() ) - { - return false; - } - - return reply.arguments()[0].toBool(); - + return KWindowSystem::compositingActive(); } KDecorationPreviewOptions::KDecorationPreviewOptions()