From 58e2ce10574ddfa546fd462d72548206076c3ef7 Mon Sep 17 00:00:00 2001 From: Andrey Butirsky Date: Thu, 29 Dec 2022 16:37:25 +0400 Subject: [PATCH] cleanup: get rid of "parent" argument - The Xkb object is owned by std::unique_ptr so there is no need in the parent relationship - Remove unused header --- src/keyboard_input.cpp | 3 +-- src/keyboard_input.h | 2 +- src/xkb.cpp | 5 ++--- src/xkb.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/keyboard_input.cpp b/src/keyboard_input.cpp index 9c69c6a9e3..cd15c5070a 100644 --- a/src/keyboard_input.cpp +++ b/src/keyboard_input.cpp @@ -16,7 +16,6 @@ #include "keyboard_layout.h" #include "keyboard_repeat.h" #include "modifier_only_shortcuts.h" -#include "utils/common.h" #include "wayland/datadevice_interface.h" #include "wayland/keyboard_interface.h" #include "wayland/seat_interface.h" @@ -41,7 +40,7 @@ namespace KWin KeyboardInputRedirection::KeyboardInputRedirection(InputRedirection *parent) : QObject(parent) , m_input(parent) - , m_xkb(new Xkb(parent, kwinApp()->followLocale1())) + , m_xkb(new Xkb(kwinApp()->followLocale1())) { connect(m_xkb.get(), &Xkb::ledsChanged, this, &KeyboardInputRedirection::ledsChanged); if (waylandServer()) { diff --git a/src/keyboard_input.h b/src/keyboard_input.h index aa58926ccc..14d5cce933 100644 --- a/src/keyboard_input.h +++ b/src/keyboard_input.h @@ -64,7 +64,7 @@ Q_SIGNALS: private: InputRedirection *m_input; bool m_inited = false; - std::unique_ptr m_xkb; + const std::unique_ptr m_xkb; QMetaObject::Connection m_activeWindowSurfaceChangedConnection; ModifiersChangedSpy *m_modifiersChangedSpy = nullptr; KeyboardLayout *m_keyboardLayout = nullptr; diff --git a/src/xkb.cpp b/src/xkb.cpp index 6cdbbed679..ef6fd0f1b8 100644 --- a/src/xkb.cpp +++ b/src/xkb.cpp @@ -70,9 +70,8 @@ static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const ch } } -Xkb::Xkb(QObject *parent, bool followLocale1) - : QObject(parent) - , m_context(xkb_context_new(XKB_CONTEXT_NO_FLAGS)) +Xkb::Xkb(bool followLocale1) + : m_context(xkb_context_new(XKB_CONTEXT_NO_FLAGS)) , m_keymap(nullptr) , m_state(nullptr) , m_shiftModifier(0) diff --git a/src/xkb.h b/src/xkb.h index 0934e19589..3bfe0c57c8 100644 --- a/src/xkb.h +++ b/src/xkb.h @@ -42,7 +42,7 @@ class KWIN_EXPORT Xkb : public QObject { Q_OBJECT public: - Xkb(QObject *parent = nullptr, bool followLocale1 = false); + Xkb(bool followLocale1 = false); ~Xkb() override; void setConfig(const KSharedConfigPtr &config); void setNumLockConfig(const KSharedConfigPtr &config);