IME/TI: Fixes and refactoring

Fixes #5189
This commit is contained in:
Vaxry
2024-03-22 23:08:52 +00:00
parent 8c88689faf
commit 9f2ed02f35
8 changed files with 403 additions and 421 deletions

View File

@@ -3,6 +3,7 @@
#include <list>
#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<SIMEKbGrab> m_pKeyboardGrab;
std::unique_ptr<SIMEKbGrab> m_pKeyboardGrab;
std::list<STextInput> m_lTextInputs;
std::list<SIMEPopup> m_lIMEPopups;
std::list<std::unique_ptr<CTextInput>> m_vTextInputs;
std::list<SIMEPopup> 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<wlr_surface*, STextInput*> m_mSurfaceToTextInput;
void setSurfaceToPTI(wlr_surface* pSurface, STextInput* pInput);
STextInput* getTextInput(wlr_surface* pSurface);
void removeSurfaceToPTI(STextInput* pInput);
std::unordered_map<wl_client*, int> 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;
};