From 9f2ed02f35232f0362db45d5f580025f5724500a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 22 Mar 2024 23:08:52 +0000 Subject: IME/TI: Fixes and refactoring Fixes #5189 --- src/managers/input/InputMethodRelay.hpp | 35 +++++++++++---------------------- 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'src/managers/input/InputMethodRelay.hpp') diff --git a/src/managers/input/InputMethodRelay.hpp b/src/managers/input/InputMethodRelay.hpp index 6f99cae2..7618400f 100644 --- a/src/managers/input/InputMethodRelay.hpp +++ b/src/managers/input/InputMethodRelay.hpp @@ -3,6 +3,7 @@ #include #include "../../defines.hpp" #include "../../helpers/WLClasses.hpp" +#include "TextInput.hpp" class CInputManager; struct STextInputV1; @@ -13,15 +14,16 @@ class CInputMethodRelay { void onNewIME(wlr_input_method_v2*); void onNewTextInput(wlr_text_input_v3*); + void onNewTextInput(STextInputV1* pTIV1); wlr_input_method_v2* m_pWLRIME = nullptr; - void commitIMEState(STextInput* pInput); - void removeTextInput(STextInput* pInput); + void commitIMEState(CTextInput* pInput); + void removeTextInput(CTextInput* pInput); void onKeyboardFocus(wlr_surface*); - STextInput* getFocusedTextInput(); + CTextInput* getFocusedTextInput(); SIMEKbGrab* getIMEKeyboardGrab(SKeyboard*); @@ -31,10 +33,12 @@ class CInputMethodRelay { void removePopup(SIMEPopup*); private: - std::unique_ptr m_pKeyboardGrab; + std::unique_ptr m_pKeyboardGrab; - std::list m_lTextInputs; - std::list m_lIMEPopups; + std::list> m_vTextInputs; + std::list m_lIMEPopups; + + wlr_surface* m_pLastKbFocus = nullptr; DYNLISTENER(textInputNew); DYNLISTENER(IMECommit); @@ -42,25 +46,8 @@ class CInputMethodRelay { DYNLISTENER(IMEGrab); DYNLISTENER(IMENewPopup); - void createNewTextInput(wlr_text_input_v3*, STextInputV1* tiv1 = nullptr); - - wlr_surface* focusedSurface(STextInput* pInput); - wlr_surface* m_pFocusedSurface; - void onTextInputLeave(wlr_surface* pSurface); - void onTextInputEnter(wlr_surface* pSurface); - - std::unordered_map m_mSurfaceToTextInput; - void setSurfaceToPTI(wlr_surface* pSurface, STextInput* pInput); - STextInput* getTextInput(wlr_surface* pSurface); - void removeSurfaceToPTI(STextInput* pInput); - - std::unordered_map m_mClientTextInputVersion; - int setTextInputVersion(wl_client* pClient, int version); - int getTextInputVersion(wl_client* pClient); - void removeTextInputVersion(wl_client* pClient); - friend class CHyprRenderer; friend class CInputManager; friend class CTextInputV1ProtocolManager; - friend struct STextInput; + friend struct CTextInput; }; -- cgit v1.2.3