Hyprland/src/managers/input/InputMethodRelay.hpp

68 lines
1.9 KiB
C++
Raw Normal View History

2022-08-05 13:03:37 +02:00
#pragma once
#include <list>
2022-08-05 13:03:37 +02:00
#include "../../defines.hpp"
#include "../../helpers/WLClasses.hpp"
2024-04-25 23:27:25 +01:00
#include "../../helpers/signal/Listener.hpp"
#include "TextInput.hpp"
2024-03-24 16:08:25 +00:00
#include "InputMethodPopup.hpp"
2024-04-25 23:27:25 +01:00
#include <any>
2022-08-05 13:03:37 +02:00
2022-11-07 22:22:13 +00:00
class CInputManager;
2024-03-24 16:08:25 +00:00
class CHyprRenderer;
struct STextInputV1;
2022-11-07 22:22:13 +00:00
2022-08-05 13:03:37 +02:00
class CInputMethodRelay {
public:
2022-08-05 13:03:37 +02:00
CInputMethodRelay();
void onNewIME(wlr_input_method_v2*);
2024-04-25 23:27:25 +01:00
void onNewTextInput(std::any tiv3);
void onNewTextInput(STextInputV1* pTIV1);
2022-08-05 13:03:37 +02:00
wlr_input_method_v2* m_pWLRIME = nullptr;
void activateIME(CTextInput* pInput);
void deactivateIME(CTextInput* pInput);
void commitIMEState(CTextInput* pInput);
void removeTextInput(CTextInput* pInput);
2022-08-05 13:03:37 +02:00
void onKeyboardFocus(wlr_surface*);
2022-08-05 13:03:37 +02:00
CTextInput* getFocusedTextInput();
2022-08-05 13:19:16 +02:00
SIMEKbGrab* getIMEKeyboardGrab(SKeyboard*);
2022-08-05 16:21:08 +02:00
2024-03-24 16:08:25 +00:00
void setIMEPopupFocus(CInputPopup*, wlr_surface*);
void removePopup(CInputPopup*);
CInputPopup* popupFromCoords(const Vector2D& point);
CInputPopup* popupFromSurface(const wlr_surface* surface);
2024-03-24 16:08:25 +00:00
void updateAllPopups();
2022-08-05 13:03:37 +02:00
private:
2024-03-24 16:08:25 +00:00
std::unique_ptr<SIMEKbGrab> m_pKeyboardGrab;
2022-08-05 16:21:08 +02:00
2024-03-24 16:08:25 +00:00
std::vector<std::unique_ptr<CTextInput>> m_vTextInputs;
std::vector<std::unique_ptr<CInputPopup>> m_vIMEPopups;
2024-03-24 16:08:25 +00:00
wlr_surface* m_pLastKbFocus = nullptr;
2022-08-05 13:03:37 +02:00
2024-04-25 23:27:25 +01:00
struct {
CHyprSignalListener newTIV3;
} listeners;
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
2022-08-05 17:07:01 +02:00
friend class CHyprRenderer;
2022-11-07 22:22:13 +00:00
friend class CInputManager;
friend class CTextInputV1ProtocolManager;
friend struct CTextInput;
2024-03-24 16:08:25 +00:00
friend class CHyprRenderer;
};