[plasma/plasma-keyboard] src: refactor(InputMethod): rename m_current for clarity & not shadowing

Kristen McWilliam <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 0510688147464cb7859d99baf412170c0789f521 by Kristen McWilliam.
Committed on 04/08/2026 at 18:49.
Pushed by merritt into branch 'master'.

refactor(InputMethod): rename m_current for clarity & not shadowing

`inputMethod->activeContext()` is clearer than `inputMethod->current()`,
and we avoid using `isActive()` which shadows the `isActive()` method of
`QWaylandClientExtension`.

M  +5    -5    src/inputmethod.cpp
M  +5    -5    src/inputmethod_p.h
M  +1    -1    src/inputplugin.cpp

https://invent.kde.org/plasma/plasma-keyboard/-/commit/0510688147464cb7859d99baf412170c0789f521

diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp
index 22abf2f..44b9aad 100644
--- a/src/inputmethod.cpp
+++ b/src/inputmethod.cpp
@@ -30,19 +30,19 @@ void InputMethod::zwp_input_method_v1_activate(struct ::zwp_input_method_context
 
 void InputMethod::zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context)
 {
-    Q_ASSERT(m_current->object() == context);
+    Q_ASSERT(m_activeContext->object() == context);
     setCurrentContext(nullptr);
 }
 
 void InputMethod::setCurrentContext(InputMethodContext *context)
 {
-    if (m_current.get() == context) {
+    if (m_activeContext.get() == context) {
         return;
     }
-    m_current.reset(context);
-    Q_EMIT activityChanged(m_current.use_count());
+    m_activeContext.reset(context);
+    Q_EMIT activityChanged(m_activeContext.use_count());
 
-    if (m_current)
+    if (m_activeContext)
         Q_EMIT activate();
     else
         Q_EMIT deactivate();
diff --git a/src/inputmethod_p.h b/src/inputmethod_p.h
index 91bfab1..895165a 100644
--- a/src/inputmethod_p.h
+++ b/src/inputmethod_p.h
@@ -29,14 +29,14 @@ public:
     explicit InputMethod();
     ~InputMethod() override;
 
-    std::shared_ptr<InputMethodContext> current() const
+    std::shared_ptr<InputMethodContext> activeContext() const
     {
-        return m_current;
+        return m_activeContext;
     }
 
-    bool isActive() const
+    bool hasContext() const
     {
-        return bool(m_current);
+        return bool(m_activeContext);
     }
 
 Q_SIGNALS:
@@ -49,7 +49,7 @@ private:
     void zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context) override;
 
     void setCurrentContext(InputMethodContext *context);
-    std::shared_ptr<InputMethodContext> m_current;
+    std::shared_ptr<InputMethodContext> m_activeContext;
 };
 
 class InputMethodContext : public QObject, public QtWayland::zwp_input_method_context_v1
diff --git a/src/inputplugin.cpp b/src/inputplugin.cpp
index 426fff5..9b14cbf 100644
--- a/src/inputplugin.cpp
+++ b/src/inputplugin.cpp
@@ -16,7 +16,7 @@ InputPlugin::InputPlugin(InputMethod *inputMethod)
             disconnect(m_context.get(), nullptr, this, nullptr);
         }
         m_keyboard.reset();
-        m_context = inputMethod->current();
+        m_context = inputMethod->activeContext();
         Q_EMIT contextChanged();
         Q_EMIT surroundingTextChanged();
         if (!m_context) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.