Hyprland/src/managers/input/InputMethodRelay.hpp

63 lines
1.8 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"
#include "../../helpers/signal/Signal.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;
class CTextInputV1;
2024-05-01 16:41:17 +01:00
class CInputMethodV2;
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();
2024-05-01 16:41:17 +01:00
void onNewIME(SP<CInputMethodV2>);
void onNewTextInput(WP<CTextInputV3> tiv3);
void onNewTextInput(WP<CTextInputV1> pTIV1);
2022-08-05 13:03:37 +02:00
void activateIME(CTextInput* pInput, bool shouldCommit = true);
void deactivateIME(CTextInput* pInput, bool shouldCommit = true);
2024-05-01 16:41:17 +01:00
void commitIMEState(CTextInput* pInput);
void removeTextInput(CTextInput* pInput);
2022-08-05 13:03:37 +02:00
void onKeyboardFocus(SP<CWLSurfaceResource>);
2022-08-05 13:03:37 +02:00
2024-05-01 16:41:17 +01:00
CTextInput* getFocusedTextInput();
2022-08-05 13:03:37 +02:00
2024-05-01 16:41:17 +01:00
void removePopup(CInputPopup*);
2022-08-05 13:19:16 +02:00
2024-05-01 16:41:17 +01:00
CInputPopup* popupFromCoords(const Vector2D& point);
CInputPopup* popupFromSurface(const SP<CWLSurfaceResource> surface);
2022-08-05 16:21:08 +02:00
2024-05-01 16:41:17 +01:00
void updateAllPopups();
2024-03-24 16:08:25 +00:00
WP<CInputMethodV2> m_inputMethod;
2022-08-05 13:03:37 +02:00
private:
std::vector<UP<CTextInput>> m_textInputs;
std::vector<UP<CInputPopup>> m_inputMethodPopups;
WP<CWLSurfaceResource> m_lastKbFocus;
2022-08-05 13:03:37 +02:00
2024-04-25 23:27:25 +01:00
struct {
CHyprSignalListener newTIV3;
CHyprSignalListener newTIV1;
2024-05-01 16:41:17 +01:00
CHyprSignalListener newIME;
CHyprSignalListener commitIME;
CHyprSignalListener destroyIME;
CHyprSignalListener newPopup;
} m_listeners;
2024-04-25 23:27:25 +01: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 class CTextInput;
2024-03-24 16:08:25 +00:00
friend class CHyprRenderer;
};