2022-08-05 13:03:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
2024-03-01 21:07:36 +01:00
|
|
|
#include <list>
|
2022-08-05 13:03:37 +02:00
|
|
|
#include "../../defines.hpp"
|
|
|
|
#include "../../helpers/WLClasses.hpp"
|
|
|
|
|
2022-11-07 23:22:13 +01:00
|
|
|
class CInputManager;
|
2023-03-14 13:57:50 +01:00
|
|
|
struct STextInputV1;
|
2022-11-07 23:22:13 +01:00
|
|
|
|
2022-08-05 13:03:37 +02:00
|
|
|
class CInputMethodRelay {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-08-05 13:03:37 +02:00
|
|
|
CInputMethodRelay();
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
void onNewIME(wlr_input_method_v2*);
|
|
|
|
void onNewTextInput(wlr_text_input_v3*);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
|
|
|
wlr_input_method_v2* m_pWLRIME = nullptr;
|
|
|
|
|
2023-03-14 13:57:50 +01:00
|
|
|
void commitIMEState(STextInput* pInput);
|
|
|
|
void removeTextInput(STextInput* pInput);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
void onKeyboardFocus(wlr_surface*);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
STextInput* getFocusedTextInput();
|
2022-08-05 13:19:16 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
SIMEKbGrab* getIMEKeyboardGrab(SKeyboard*);
|
2022-08-05 16:21:08 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
void setIMEPopupFocus(SIMEPopup*, wlr_surface*);
|
|
|
|
void updateInputPopup(SIMEPopup*);
|
|
|
|
void damagePopup(SIMEPopup*);
|
|
|
|
void removePopup(SIMEPopup*);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
2022-08-05 16:21:08 +02:00
|
|
|
std::unique_ptr<SIMEKbGrab> m_pKeyboardGrab;
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
std::list<STextInput> m_lTextInputs;
|
|
|
|
std::list<SIMEPopup> m_lIMEPopups;
|
2022-08-05 13:03:37 +02:00
|
|
|
|
|
|
|
DYNLISTENER(textInputNew);
|
|
|
|
DYNLISTENER(IMECommit);
|
|
|
|
DYNLISTENER(IMEDestroy);
|
2022-08-05 16:21:08 +02:00
|
|
|
DYNLISTENER(IMEGrab);
|
2022-08-05 17:07:01 +02:00
|
|
|
DYNLISTENER(IMENewPopup);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2024-03-19 16:54:33 +01:00
|
|
|
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);
|
2022-08-05 17:07:01 +02:00
|
|
|
|
|
|
|
friend class CHyprRenderer;
|
2022-11-07 23:22:13 +01:00
|
|
|
friend class CInputManager;
|
2023-03-14 13:57:50 +01:00
|
|
|
friend class CTextInputV1ProtocolManager;
|
2024-03-01 21:07:36 +01:00
|
|
|
};
|