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;
|
||||
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 {
|
||||
d->allowTearing = false;
|
||||
}
|
||||
|
|
|
@ -207,6 +207,16 @@ you can reset this protection but be aware that this might result in an immediat
|
|||
</item>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
|
@ -45,6 +45,10 @@
|
|||
<default>LatencyMedium</default>
|
||||
</entry>
|
||||
|
||||
<entry name="AllowTearing" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
|
||||
</group>
|
||||
|
||||
</kcfg>
|
||||
|
|
|
@ -85,6 +85,7 @@ KWinCompositingKCM::KWinCompositingKCM(QWidget *parent, const QVariantList &args
|
|||
m_form.kcfg_Enabled->setVisible(!compositingRequired());
|
||||
m_form.kcfg_WindowsBlockCompositing->setVisible(!compositingRequired());
|
||||
m_form.compositingLabel->setVisible(!compositingRequired());
|
||||
m_form.kcfg_AllowTearing->setVisible(compositingRequired());
|
||||
|
||||
connect(this, &KWinCompositingKCM::defaultsIndicatorsVisibleChanged, this, &KWinCompositingKCM::updateUnmanagedItemStatus);
|
||||
|
||||
|
|
|
@ -278,6 +278,9 @@
|
|||
</choices>
|
||||
<default>RenderTimeEstimatorMaximum</default>
|
||||
</entry>
|
||||
<entry name="AllowTearing" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
</group>
|
||||
<group name="TabBox">
|
||||
<entry name="ShowDelay" type="Bool">
|
||||
|
|
|
@ -653,6 +653,19 @@ void Options::setRenderTimeEstimator(RenderTimeEstimator estimator)
|
|||
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)
|
||||
{
|
||||
// check environment variable
|
||||
|
@ -793,6 +806,7 @@ void Options::syncFromKcfgc()
|
|||
setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());
|
||||
setLatencyPolicy(m_settings->latencyPolicy());
|
||||
setRenderTimeEstimator(m_settings->renderTimeEstimator());
|
||||
setAllowTearing(m_settings->allowTearing());
|
||||
}
|
||||
|
||||
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(LatencyPolicy latencyPolicy READ latencyPolicy WRITE setLatencyPolicy NOTIFY latencyPolicyChanged)
|
||||
Q_PROPERTY(RenderTimeEstimator renderTimeEstimator READ renderTimeEstimator WRITE setRenderTimeEstimator NOTIFY renderTimeEstimatorChanged)
|
||||
Q_PROPERTY(bool allowTearing READ allowTearing WRITE setAllowTearing NOTIFY allowTearingChanged)
|
||||
public:
|
||||
explicit Options(QObject *parent = nullptr);
|
||||
~Options() override;
|
||||
|
@ -704,6 +705,7 @@ public:
|
|||
QStringList modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const;
|
||||
LatencyPolicy latencyPolicy() const;
|
||||
RenderTimeEstimator renderTimeEstimator() const;
|
||||
bool allowTearing() const;
|
||||
|
||||
// setters
|
||||
void setFocusPolicy(FocusPolicy focusPolicy);
|
||||
|
@ -763,6 +765,7 @@ public:
|
|||
void setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool set);
|
||||
void setLatencyPolicy(LatencyPolicy policy);
|
||||
void setRenderTimeEstimator(RenderTimeEstimator estimator);
|
||||
void setAllowTearing(bool allow);
|
||||
|
||||
// default values
|
||||
static WindowOperation defaultOperationTitlebarDblClick()
|
||||
|
@ -969,6 +972,7 @@ Q_SIGNALS:
|
|||
void latencyPolicyChanged();
|
||||
void configChanged();
|
||||
void renderTimeEstimatorChanged();
|
||||
void allowTearingChanged();
|
||||
|
||||
private:
|
||||
void setElectricBorders(int borders);
|
||||
|
@ -1042,6 +1046,8 @@ private:
|
|||
bool borderless_maximized_windows;
|
||||
bool condensed_title;
|
||||
|
||||
bool m_allowTearing = true;
|
||||
|
||||
QHash<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
|
||||
|
||||
MouseCommand wheelToMouseCommand(MouseWheelCommand com, int delta) const;
|
||||
|
|
Loading…
Reference in a new issue