Drop InputConfig
The InputConfig was introduced to handle tests that don't have valid kwinApp object. Those tests have been either reworked or dropped, so let's drop the InputConfig to tidy the config stuff.
This commit is contained in:
parent
84c7d3cf4b
commit
3698127bc6
8 changed files with 22 additions and 44 deletions
|
@ -139,6 +139,7 @@ void KeyboardLayoutTest::initTestCase()
|
|||
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
kwinApp()->setKxkbConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
kwinApp()->setInputConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
||||
layoutGroup = kwinApp()->kxkbConfig()->group("Layout");
|
||||
layoutGroup.deleteGroup();
|
||||
|
@ -531,7 +532,7 @@ void KeyboardLayoutTest::testNumLock()
|
|||
QVERIFY(!xkb->leds().testFlag(LED::NumLock));
|
||||
|
||||
// let's reconfigure to enable through config
|
||||
auto group = InputConfig::self()->inputConfig()->group("Keyboard");
|
||||
auto group = kwinApp()->inputConfig()->group("Keyboard");
|
||||
group.writeEntry("NumLock", 0);
|
||||
group.sync();
|
||||
xkb->reconfigure();
|
||||
|
|
|
@ -142,7 +142,7 @@ void Cursor::loadThemeSettings()
|
|||
|
||||
void Cursor::loadThemeFromKConfig()
|
||||
{
|
||||
KConfigGroup mousecfg(InputConfig::self()->inputConfig(), "Mouse");
|
||||
KConfigGroup mousecfg(kwinApp()->inputConfig(), "Mouse");
|
||||
const QString themeName = mousecfg.readEntry("cursorTheme", defaultThemeName());
|
||||
const uint themeSize = mousecfg.readEntry("cursorSize", defaultThemeSize());
|
||||
updateTheme(themeName, themeSize);
|
||||
|
@ -160,9 +160,8 @@ void Cursor::updateTheme(const QString &name, int size)
|
|||
|
||||
void Cursor::slotKGlobalSettingsNotifyChange(int type, int arg)
|
||||
{
|
||||
// #endif
|
||||
if (type == 5 /*CursorChanged*/) {
|
||||
InputConfig::self()->inputConfig()->reparseConfiguration();
|
||||
kwinApp()->inputConfig()->reparseConfiguration();
|
||||
loadThemeFromKConfig();
|
||||
}
|
||||
}
|
||||
|
@ -697,18 +696,4 @@ void Cursor::setSource(CursorSource *source)
|
|||
Q_EMIT cursorChanged();
|
||||
}
|
||||
|
||||
InputConfig *InputConfig::s_self = nullptr;
|
||||
InputConfig *InputConfig::self()
|
||||
{
|
||||
if (!s_self) {
|
||||
s_self = new InputConfig;
|
||||
}
|
||||
return s_self;
|
||||
}
|
||||
|
||||
InputConfig::InputConfig()
|
||||
: m_inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"), KConfig::NoGlobals))
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
21
src/cursor.h
21
src/cursor.h
|
@ -308,27 +308,6 @@ private:
|
|||
int m_cursorHideCounter = 0;
|
||||
};
|
||||
|
||||
class KWIN_EXPORT InputConfig
|
||||
{
|
||||
public:
|
||||
KSharedConfigPtr inputConfig() const
|
||||
{
|
||||
return m_inputConfig;
|
||||
}
|
||||
void setInputConfig(KSharedConfigPtr config)
|
||||
{
|
||||
m_inputConfig = std::move(config);
|
||||
}
|
||||
|
||||
static InputConfig *self();
|
||||
|
||||
private:
|
||||
InputConfig();
|
||||
|
||||
KSharedConfigPtr m_inputConfig;
|
||||
static InputConfig *s_self;
|
||||
};
|
||||
|
||||
inline const QPointF &Cursor::currentPos() const
|
||||
{
|
||||
return m_pos;
|
||||
|
|
|
@ -1582,7 +1582,7 @@ KSharedConfigPtr EffectsHandlerImpl::config() const
|
|||
|
||||
KSharedConfigPtr EffectsHandlerImpl::inputConfig() const
|
||||
{
|
||||
return InputConfig::self()->inputConfig();
|
||||
return kwinApp()->inputConfig();
|
||||
}
|
||||
|
||||
Effect *EffectsHandlerImpl::findEffect(const QString &name) const
|
||||
|
|
|
@ -2640,7 +2640,7 @@ void InputRedirection::uninstallInputEventSpy(InputEventSpy *spy)
|
|||
|
||||
void InputRedirection::init()
|
||||
{
|
||||
m_inputConfigWatcher = KConfigWatcher::create(InputConfig::self()->inputConfig());
|
||||
m_inputConfigWatcher = KConfigWatcher::create(kwinApp()->inputConfig());
|
||||
connect(m_inputConfigWatcher.data(), &KConfigWatcher::configChanged,
|
||||
this, &InputRedirection::handleInputConfigChanged);
|
||||
|
||||
|
@ -3066,7 +3066,7 @@ void InputRedirection::addInputBackend(std::unique_ptr<InputBackend> &&inputBack
|
|||
connect(inputBackend.get(), &InputBackend::deviceAdded, this, &InputRedirection::addInputDevice);
|
||||
connect(inputBackend.get(), &InputBackend::deviceRemoved, this, &InputRedirection::removeInputDevice);
|
||||
|
||||
inputBackend->setConfig(InputConfig::self()->inputConfig());
|
||||
inputBackend->setConfig(kwinApp()->inputConfig());
|
||||
inputBackend->initialize();
|
||||
|
||||
m_inputBackends.push_back(std::move(inputBackend));
|
||||
|
|
|
@ -117,7 +117,7 @@ void KeyboardInputRedirection::init()
|
|||
Q_ASSERT(!m_inited);
|
||||
m_inited = true;
|
||||
const auto config = kwinApp()->kxkbConfig();
|
||||
m_xkb->setNumLockConfig(InputConfig::self()->inputConfig());
|
||||
m_xkb->setNumLockConfig(kwinApp()->inputConfig());
|
||||
m_xkb->setConfig(config);
|
||||
|
||||
// Workaround for QTBUG-54371: if there is no real keyboard Qt doesn't request virtual keyboard
|
||||
|
@ -171,7 +171,7 @@ void KeyboardInputRedirection::reconfigure()
|
|||
return;
|
||||
}
|
||||
if (waylandServer()->seat()->keyboard()) {
|
||||
const auto config = InputConfig::self()->inputConfig()->group(QStringLiteral("Keyboard"));
|
||||
const auto config = kwinApp()->inputConfig()->group(QStringLiteral("Keyboard"));
|
||||
const int delay = config.readEntry("RepeatDelay", 660);
|
||||
const int rate = std::ceil(config.readEntry("RepeatRate", 25.0));
|
||||
const QString repeatMode = config.readEntry("KeyRepeat", "repeat");
|
||||
|
|
|
@ -128,6 +128,9 @@ void Application::start()
|
|||
if (!m_kxkbConfig) {
|
||||
m_kxkbConfig = KSharedConfig::openConfig(QStringLiteral("kxkbrc"), KConfig::NoGlobals);
|
||||
}
|
||||
if (!m_inputConfig) {
|
||||
m_inputConfig = KSharedConfig::openConfig(QStringLiteral("kcminputrc"), KConfig::NoGlobals);
|
||||
}
|
||||
|
||||
performStartup();
|
||||
}
|
||||
|
|
10
src/main.h
10
src/main.h
|
@ -116,6 +116,15 @@ public:
|
|||
m_kxkbConfig = std::move(config);
|
||||
}
|
||||
|
||||
KSharedConfigPtr inputConfig() const
|
||||
{
|
||||
return m_inputConfig;
|
||||
}
|
||||
void setInputConfig(KSharedConfigPtr config)
|
||||
{
|
||||
m_inputConfig = std::move(config);
|
||||
}
|
||||
|
||||
void start();
|
||||
/**
|
||||
* @brief The operation mode used by KWin.
|
||||
|
@ -354,6 +363,7 @@ private:
|
|||
bool m_configLock;
|
||||
KSharedConfigPtr m_config;
|
||||
KSharedConfigPtr m_kxkbConfig;
|
||||
KSharedConfigPtr m_inputConfig;
|
||||
OperationMode m_operationMode;
|
||||
xcb_timestamp_t m_x11Time = XCB_TIME_CURRENT_TIME;
|
||||
xcb_window_t m_rootWindow = XCB_WINDOW_NONE;
|
||||
|
|
Loading…
Reference in a new issue