kcmkwin/kwincompositing: add option to toggle tearing on Wayland
This commit is contained in:
parent
b85550ab41
commit
909378e6fd
7 changed files with 39 additions and 1 deletions
|
@ -263,7 +263,7 @@ void RenderLoop::setFullscreenSurface(Item *surfaceItem)
|
||||||
{
|
{
|
||||||
d->fullscreenItem = surfaceItem;
|
d->fullscreenItem = surfaceItem;
|
||||||
if (SurfaceItemWayland *wayland = qobject_cast<SurfaceItemWayland *>(surfaceItem)) {
|
if (SurfaceItemWayland *wayland = qobject_cast<SurfaceItemWayland *>(surfaceItem)) {
|
||||||
d->allowTearing = d->canDoTearing && wayland->surface()->presentationHint() == KWaylandServer::PresentationHint::Async;
|
d->allowTearing = d->canDoTearing && options->allowTearing() && wayland->surface()->presentationHint() == KWaylandServer::PresentationHint::Async;
|
||||||
} else {
|
} else {
|
||||||
d->allowTearing = false;
|
d->allowTearing = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,16 @@ you can reset this protection but be aware that this might result in an immediat
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="15" column="1">
|
||||||
|
<widget class="QCheckBox" name="kcfg_AllowTearing">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Allows applications to cause screen tearing in fullscreen.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Allow tearing in fullscreen</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
<default>LatencyMedium</default>
|
<default>LatencyMedium</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
|
<entry name="AllowTearing" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</kcfg>
|
</kcfg>
|
||||||
|
|
|
@ -85,6 +85,7 @@ KWinCompositingKCM::KWinCompositingKCM(QWidget *parent, const QVariantList &args
|
||||||
m_form.kcfg_Enabled->setVisible(!compositingRequired());
|
m_form.kcfg_Enabled->setVisible(!compositingRequired());
|
||||||
m_form.kcfg_WindowsBlockCompositing->setVisible(!compositingRequired());
|
m_form.kcfg_WindowsBlockCompositing->setVisible(!compositingRequired());
|
||||||
m_form.compositingLabel->setVisible(!compositingRequired());
|
m_form.compositingLabel->setVisible(!compositingRequired());
|
||||||
|
m_form.kcfg_AllowTearing->setVisible(compositingRequired());
|
||||||
|
|
||||||
connect(this, &KWinCompositingKCM::defaultsIndicatorsVisibleChanged, this, &KWinCompositingKCM::updateUnmanagedItemStatus);
|
connect(this, &KWinCompositingKCM::defaultsIndicatorsVisibleChanged, this, &KWinCompositingKCM::updateUnmanagedItemStatus);
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,9 @@
|
||||||
</choices>
|
</choices>
|
||||||
<default>RenderTimeEstimatorMaximum</default>
|
<default>RenderTimeEstimatorMaximum</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="AllowTearing" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
<group name="TabBox">
|
<group name="TabBox">
|
||||||
<entry name="ShowDelay" type="Bool">
|
<entry name="ShowDelay" type="Bool">
|
||||||
|
|
|
@ -653,6 +653,19 @@ void Options::setRenderTimeEstimator(RenderTimeEstimator estimator)
|
||||||
Q_EMIT renderTimeEstimatorChanged();
|
Q_EMIT renderTimeEstimatorChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Options::allowTearing() const
|
||||||
|
{
|
||||||
|
return m_allowTearing;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Options::setAllowTearing(bool allow)
|
||||||
|
{
|
||||||
|
if (allow != m_allowTearing) {
|
||||||
|
m_allowTearing = allow;
|
||||||
|
Q_EMIT allowTearingChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Options::setGlPlatformInterface(OpenGLPlatformInterface interface)
|
void Options::setGlPlatformInterface(OpenGLPlatformInterface interface)
|
||||||
{
|
{
|
||||||
// check environment variable
|
// check environment variable
|
||||||
|
@ -793,6 +806,7 @@ void Options::syncFromKcfgc()
|
||||||
setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());
|
setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());
|
||||||
setLatencyPolicy(m_settings->latencyPolicy());
|
setLatencyPolicy(m_settings->latencyPolicy());
|
||||||
setRenderTimeEstimator(m_settings->renderTimeEstimator());
|
setRenderTimeEstimator(m_settings->renderTimeEstimator());
|
||||||
|
setAllowTearing(m_settings->allowTearing());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Options::loadCompositingConfig(bool force)
|
bool Options::loadCompositingConfig(bool force)
|
||||||
|
|
|
@ -214,6 +214,7 @@ class KWIN_EXPORT Options : public QObject
|
||||||
Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged)
|
Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged)
|
||||||
Q_PROPERTY(LatencyPolicy latencyPolicy READ latencyPolicy WRITE setLatencyPolicy NOTIFY latencyPolicyChanged)
|
Q_PROPERTY(LatencyPolicy latencyPolicy READ latencyPolicy WRITE setLatencyPolicy NOTIFY latencyPolicyChanged)
|
||||||
Q_PROPERTY(RenderTimeEstimator renderTimeEstimator READ renderTimeEstimator WRITE setRenderTimeEstimator NOTIFY renderTimeEstimatorChanged)
|
Q_PROPERTY(RenderTimeEstimator renderTimeEstimator READ renderTimeEstimator WRITE setRenderTimeEstimator NOTIFY renderTimeEstimatorChanged)
|
||||||
|
Q_PROPERTY(bool allowTearing READ allowTearing WRITE setAllowTearing NOTIFY allowTearingChanged)
|
||||||
public:
|
public:
|
||||||
explicit Options(QObject *parent = nullptr);
|
explicit Options(QObject *parent = nullptr);
|
||||||
~Options() override;
|
~Options() override;
|
||||||
|
@ -704,6 +705,7 @@ public:
|
||||||
QStringList modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const;
|
QStringList modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const;
|
||||||
LatencyPolicy latencyPolicy() const;
|
LatencyPolicy latencyPolicy() const;
|
||||||
RenderTimeEstimator renderTimeEstimator() const;
|
RenderTimeEstimator renderTimeEstimator() const;
|
||||||
|
bool allowTearing() const;
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
void setFocusPolicy(FocusPolicy focusPolicy);
|
void setFocusPolicy(FocusPolicy focusPolicy);
|
||||||
|
@ -763,6 +765,7 @@ public:
|
||||||
void setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool set);
|
void setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool set);
|
||||||
void setLatencyPolicy(LatencyPolicy policy);
|
void setLatencyPolicy(LatencyPolicy policy);
|
||||||
void setRenderTimeEstimator(RenderTimeEstimator estimator);
|
void setRenderTimeEstimator(RenderTimeEstimator estimator);
|
||||||
|
void setAllowTearing(bool allow);
|
||||||
|
|
||||||
// default values
|
// default values
|
||||||
static WindowOperation defaultOperationTitlebarDblClick()
|
static WindowOperation defaultOperationTitlebarDblClick()
|
||||||
|
@ -969,6 +972,7 @@ Q_SIGNALS:
|
||||||
void latencyPolicyChanged();
|
void latencyPolicyChanged();
|
||||||
void configChanged();
|
void configChanged();
|
||||||
void renderTimeEstimatorChanged();
|
void renderTimeEstimatorChanged();
|
||||||
|
void allowTearingChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setElectricBorders(int borders);
|
void setElectricBorders(int borders);
|
||||||
|
@ -1042,6 +1046,8 @@ private:
|
||||||
bool borderless_maximized_windows;
|
bool borderless_maximized_windows;
|
||||||
bool condensed_title;
|
bool condensed_title;
|
||||||
|
|
||||||
|
bool m_allowTearing = true;
|
||||||
|
|
||||||
QHash<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
|
QHash<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
|
||||||
|
|
||||||
MouseCommand wheelToMouseCommand(MouseWheelCommand com, int delta) const;
|
MouseCommand wheelToMouseCommand(MouseWheelCommand com, int delta) const;
|
||||||
|
|
Loading…
Reference in a new issue