[kcmkwin/compositing] Show warning message when selecting "dangerous" options
The idea is to warn the user that changing the settings might break the setup when we know it could be dangerous. The following cases are considered: * Scale filter Accurate * Tearing prevention * keep window thumbnail always * EGL if EGL and GLX are available * unredirect fullscreen not working on all hardware In addition the OpenGL is Unsafe warning is turned int a KMessageWidget which is also used for all the other warnings. REVIEW: 118494
This commit is contained in:
parent
54d85c8a73
commit
58668e52a0
4 changed files with 210 additions and 23 deletions
|
@ -161,6 +161,13 @@ bool Compositing::OpenGLIsBroken()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Compositing::reenableOpenGLDetection()
|
||||
{
|
||||
KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing");
|
||||
kwinConfig.writeEntry("OpenGLIsUnsafe", false);
|
||||
kwinConfig.sync();
|
||||
}
|
||||
|
||||
int Compositing::animationSpeed() const
|
||||
{
|
||||
return m_animationSpeed;
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
Q_INVOKABLE bool OpenGLIsUnsafe() const;
|
||||
Q_INVOKABLE bool OpenGLIsBroken();
|
||||
Q_INVOKABLE void reenableOpenGLDetection();
|
||||
int animationSpeed() const;
|
||||
int windowThumbnail() const;
|
||||
int glScaleFilter() const;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>402</width>
|
||||
<height>300</height>
|
||||
<height>335</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -17,21 +17,21 @@
|
|||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="compositingEnabled">
|
||||
<property name="text">
|
||||
<string>Enable compositor on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Animation speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QSlider" name="animationSpeed">
|
||||
|
@ -82,14 +82,14 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="glScaleFilterLabel">
|
||||
<property name="text">
|
||||
<string>Scale method:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="glScaleFilter">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -108,14 +108,14 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="xrScaleFilterLabel">
|
||||
<property name="text">
|
||||
<string>Scale method:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="xrScaleFilter">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -129,41 +129,41 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Rendering backend:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="type"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="openGLPlatformInterfaceLabel">
|
||||
<property name="text">
|
||||
<string>OpenGL interface:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="openGLPlatformInterface"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Tearing prevention ("vsync"):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="tearingPrevention">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -192,18 +192,18 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Keep window thumbnails:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="windowThumbnail">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always (Breaks Animations)</string>
|
||||
<string>Always</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -218,43 +218,152 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Expert:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="unredirectFullscreen">
|
||||
<property name="text">
|
||||
<string>Suspend compositor for full screen windows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Experimental:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QCheckBox" name="colorCorrection">
|
||||
<property name="text">
|
||||
<string>Enable color correction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="glCrashedWarning">
|
||||
<property name="text">
|
||||
<string>OpenGL compositing (the default) has crashed KWin in the past.
|
||||
This was most likely due to a driver bug.
|
||||
If you think that you have meanwhile upgraded to a stable driver,
|
||||
you can reset this protection but be aware that this might result in an immediate crash!
|
||||
Alternatively, you might want to use the XRender backend instead.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="interfaceWarning">
|
||||
<property name="text">
|
||||
<string>EGL is not supported by all OpenGL drivers. If not supported the Compositor will be disabled.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="scaleWarning">
|
||||
<property name="text">
|
||||
<string>Scale method "Accurate" is not supported by all hardware and can cause performance regressions and rendering artifacts.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="tearingWarning">
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="windowThumbnailWarning">
|
||||
<property name="text">
|
||||
<string>Keeping the window thumbnail always interferes with the minimized state of windows. This can result in windows not suspending their work when minimized.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="unredirectInformation">
|
||||
<property name="text">
|
||||
<string>Having full screen windows bypass the compositor is not supported on every hardware.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Information</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KMessageWidget</class>
|
||||
<extends>QFrame</extends>
|
||||
<header location="global">kmessagewidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -78,6 +78,16 @@ KWinCompositingSettings::KWinCompositingSettings(QWidget *parent, const QVariant
|
|||
, m_compositing(new KWin::Compositing::Compositing(this))
|
||||
{
|
||||
m_form.setupUi(this);
|
||||
m_form.glCrashedWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
|
||||
QAction *reenableGLAction = new QAction(i18n("Re-enable OpenGL detection"), this);
|
||||
connect(reenableGLAction, &QAction::triggered, m_compositing, &KWin::Compositing::Compositing::reenableOpenGLDetection);
|
||||
connect(reenableGLAction, &QAction::triggered, m_form.glCrashedWarning, &KMessageWidget::animatedHide);
|
||||
m_form.glCrashedWarning->addAction(reenableGLAction);
|
||||
m_form.interfaceWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
|
||||
m_form.scaleWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
|
||||
m_form.tearingWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
|
||||
m_form.windowThumbnailWarning->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
|
||||
m_form.unredirectInformation->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information")));
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -103,6 +113,15 @@ void KWinCompositingSettings::init()
|
|||
m_form.glScaleFilter->setCurrentIndex(m_compositing->glScaleFilter());
|
||||
connect(m_compositing, &Compositing::glScaleFilterChanged, m_form.glScaleFilter, &QComboBox::setCurrentIndex);
|
||||
connect(m_form.glScaleFilter, currentIndexChangedSignal, m_compositing, &Compositing::setGlScaleFilter);
|
||||
connect(m_form.glScaleFilter, currentIndexChangedSignal,
|
||||
[this](int index) {
|
||||
if (index == 2) {
|
||||
m_form.scaleWarning->animatedShow();
|
||||
} else {
|
||||
m_form.scaleWarning->animatedHide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// xrender scale filter
|
||||
m_form.xrScaleFilter->setCurrentIndex(m_compositing->xrScaleFilter());
|
||||
|
@ -113,22 +132,69 @@ void KWinCompositingSettings::init()
|
|||
m_form.tearingPrevention->setCurrentIndex(m_compositing->glSwapStrategy());
|
||||
connect(m_compositing, &Compositing::glSwapStrategyChanged, m_form.tearingPrevention, &QComboBox::setCurrentIndex);
|
||||
connect(m_form.tearingPrevention, currentIndexChangedSignal, m_compositing, &Compositing::setGlSwapStrategy);
|
||||
connect(m_form.tearingPrevention, currentIndexChangedSignal,
|
||||
[this](int index) {
|
||||
if (index == 2) {
|
||||
// only when cheap - tearing
|
||||
m_form.tearingWarning->setText(i18n("\"Only when cheap\" only prevents tearing for full screen changes like a video."));
|
||||
m_form.tearingWarning->animatedShow();
|
||||
} else if (index == 3) {
|
||||
// full screen repaints
|
||||
m_form.tearingWarning->setText(i18n("\"Full screen repaints\" can cause performance problems."));
|
||||
m_form.tearingWarning->animatedShow();
|
||||
} else if (index == 4) {
|
||||
// re-use screen content
|
||||
m_form.tearingWarning->setText(i18n("\"Re-use screen content\" causes performance severe problems on MESA drivers."));
|
||||
m_form.tearingWarning->animatedShow();
|
||||
} else {
|
||||
m_form.tearingWarning->animatedHide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// windowThumbnail
|
||||
m_form.windowThumbnail->setCurrentIndex(m_compositing->windowThumbnail());
|
||||
connect(m_compositing, &Compositing::windowThumbnailChanged, m_form.windowThumbnail, &QComboBox::setCurrentIndex);
|
||||
connect(m_form.windowThumbnail, currentIndexChangedSignal, m_compositing, &Compositing::setWindowThumbnail);
|
||||
connect(m_form.windowThumbnail, currentIndexChangedSignal,
|
||||
[this](int index) {
|
||||
if (index == 0) {
|
||||
m_form.windowThumbnailWarning->animatedShow();
|
||||
} else {
|
||||
m_form.windowThumbnailWarning->animatedHide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// openglPlatformInterface
|
||||
m_form.openGLPlatformInterface->setModel(m_compositing->openGLPlatformInterfaceModel());
|
||||
m_form.openGLPlatformInterface->setCurrentIndex(m_compositing->openGLPlatformInterface());
|
||||
connect(m_compositing, &Compositing::openGLPlatformInterfaceChanged, m_form.openGLPlatformInterface, &QComboBox::setCurrentIndex);
|
||||
connect(m_form.openGLPlatformInterface, currentIndexChangedSignal, m_compositing, &Compositing::setOpenGLPlatformInterface);
|
||||
connect(m_form.openGLPlatformInterface, currentIndexChangedSignal,
|
||||
[this]() {
|
||||
if (m_form.openGLPlatformInterface->count() > 1 // only if egl and glx are supported
|
||||
&& m_form.openGLPlatformInterface->currentData().toString() == QStringLiteral("egl")) {
|
||||
m_form.interfaceWarning->animatedShow();
|
||||
} else {
|
||||
m_form.interfaceWarning->animatedHide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// unredirect fullscreen
|
||||
m_form.unredirectFullscreen->setChecked(m_compositing->unredirectFullscreen());
|
||||
connect(m_compositing, &Compositing::unredirectFullscreenChanged, m_form.unredirectFullscreen, &QCheckBox::setChecked);
|
||||
connect(m_form.unredirectFullscreen, &QCheckBox::toggled, m_compositing, &Compositing::setUnredirectFullscreen);
|
||||
connect(m_form.unredirectFullscreen, &QCheckBox::toggled,
|
||||
[this](bool enabled) {
|
||||
if (enabled) {
|
||||
m_form.unredirectInformation->animatedShow();
|
||||
} else {
|
||||
m_form.unredirectInformation->animatedHide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// color correction
|
||||
m_form.colorCorrection->setChecked(m_compositing->glColorCorrection());
|
||||
|
@ -164,6 +230,10 @@ void KWinCompositingSettings::init()
|
|||
showHideBasedOnType();
|
||||
}
|
||||
);
|
||||
|
||||
if (m_compositing->OpenGLIsUnsafe()) {
|
||||
m_form.glCrashedWarning->animatedShow();
|
||||
}
|
||||
}
|
||||
|
||||
void KWinCompositingSettings::load()
|
||||
|
|
Loading…
Reference in a new issue