Show current compositing state (disabled/suspended/active) in Desktop Effects KCM and add a button to resume/suspend compositing. So it should be easier for the user to resume compositing if he does not know about the shortcut.
CCBUG: 188118 svn path=/trunk/KDE/kdebase/workspace/; revision=955636
This commit is contained in:
parent
f199007952
commit
63edbaff81
6 changed files with 116 additions and 2 deletions
|
@ -306,6 +306,7 @@ void Workspace::suspendCompositing( bool suspend )
|
||||||
compositingSuspended = suspend;
|
compositingSuspended = suspend;
|
||||||
finishCompositing();
|
finishCompositing();
|
||||||
setupCompositing(); // will do nothing if suspended
|
setupCompositing(); // will do nothing if suspended
|
||||||
|
emit compositingToggled( !compositingSuspended );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::resetCompositing()
|
void Workspace::resetCompositing()
|
||||||
|
|
|
@ -74,6 +74,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
||||||
: KCModule( KWinCompositingConfigFactory::componentData(), parent )
|
: KCModule( KWinCompositingConfigFactory::componentData(), parent )
|
||||||
, mKWinConfig(KSharedConfig::openConfig( "kwinrc" ))
|
, mKWinConfig(KSharedConfig::openConfig( "kwinrc" ))
|
||||||
, m_showConfirmDialog( false )
|
, m_showConfirmDialog( false )
|
||||||
|
, kwinInterface( NULL )
|
||||||
{
|
{
|
||||||
KGlobal::locale()->insertCatalog( "kwin_effects" );
|
KGlobal::locale()->insertCatalog( "kwin_effects" );
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
@ -95,6 +96,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
||||||
#define XRENDER_INDEX -1
|
#define XRENDER_INDEX -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
kwinInterface = new OrgKdeKWinInterface( "org.kde.kwin", "/KWin", QDBusConnection::sessionBus() );
|
||||||
|
|
||||||
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(compositingEnabled(bool)));
|
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(compositingEnabled(bool)));
|
||||||
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||||
|
|
||||||
|
@ -120,6 +123,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
||||||
connect(ui.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
connect(ui.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||||
connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||||
connect(ui.xrenderSmoothScale, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
connect(ui.xrenderSmoothScale, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||||
|
connect(ui.compositingStateButton, SIGNAL(clicked(bool)), kwinInterface, SLOT(toggleCompositing()));
|
||||||
|
connect(kwinInterface, SIGNAL(compositingToggled(bool)), this, SLOT(setupCompositingState(bool)));
|
||||||
|
|
||||||
// Open the temporary config file
|
// Open the temporary config file
|
||||||
// Temporary conf file is used to synchronize effect checkboxes with effect
|
// Temporary conf file is used to synchronize effect checkboxes with effect
|
||||||
|
@ -149,6 +154,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
||||||
ui.statusTitleWidget->setText(text);
|
ui.statusTitleWidget->setText(text);
|
||||||
ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
|
ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
|
||||||
ui.statusTitleWidget->show();
|
ui.statusTitleWidget->show();
|
||||||
|
|
||||||
|
setupCompositingState( false, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwincompositing"), 0,
|
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwincompositing"), 0,
|
||||||
|
@ -234,6 +241,11 @@ void KWinCompositingConfig::showConfirmDialog( bool reinitCompositing )
|
||||||
ConfirmDialog confirm;
|
ConfirmDialog confirm;
|
||||||
if( !confirm.exec())
|
if( !confirm.exec())
|
||||||
revert = true;
|
revert = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// compositing is enabled now
|
||||||
|
setupCompositingState( kwinInterface->compositingActive() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( revert )
|
if( revert )
|
||||||
{
|
{
|
||||||
|
@ -297,7 +309,8 @@ void KWinCompositingConfig::currentTabChanged(int tab)
|
||||||
void KWinCompositingConfig::loadGeneralTab()
|
void KWinCompositingConfig::loadGeneralTab()
|
||||||
{
|
{
|
||||||
KConfigGroup config(mKWinConfig, "Compositing");
|
KConfigGroup config(mKWinConfig, "Compositing");
|
||||||
ui.useCompositing->setChecked(config.readEntry("Enabled", mDefaultPrefs.enableCompositing()));
|
bool enabled = config.readEntry("Enabled", mDefaultPrefs.enableCompositing());
|
||||||
|
ui.useCompositing->setChecked( enabled );
|
||||||
ui.animationSpeedCombo->setCurrentIndex(config.readEntry("AnimationSpeed", 3 ));
|
ui.animationSpeedCombo->setCurrentIndex(config.readEntry("AnimationSpeed", 3 ));
|
||||||
|
|
||||||
// Load effect settings
|
// Load effect settings
|
||||||
|
@ -339,6 +352,48 @@ void KWinCompositingConfig::loadGeneralTab()
|
||||||
ui.desktopSwitchingCombo->setCurrentIndex( 2 );
|
ui.desktopSwitchingCombo->setCurrentIndex( 2 );
|
||||||
if( effectEnabled( "fadedesktop", effectconfig ))
|
if( effectEnabled( "fadedesktop", effectconfig ))
|
||||||
ui.desktopSwitchingCombo->setCurrentIndex( 3 );
|
ui.desktopSwitchingCombo->setCurrentIndex( 3 );
|
||||||
|
|
||||||
|
if( enabled )
|
||||||
|
setupCompositingState( kwinInterface->compositingActive() );
|
||||||
|
else
|
||||||
|
setupCompositingState( false, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void KWinCompositingConfig::setupCompositingState( bool active, bool enabled )
|
||||||
|
{
|
||||||
|
// compositing state
|
||||||
|
QString stateIcon;
|
||||||
|
QString stateText;
|
||||||
|
QString stateButtonText;
|
||||||
|
if( enabled )
|
||||||
|
{
|
||||||
|
// check if compositing is active or suspended
|
||||||
|
if( active )
|
||||||
|
{
|
||||||
|
stateIcon = QString( "dialog-ok-apply" );
|
||||||
|
stateText = i18n( "Compositing is active" );
|
||||||
|
stateButtonText = i18n( "Suspend Compositing" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stateIcon = QString( "dialog-cancel" );
|
||||||
|
stateText = i18n( "Compositing is temporarily disabled" );
|
||||||
|
stateButtonText = i18n( "Resume Compositing" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// compositing is disabled
|
||||||
|
stateIcon = QString( "dialog-cancel" );
|
||||||
|
stateText = i18n( "Compositing is disabled" );
|
||||||
|
stateButtonText = i18n( "Resume Compositing" );
|
||||||
|
}
|
||||||
|
ui.compositingStateIcon->setPixmap( KIcon( stateIcon ).pixmap( 32, 32 ) );
|
||||||
|
ui.compositingStateLabel->setText( stateText );
|
||||||
|
ui.compositingStateButton->setText( stateButtonText );
|
||||||
|
ui.compositingStateIcon->setEnabled( enabled );
|
||||||
|
ui.compositingStateLabel->setEnabled( enabled );
|
||||||
|
ui.compositingStateButton->setEnabled( enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KWinCompositingConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
|
bool KWinCompositingConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
|
||||||
|
@ -410,6 +465,10 @@ void KWinCompositingConfig::saveGeneralTab()
|
||||||
config.writeEntry("Enabled", ui.useCompositing->isChecked());
|
config.writeEntry("Enabled", ui.useCompositing->isChecked());
|
||||||
config.writeEntry("AnimationSpeed", ui.animationSpeedCombo->currentIndex());
|
config.writeEntry("AnimationSpeed", ui.animationSpeedCombo->currentIndex());
|
||||||
|
|
||||||
|
// disable the compositing state if compositing was turned off
|
||||||
|
if( !ui.useCompositing->isChecked() )
|
||||||
|
setupCompositingState( false, false );
|
||||||
|
|
||||||
// Save effects
|
// Save effects
|
||||||
KConfigGroup effectconfig(mTmpConfig, "Plugins");
|
KConfigGroup effectconfig(mTmpConfig, "Plugins");
|
||||||
#define WRITE_EFFECT_CONFIG(effectname, widget) effectconfig.writeEntry("kwin4_effect_" effectname "Enabled", widget->isChecked())
|
#define WRITE_EFFECT_CONFIG(effectname, widget) effectconfig.writeEntry("kwin4_effect_" effectname "Enabled", widget->isChecked())
|
||||||
|
|
|
@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <ksharedconfig.h>
|
#include <ksharedconfig.h>
|
||||||
#include <ktemporaryfile.h>
|
#include <ktemporaryfile.h>
|
||||||
|
|
||||||
|
#include "kwin_interface.h"
|
||||||
|
|
||||||
#include "ui_main.h"
|
#include "ui_main.h"
|
||||||
#include "compositingprefs.h"
|
#include "compositingprefs.h"
|
||||||
#include "ktimerdialog.h"
|
#include "ktimerdialog.h"
|
||||||
|
@ -71,6 +73,7 @@ class KWinCompositingConfig : public KCModule
|
||||||
|
|
||||||
void configChanged(bool reinitCompositing);
|
void configChanged(bool reinitCompositing);
|
||||||
void initEffectSelector();
|
void initEffectSelector();
|
||||||
|
void setupCompositingState( bool active, bool enabled = true );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;
|
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;
|
||||||
|
@ -83,6 +86,8 @@ class KWinCompositingConfig : public KCModule
|
||||||
KTemporaryFile mTmpConfigFile;
|
KTemporaryFile mTmpConfigFile;
|
||||||
KSharedConfigPtr mTmpConfig;
|
KSharedConfigPtr mTmpConfig;
|
||||||
bool m_showConfirmDialog;
|
bool m_showConfirmDialog;
|
||||||
|
|
||||||
|
OrgKdeKWinInterface* kwinInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="compositingOptionsContainer" native="true">
|
<widget class="QWidget" name="compositingOptionsContainer" native="true">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Common Settings</string>
|
<string>Common Settings</string>
|
||||||
|
@ -225,6 +225,49 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Compositing State</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="compositingStateIcon">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="compositingStateLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="compositingStateButton">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
<method name="circulateDesktopApplications"/>
|
<method name="circulateDesktopApplications"/>
|
||||||
<signal name="reloadConfig"/>
|
<signal name="reloadConfig"/>
|
||||||
<signal name="reinitCompositing"/>
|
<signal name="reinitCompositing"/>
|
||||||
|
<signal name="compositingToggled">
|
||||||
|
<arg name="active" type="b" direction="out"/>
|
||||||
|
</signal>
|
||||||
<method name="loadEffect">
|
<method name="loadEffect">
|
||||||
<arg name="name" type="s" direction="in"/>
|
<arg name="name" type="s" direction="in"/>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -644,6 +644,9 @@ class Workspace : public QObject, public KDecorationDefines
|
||||||
protected:
|
protected:
|
||||||
bool keyPressMouseEmulation( XKeyEvent& ev );
|
bool keyPressMouseEmulation( XKeyEvent& ev );
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
Q_SCRIPTABLE void compositingToggled( bool active );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void initShortcuts();
|
void initShortcuts();
|
||||||
|
|
Loading…
Reference in a new issue