Use kwinApp()->config() instead of KSharedConfig::openConfig()
That way all over kwin we can inject a custom config in the autotests.icc-effect-5.14.5
parent
a12fb5ed03
commit
757523a324
|
@ -318,7 +318,7 @@ void DrmBackend::readOutputsConfiguration()
|
|||
return;
|
||||
}
|
||||
const QByteArray uuid = generateOutputConfigurationUuid();
|
||||
const auto outputGroup = KSharedConfig::openConfig(KWIN_CONFIG)->group("DrmOutputs");
|
||||
const auto outputGroup = kwinApp()->config()->group("DrmOutputs");
|
||||
const auto configGroup = outputGroup.group(uuid);
|
||||
qCDebug(KWIN_DRM) << "Reading output configuration for" << uuid;
|
||||
// default position goes from left to right
|
||||
|
@ -716,9 +716,8 @@ void DrmOutput::init(drmModeConnector *connector)
|
|||
QSize physicalSize = !m_edid.physicalSize.isEmpty() ? m_edid.physicalSize : QSize(connector->mmWidth, connector->mmHeight);
|
||||
// the size might be completely borked. E.g. Samsung SyncMaster 2494HS reports 160x90 while in truth it's 520x292
|
||||
// as this information is used to calculate DPI info, it's going to result in everything being huge
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(KWIN_CONFIG);
|
||||
const QByteArray unknown = QByteArrayLiteral("unkown");
|
||||
KConfigGroup group = config->group("EdidOverwrite").group(m_edid.eisaId.isEmpty() ? unknown : m_edid.eisaId)
|
||||
KConfigGroup group = kwinApp()->config()->group("EdidOverwrite").group(m_edid.eisaId.isEmpty() ? unknown : m_edid.eisaId)
|
||||
.group(m_edid.monitorName.isEmpty() ? unknown : m_edid.monitorName)
|
||||
.group(m_edid.serialNumber.isEmpty() ? unknown : m_edid.serialNumber);
|
||||
if (group.hasKey("PhysicalSize")) {
|
||||
|
|
|
@ -206,7 +206,7 @@ void Compositor::slotCompositingOptionsInitialized()
|
|||
qCDebug(KWIN_CORE) << "Initializing OpenGL compositing";
|
||||
|
||||
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
|
||||
KSharedConfigPtr unsafeConfigPtr = KSharedConfig::openConfig();
|
||||
KSharedConfigPtr unsafeConfigPtr = kwinApp()->config();
|
||||
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
|
||||
const QString openGLIsUnsafe = QLatin1String("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString());
|
||||
if (unsafeConfig.readEntry(openGLIsUnsafe, false))
|
||||
|
@ -461,7 +461,7 @@ void Compositor::deleteUnusedSupportProperties()
|
|||
void Compositor::fallbackToXRenderCompositing()
|
||||
{
|
||||
finish();
|
||||
KConfigGroup config(KSharedConfig::openConfig(), "Compositing");
|
||||
KConfigGroup config(kwinApp()->config(), "Compositing");
|
||||
config.writeEntry("Backend", "XRender");
|
||||
config.sync();
|
||||
options->setCompositingMode(XRenderCompositing);
|
||||
|
@ -482,7 +482,7 @@ void Compositor::slotConfigChanged()
|
|||
void Compositor::slotReinitialize()
|
||||
{
|
||||
// Reparse config. Config options will be reloaded by setup()
|
||||
KSharedConfig::openConfig()->reparseConfiguration();
|
||||
kwinApp()->config()->reparseConfiguration();
|
||||
|
||||
// Restart compositing
|
||||
finish();
|
||||
|
|
|
@ -52,13 +52,13 @@ CompositingPrefs::~CompositingPrefs()
|
|||
bool CompositingPrefs::openGlIsBroken()
|
||||
{
|
||||
const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
|
||||
return KConfigGroup(KSharedConfig::openConfig(), "Compositing").readEntry(unsafeKey, false);
|
||||
return KConfigGroup(kwinApp()->config(), "Compositing").readEntry(unsafeKey, false);
|
||||
}
|
||||
|
||||
bool CompositingPrefs::compositingPossible()
|
||||
{
|
||||
// first off, check whether we figured that we'll crash on detection because of a buggy driver
|
||||
KConfigGroup gl_workaround_group(KSharedConfig::openConfig(), "Compositing");
|
||||
KConfigGroup gl_workaround_group(kwinApp()->config(), "Compositing");
|
||||
const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
|
||||
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QLatin1String("OpenGL") &&
|
||||
gl_workaround_group.readEntry(unsafeKey, false))
|
||||
|
@ -95,7 +95,7 @@ bool CompositingPrefs::compositingPossible()
|
|||
QString CompositingPrefs::compositingNotPossibleReason()
|
||||
{
|
||||
// first off, check whether we figured that we'll crash on detection because of a buggy driver
|
||||
KConfigGroup gl_workaround_group(KSharedConfig::openConfig(), "Compositing");
|
||||
KConfigGroup gl_workaround_group(kwinApp()->config(), "Compositing");
|
||||
const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
|
||||
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QLatin1String("OpenGL") &&
|
||||
gl_workaround_group.readEntry(unsafeKey, false))
|
||||
|
|
|
@ -71,17 +71,17 @@ DecorationBridge::~DecorationBridge()
|
|||
|
||||
static QString readPlugin()
|
||||
{
|
||||
return KSharedConfig::openConfig(KWIN_CONFIG)->group(s_pluginName).readEntry("library", s_defaultPlugin);
|
||||
return kwinApp()->config()->group(s_pluginName).readEntry("library", s_defaultPlugin);
|
||||
}
|
||||
|
||||
static bool readNoPlugin()
|
||||
{
|
||||
return KSharedConfig::openConfig(KWIN_CONFIG)->group(s_pluginName).readEntry("NoPlugin", false);
|
||||
return kwinApp()->config()->group(s_pluginName).readEntry("NoPlugin", false);
|
||||
}
|
||||
|
||||
QString DecorationBridge::readTheme() const
|
||||
{
|
||||
return KSharedConfig::openConfig(KWIN_CONFIG)->group(s_pluginName).readEntry("theme", m_defaultTheme);
|
||||
return kwinApp()->config()->group(s_pluginName).readEntry("theme", m_defaultTheme);
|
||||
}
|
||||
|
||||
void DecorationBridge::init()
|
||||
|
|
|
@ -152,7 +152,7 @@ static KDecoration2::BorderSize stringToSize(const QString &name)
|
|||
|
||||
void SettingsImpl::readSettings()
|
||||
{
|
||||
KConfigGroup config = KSharedConfig::openConfig(KWIN_CONFIG)->group(QStringLiteral("org.kde.kdecoration2"));
|
||||
KConfigGroup config = kwinApp()->config()->group(QStringLiteral("org.kde.kdecoration2"));
|
||||
const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >({
|
||||
KDecoration2::DecorationButtonType::Menu,
|
||||
KDecoration2::DecorationButtonType::OnAllDesktops
|
||||
|
|
|
@ -207,7 +207,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
|||
effectsChanged();
|
||||
}
|
||||
);
|
||||
m_effectLoader->setConfig(KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG)));
|
||||
m_effectLoader->setConfig(kwinApp()->config());
|
||||
new EffectsAdaptor(this);
|
||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||
dbus.registerObject(QStringLiteral("/Effects"), this);
|
||||
|
@ -1417,8 +1417,7 @@ void EffectsHandlerImpl::reconfigureEffect(const QString& name)
|
|||
{
|
||||
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it)
|
||||
if ((*it).first == name) {
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG));
|
||||
config->reparseConfiguration();
|
||||
kwinApp()->config()->reparseConfiguration();
|
||||
makeOpenGLContextCurrent();
|
||||
(*it).second->reconfigure(Effect::ReconfigureAll);
|
||||
return;
|
||||
|
|
|
@ -87,7 +87,7 @@ int currentRefreshRate()
|
|||
|
||||
Options::Options(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_settings(new Settings(KSharedConfig::openConfig()))
|
||||
, m_settings(new Settings(kwinApp()->config()))
|
||||
, m_focusPolicy(ClickToFocus)
|
||||
, m_nextFocusPrefersMouse(false)
|
||||
, m_clickRaise(false)
|
||||
|
|
|
@ -229,7 +229,7 @@ KWin::AbstractScript::~AbstractScript()
|
|||
|
||||
KConfigGroup KWin::AbstractScript::config() const
|
||||
{
|
||||
return KSharedConfig::openConfig()->group(QLatin1String("Script-") + m_pluginName);
|
||||
return kwinApp()->config()->group(QLatin1String("Script-") + m_pluginName);
|
||||
}
|
||||
|
||||
void KWin::AbstractScript::stop()
|
||||
|
@ -653,7 +653,7 @@ void KWin::Scripting::start()
|
|||
|
||||
LoadScriptList KWin::Scripting::queryScriptsToLoad()
|
||||
{
|
||||
KSharedConfig::Ptr _config = KSharedConfig::openConfig();
|
||||
KSharedConfig::Ptr _config = kwinApp()->config();
|
||||
static bool s_started = false;
|
||||
if (s_started) {
|
||||
_config->reparseConfiguration();
|
||||
|
|
|
@ -761,7 +761,7 @@ void TabBox::hide(bool abort)
|
|||
|
||||
void TabBox::reconfigure()
|
||||
{
|
||||
KSharedConfigPtr c = KSharedConfig::openConfig();
|
||||
KSharedConfigPtr c = kwinApp()->config();
|
||||
KConfigGroup config = c->group("TabBox");
|
||||
|
||||
loadConfig(c->group("TabBox"), m_defaultConfig);
|
||||
|
@ -1241,7 +1241,7 @@ void TabBox::CDEWalkThroughWindows(bool forward)
|
|||
Client* nc = c;
|
||||
bool options_traverse_all;
|
||||
{
|
||||
KConfigGroup group(KSharedConfig::openConfig(), "TabBox");
|
||||
KConfigGroup group(kwinApp()->config(), "TabBox");
|
||||
options_traverse_all = group.readEntry("TraverseAll", false);
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ void UserActionsMenu::init()
|
|||
action = advancedMenu->addAction(i18n("S&pecial Application Settings..."));
|
||||
action->setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-windows-actions")));
|
||||
action->setData(Options::ApplicationRulesOp);
|
||||
if (!KSharedConfig::openConfig()->isImmutable() &&
|
||||
if (!kwinApp()->config()->isImmutable() &&
|
||||
!KAuthorized::authorizeControlModules(configModules(true)).isEmpty()) {
|
||||
advancedMenu->addSeparator();
|
||||
action = advancedMenu->addAction(i18nc("Entry in context menu of window decoration to open the configuration module of KWin",
|
||||
|
|
|
@ -217,7 +217,7 @@ Workspace::Workspace(const QString &sessionKey)
|
|||
void Workspace::init()
|
||||
{
|
||||
updateXTime(); // Needed for proper initialization of user_time in Client ctor
|
||||
KSharedConfigPtr config = KSharedConfig::openConfig();
|
||||
KSharedConfigPtr config = kwinApp()->config();
|
||||
kwinApp()->createScreens();
|
||||
Screens *screens = Screens::self();
|
||||
// get screen support
|
||||
|
@ -454,7 +454,7 @@ Workspace::~Workspace()
|
|||
xcb_delete_property(connection(), rootWindow(), atoms->kwin_running);
|
||||
|
||||
delete RuleBook::self();
|
||||
KSharedConfig::openConfig()->sync();
|
||||
kwinApp()->config()->sync();
|
||||
|
||||
RootInfo::destroy();
|
||||
delete startup;
|
||||
|
@ -788,7 +788,7 @@ void Workspace::slotReconfigure()
|
|||
|
||||
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
||||
|
||||
KSharedConfig::openConfig()->reparseConfiguration();
|
||||
kwinApp()->config()->reparseConfiguration();
|
||||
options->updateSettings();
|
||||
|
||||
emit configChanged();
|
||||
|
|
Loading…
Reference in New Issue