unify composite activation, 'Enable' only controls initial state
This commit is contained in:
parent
3529c34934
commit
0c5d47f3ae
8 changed files with 401 additions and 374 deletions
|
@ -89,39 +89,16 @@ void Workspace::setupCompositing()
|
|||
#ifdef KWIN_HAVE_COMPOSITING
|
||||
if (scene != NULL)
|
||||
return;
|
||||
if (!options->useCompositing && getenv("KWIN_COMPOSE") == NULL) {
|
||||
kDebug(1212) << "Compositing is turned off in options or disabled";
|
||||
return;
|
||||
} else if (compositingSuspended) {
|
||||
if (compositingSuspended) {
|
||||
kDebug(1212) << "Compositing is suspended";
|
||||
return;
|
||||
} else if (!CompositingPrefs::compositingPossible()) {
|
||||
kError(1212) << "Compositing is not possible";
|
||||
return;
|
||||
}
|
||||
CompositingType type = options->compositingMode;
|
||||
if (getenv("KWIN_COMPOSE")) {
|
||||
char c = getenv("KWIN_COMPOSE")[ 0 ];
|
||||
switch(c) {
|
||||
case 'O':
|
||||
kDebug(1212) << "Compositing forced to OpenGL mode by environment variable";
|
||||
type = OpenGLCompositing;
|
||||
break;
|
||||
case 'X':
|
||||
kDebug(1212) << "Compositing forced to XRender mode by environment variable";
|
||||
type = XRenderCompositing;
|
||||
break;
|
||||
case 'N':
|
||||
if (getenv("KDE_FAILSAFE"))
|
||||
kDebug(1212) << "Compositing disabled forcefully by KDE failsafe mode";
|
||||
else
|
||||
kDebug(1212) << "Compositing disabled forcefully by environment variable";
|
||||
return; // Return not break
|
||||
default:
|
||||
kDebug(1212) << "Unknown KWIN_COMPOSE mode set, ignoring";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!options->compositingInitialized)
|
||||
options->reloadCompositingSettings(true);
|
||||
|
||||
char selection_name[ 100 ];
|
||||
sprintf(selection_name, "_NET_WM_CM_S%d", DefaultScreen(display()));
|
||||
|
@ -129,7 +106,7 @@ void Workspace::setupCompositing()
|
|||
connect(cm_selection, SIGNAL(lostOwnership()), SLOT(lostCMSelection()));
|
||||
cm_selection->claim(true); // force claiming
|
||||
|
||||
switch(type) {
|
||||
switch(options->compositingMode) {
|
||||
/*case 'B':
|
||||
kDebug( 1212 ) << "X compositing";
|
||||
scene = new SceneBasic( this );
|
||||
|
@ -295,7 +272,7 @@ void Workspace::toggleCompositing()
|
|||
QString shortcut, message;
|
||||
if (KAction* action = qobject_cast<KAction*>(keys->action("Suspend Compositing")))
|
||||
shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText);
|
||||
if (!shortcut.isEmpty() && options->useCompositing) {
|
||||
if (!shortcut.isEmpty()) {
|
||||
// display notification only if there is the shortcut
|
||||
message = i18n("Desktop effects have been suspended by another application.<br/>"
|
||||
"You can resume using the '%1' shortcut.", shortcut);
|
||||
|
|
|
@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "kwin_interface.h"
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kdebug.h>
|
||||
|
@ -74,13 +76,10 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
: KCModule(KWinCompositingConfigFactory::componentData(), parent)
|
||||
, mKWinConfig(KSharedConfig::openConfig("kwinrc"))
|
||||
, m_showConfirmDialog(false)
|
||||
, kwinInterface(NULL)
|
||||
{
|
||||
KGlobal::locale()->insertCatalog("kwin_effects");
|
||||
ui.setupUi(this);
|
||||
layout()->setMargin(0);
|
||||
ui.verticalSpacer->changeSize(20, KDialog::groupSpacingHint());
|
||||
ui.verticalSpacer_2->changeSize(20, KDialog::groupSpacingHint());
|
||||
ui.tabWidget->setCurrentIndex(0);
|
||||
ui.statusTitleWidget->hide();
|
||||
|
||||
|
@ -101,9 +100,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
#define XRENDER_INDEX -1
|
||||
#endif
|
||||
|
||||
kwinInterface = new OrgKdeKWinInterface("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
|
||||
|
||||
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(compositingEnabled(bool)));
|
||||
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||
|
||||
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
|
@ -128,8 +124,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
|
||||
connect(ui.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(ui.glVSync, 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
|
||||
// Temporary conf file is used to synchronize effect checkboxes with effect
|
||||
|
@ -138,6 +132,16 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
mTmpConfigFile.open();
|
||||
mTmpConfig = KSharedConfig::openConfig(mTmpConfigFile.fileName());
|
||||
|
||||
// toggle effects shortcut button stuff - /HAS/ to happen before load!
|
||||
m_actionCollection = new KActionCollection( this, KComponentData("kwin") );
|
||||
m_actionCollection->setConfigGroup("Suspend Compositing");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a = static_cast<KAction*>(m_actionCollection->addAction( "Suspend Compositing" ));
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
a->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_F12 ));
|
||||
connect(ui.toggleEffectsShortcut, SIGNAL(keySequenceChanged(const QKeySequence&)), this, SLOT(toggleEffectShortcutChanged(const QKeySequence&)));
|
||||
|
||||
// NOTICE: this is intended to workaround broken GL implementations that successfully segfault on glXQuery :-(
|
||||
KConfigGroup unsafeConfig(mKWinConfig, "Compositing");
|
||||
const bool glUnsafe = unsafeConfig.readEntry("OpenGLIsUnsafe", false);
|
||||
|
@ -158,7 +162,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
|
||||
ui.useCompositing->setEnabled(false);
|
||||
ui.useCompositing->setChecked(false);
|
||||
compositingEnabled(false);
|
||||
|
||||
QString text = i18n("Desktop effects are not available on this system due to the following technical issues:");
|
||||
text += "<br>";
|
||||
|
@ -166,8 +169,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
ui.statusTitleWidget->setText(text);
|
||||
ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
|
||||
ui.statusTitleWidget->show();
|
||||
|
||||
setupCompositingState(false, false);
|
||||
}
|
||||
|
||||
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwincompositing"), 0,
|
||||
|
@ -225,14 +226,6 @@ void KWinCompositingConfig::reparseConfiguration(const QByteArray& conf)
|
|||
KSettings::Dispatcher::reparseConfiguration(conf);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::compositingEnabled(bool enabled)
|
||||
{
|
||||
// Enable the other configuration tabs only when compositing is enabled.
|
||||
ui.compositingOptionsContainer->setEnabled(enabled);
|
||||
ui.tabWidget->setTabEnabled(1, enabled);
|
||||
ui.tabWidget->setTabEnabled(2, enabled);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::showConfirmDialog(bool reinitCompositing)
|
||||
{
|
||||
bool revert = false;
|
||||
|
@ -252,7 +245,6 @@ void KWinCompositingConfig::showConfirmDialog(bool reinitCompositing)
|
|||
revert = true;
|
||||
else {
|
||||
// compositing is enabled now
|
||||
setupCompositingState(kwinInterface->compositingActive());
|
||||
checkLoadedEffects();
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +307,12 @@ void KWinCompositingConfig::loadGeneralTab()
|
|||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
bool enabled = config.readEntry("Enabled", mDefaultPrefs.recommendCompositing());
|
||||
ui.useCompositing->setChecked(enabled);
|
||||
|
||||
// this works by global shortcut magics - it will pick the current sc
|
||||
// but the constructor line that adds the default alt+shift+f12 gsc is IMPORTANT!
|
||||
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("Suspend Compositing")))
|
||||
ui.toggleEffectsShortcut->setKeySequence(a->globalShortcut().primary());
|
||||
|
||||
ui.animationSpeedCombo->setCurrentIndex(config.readEntry("AnimationSpeed", 3));
|
||||
|
||||
// Load effect settings
|
||||
|
@ -356,46 +354,8 @@ void KWinCompositingConfig::loadGeneralTab()
|
|||
ui.desktopSwitchingCombo->setCurrentIndex(2);
|
||||
if (effectEnabled("fadedesktop", effectconfig))
|
||||
ui.desktopSwitchingCombo->setCurrentIndex(3);
|
||||
|
||||
if (enabled)
|
||||
setupCompositingState(kwinInterface->compositingActive());
|
||||
else
|
||||
setupCompositingState(false, false);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::setupCompositingState(bool active, bool enabled)
|
||||
{
|
||||
if (!qgetenv("KDE_FAILSAFE").isNull())
|
||||
enabled = false;
|
||||
// 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("Desktop effects are active");
|
||||
stateButtonText = i18n("Suspend Desktop Effects");
|
||||
} else {
|
||||
stateIcon = QString("dialog-cancel");
|
||||
stateText = i18n("Desktop effects are temporarily disabled");
|
||||
stateButtonText = i18n("Resume Desktop Effects");
|
||||
}
|
||||
} else {
|
||||
// compositing is disabled
|
||||
stateIcon = QString("dialog-cancel");
|
||||
stateText = i18n("Desktop effects are disabled");
|
||||
stateButtonText = i18n("Resume Desktop Effects");
|
||||
}
|
||||
const int iconSize = (QApplication::fontMetrics().height() > 24) ? 32 : 22;
|
||||
ui.compositingStateIcon->setPixmap(KIcon(stateIcon).pixmap(iconSize, iconSize));
|
||||
ui.compositingStateLabel->setText(stateText);
|
||||
ui.compositingStateButton->setText(stateButtonText);
|
||||
ui.compositingStateIcon->setEnabled(enabled);
|
||||
ui.compositingStateLabel->setEnabled(enabled);
|
||||
ui.compositingStateButton->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::toogleSmoothScaleUi(int compositingType)
|
||||
{
|
||||
|
@ -404,6 +364,13 @@ void KWinCompositingConfig::toogleSmoothScaleUi(int compositingType)
|
|||
ui.scaleMethodLabel->setBuddy(compositingType == XRENDER_INDEX ? ui.xrScaleFilter : ui.glScaleFilter);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::toggleEffectShortcutChanged(const QKeySequence &seq)
|
||||
{
|
||||
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("Suspend Compositing")))
|
||||
a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut, KAction::NoAutoloading);
|
||||
m_actionCollection->writeSettings();
|
||||
}
|
||||
|
||||
bool KWinCompositingConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const
|
||||
{
|
||||
KService::List services = KServiceTypeTrader::self()->query(
|
||||
|
@ -467,17 +434,9 @@ void KWinCompositingConfig::saveGeneralTab()
|
|||
{
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
// Check if any critical settings that need confirmation have changed
|
||||
if (ui.useCompositing->isChecked() &&
|
||||
ui.useCompositing->isChecked() != config.readEntry("Enabled", mDefaultPrefs.recommendCompositing()))
|
||||
m_showConfirmDialog = true;
|
||||
|
||||
config.writeEntry("Enabled", ui.useCompositing->isChecked());
|
||||
config.writeEntry("AnimationSpeed", ui.animationSpeedCombo->currentIndex());
|
||||
|
||||
// disable the compositing state if compositing was turned off
|
||||
if (!ui.useCompositing->isChecked())
|
||||
setupCompositingState(false, false);
|
||||
|
||||
// Save effects
|
||||
KConfigGroup effectconfig(mTmpConfig, "Plugins");
|
||||
#define WRITE_EFFECT_CONFIG(effectname, widget) effectconfig.writeEntry("kwin4_effect_" effectname "Enabled", widget->isChecked())
|
||||
|
|
|
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "ktimerdialog.h"
|
||||
|
||||
class KPluginSelector;
|
||||
class KActionCollection;
|
||||
class QLabel;
|
||||
|
||||
namespace KWin
|
||||
|
@ -55,7 +56,6 @@ public:
|
|||
virtual QString quickHelp() const;
|
||||
|
||||
public slots:
|
||||
virtual void compositingEnabled(bool enabled);
|
||||
virtual void showConfirmDialog(bool reinitCompositing);
|
||||
void currentTabChanged(int tab);
|
||||
|
||||
|
@ -74,10 +74,10 @@ public slots:
|
|||
void checkLoadedEffects();
|
||||
void configChanged(bool reinitCompositing);
|
||||
void initEffectSelector();
|
||||
void setupCompositingState(bool active, bool enabled = true);
|
||||
|
||||
private slots:
|
||||
void toogleSmoothScaleUi(int compositingType);
|
||||
void toggleEffectShortcutChanged(const QKeySequence &seq);
|
||||
|
||||
private:
|
||||
bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const;
|
||||
|
@ -90,8 +90,7 @@ private:
|
|||
KTemporaryFile mTmpConfigFile;
|
||||
KSharedConfigPtr mTmpConfig;
|
||||
bool m_showConfirmDialog;
|
||||
|
||||
OrgKdeKWinInterface* kwinInterface;
|
||||
KActionCollection* m_actionCollection;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>595</width>
|
||||
<height>483</height>
|
||||
<width>560</width>
|
||||
<height>472</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
|
@ -20,249 +20,323 @@
|
|||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="KTitleWidget" name="statusTitleWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useCompositing">
|
||||
<property name="text">
|
||||
<string comment="@option:check">Enable desktop effects</string>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="compositingOptionsContainer" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Common Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="effectWinManagement">
|
||||
<property name="text">
|
||||
<string>Improved window management</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="effectAnimations">
|
||||
<property name="text">
|
||||
<string>Various animations</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>You can find more effects, as well as effect-specific settings, in the "All Effects" tab above.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Effect for window switching:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>windowSwitchingCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KComboBox" name="windowSwitchingCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KComboBox" name="desktopSwitchingCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="KComboBox" name="animationSpeedCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="QWidget" name="compositingOptionsContainer" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Activation</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Instant</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="useCompositing">
|
||||
<property name="text">
|
||||
<string comment="@option:check">Enable desktop effects at startup</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very Fast</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Desktop effects can be toggled anytime using this shortcut:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KKeySequenceWidget" name="toggleEffectsShortcut"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fast</string>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Simple effect setup</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="effectWinManagement">
|
||||
<property name="text">
|
||||
<string>Improved window management</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="effectAnimations">
|
||||
<property name="text">
|
||||
<string>Various animations</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Slow</string>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Effect for window switching:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>windowSwitchingCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very Slow</string>
|
||||
</property>
|
||||
<item row="2" column="1">
|
||||
<widget class="KComboBox" name="windowSwitchingCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Extremely Slow</string>
|
||||
</property>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Animation speed:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>animationSpeedCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Effect for desktop switching:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>windowSwitchingCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Effect for desktop switching:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>windowSwitchingCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KComboBox" name="desktopSwitchingCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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 row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Animation speed:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>animationSpeedCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KComboBox" name="animationSpeedCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Instant</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very Fast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Slow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very Slow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Extremely Slow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<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 row="5" column="0" colspan="3">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You can find more effects, as well as effect-specific settings, in the "All Effects" tab above.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
|
@ -271,8 +345,8 @@
|
|||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
<width>512</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
@ -569,6 +643,11 @@ p, li { white-space: pre-wrap; }
|
|||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KKeySequenceWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>kkeysequencewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KTitleWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
|
@ -596,22 +675,5 @@ p, li { white-space: pre-wrap; }
|
|||
<tabstop>animationSpeedCombo</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>useCompositing</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>groupBox</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>86</x>
|
||||
<y>66</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>102</x>
|
||||
<y>156</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
67
options.cpp
67
options.cpp
|
@ -98,6 +98,7 @@ Options::Options()
|
|||
: electric_borders(0)
|
||||
, electric_border_delay(0)
|
||||
{
|
||||
compositingInitialized = false;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
|
@ -264,39 +265,67 @@ FIXME: we have no mac style menu implementation in kwin anymore, so this just br
|
|||
// KDE4 this probably needs to be done manually in clients
|
||||
|
||||
// Driver-specific config detection
|
||||
compositingInitialized = false;
|
||||
reloadCompositingSettings();
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void Options::reloadCompositingSettings()
|
||||
void Options::reloadCompositingSettings(bool force)
|
||||
{
|
||||
KSharedConfig::Ptr _config = KGlobal::config();
|
||||
KConfigGroup config(_config, "Compositing");
|
||||
|
||||
// do not even detect compositing preferences if explicitly disabled
|
||||
bool environmentForce = false;
|
||||
if (getenv("KWIN_COMPOSE")) {
|
||||
// if compositing is enforced by the environment variable, the preferences have to be read
|
||||
const char c = getenv("KWIN_COMPOSE")[ 0 ];
|
||||
if (c == 'X' || c == 'O')
|
||||
environmentForce = true;
|
||||
}
|
||||
if (config.hasKey("Enabled") && !config.readEntry("Enabled", true) && !environmentForce) {
|
||||
useCompositing = false;
|
||||
return;
|
||||
}
|
||||
// Compositing settings
|
||||
CompositingPrefs prefs;
|
||||
prefs.detect();
|
||||
|
||||
useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing());
|
||||
|
||||
QString compositingBackend = config.readEntry("Backend", "OpenGL");
|
||||
if (compositingBackend == "XRender")
|
||||
compositingMode = XRenderCompositing;
|
||||
else
|
||||
compositingMode = OpenGLCompositing;
|
||||
|
||||
useCompositing = false;
|
||||
if (const char *c = getenv("KWIN_COMPOSE")) {
|
||||
switch(c[0]) {
|
||||
case 'O':
|
||||
kDebug(1212) << "Compositing forced to OpenGL mode by environment variable";
|
||||
compositingMode = OpenGLCompositing;
|
||||
useCompositing = true;
|
||||
break;
|
||||
case 'X':
|
||||
kDebug(1212) << "Compositing forced to XRender mode by environment variable";
|
||||
compositingMode = XRenderCompositing;
|
||||
useCompositing = true;
|
||||
break;
|
||||
case 'N':
|
||||
if (getenv("KDE_FAILSAFE"))
|
||||
kDebug(1212) << "Compositing disabled forcefully by KDE failsafe mode";
|
||||
else
|
||||
kDebug(1212) << "Compositing disabled forcefully by environment variable";
|
||||
compositingMode = NoCompositing;
|
||||
break;
|
||||
default:
|
||||
kDebug(1212) << "Unknown KWIN_COMPOSE mode set, ignoring";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (compositingMode == NoCompositing)
|
||||
return; // do not even detect compositing preferences if explicitly disabled
|
||||
|
||||
// it's either enforced by env or by initial resume from "suspend" or we check the settings
|
||||
useCompositing = useCompositing || force || config.readEntry("Enabled", true);
|
||||
|
||||
if (!useCompositing)
|
||||
return; // not enforced or necessary and not "enabled" by setting
|
||||
|
||||
// from now on we've an initial setup and don't have to reload settigns on compositing activation
|
||||
// see Workspace::setupCompositing(), composite.cpp
|
||||
compositingInitialized = true;
|
||||
|
||||
// Compositing settings
|
||||
CompositingPrefs prefs;
|
||||
prefs.detect();
|
||||
|
||||
useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing());
|
||||
disableCompositingChecks = config.readEntry("DisableChecks", false);
|
||||
glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering());
|
||||
glVSync = config.readEntry("GLVSync", prefs.enableVSync());
|
||||
|
|
|
@ -363,9 +363,10 @@ public:
|
|||
|
||||
//----------------------
|
||||
// Compositing settings
|
||||
|
||||
void reloadCompositingSettings(bool force = false);
|
||||
CompositingType compositingMode;
|
||||
bool useCompositing; // Separate to mode so the user can toggle
|
||||
bool compositingInitialized;
|
||||
|
||||
// General preferences
|
||||
HiddenPreviews hiddenPreviews;
|
||||
|
@ -431,7 +432,6 @@ private:
|
|||
int animationSpeed; // 0 - instant, 5 - very slow
|
||||
|
||||
MouseCommand wheelToMouseCommand(MouseWheelCommand com, int delta);
|
||||
void reloadCompositingSettings();
|
||||
};
|
||||
|
||||
extern Options* options;
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace KWin
|
|||
// Scene
|
||||
//****************************************
|
||||
|
||||
Scene* scene;
|
||||
Scene* scene = 0;
|
||||
|
||||
Scene::Scene(Workspace* ws)
|
||||
: wspace(ws)
|
||||
|
|
|
@ -217,6 +217,7 @@ Workspace::Workspace(bool restore)
|
|||
);
|
||||
|
||||
Extensions::init();
|
||||
compositingSuspended = !options->useCompositing;
|
||||
setupCompositing();
|
||||
|
||||
// Compatibility
|
||||
|
@ -1100,7 +1101,7 @@ void Workspace::slotReconfigure()
|
|||
updateCurrentTopMenu();
|
||||
}
|
||||
|
||||
if (options->useCompositing && !compositingSuspended) {
|
||||
if (!compositingSuspended) {
|
||||
setupCompositing();
|
||||
if (effects) // setupCompositing() may fail
|
||||
effects->reconfigure();
|
||||
|
@ -1143,7 +1144,6 @@ void Workspace::slotReinitCompositing()
|
|||
{
|
||||
// Reparse config. Config options will be reloaded by setupCompositing()
|
||||
KGlobal::config()->reparseConfiguration();
|
||||
options->updateSettings();
|
||||
|
||||
// Update any settings that can be set in the compositing kcm.
|
||||
updateElectricBorders();
|
||||
|
@ -1153,6 +1153,7 @@ void Workspace::slotReinitCompositing()
|
|||
|
||||
// resume compositing if suspended
|
||||
compositingSuspended = false;
|
||||
options->compositingInitialized = false;
|
||||
setupCompositing();
|
||||
KDecorationFactory* factory = mgr->factory();
|
||||
factory->reset(SettingCompositing);
|
||||
|
|
Loading…
Reference in a new issue