2022-08-05 13:03:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-03-01 14:07:36 -06:00
|
|
|
#include <list>
|
2022-08-05 13:03:37 +02:00
|
|
|
#include "../../defines.hpp"
|
|
|
|
|
#include "../../helpers/WLClasses.hpp"
|
2024-06-11 17:17:45 +02:00
|
|
|
#include "../../helpers/signal/Signal.hpp"
|
2024-03-22 23:08:52 +00:00
|
|
|
#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;
|
2024-07-29 11:14:19 -05:00
|
|
|
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 {
|
2022-12-16 17:17:31 +00:00
|
|
|
public:
|
2022-08-05 13:03:37 +02:00
|
|
|
CInputMethodRelay();
|
|
|
|
|
|
2024-05-01 16:41:17 +01:00
|
|
|
void onNewIME(SP<CInputMethodV2>);
|
2024-07-29 11:14:19 -05:00
|
|
|
void onNewTextInput(WP<CTextInputV3> tiv3);
|
|
|
|
|
void onNewTextInput(WP<CTextInputV1> pTIV1);
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2024-09-10 22:49:10 +09: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
|
|
|
|
2024-06-08 10:07:59 +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);
|
2024-06-08 10:07:59 +02:00
|
|
|
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
|
|
|
|
2025-05-01 23:57:11 +02:00
|
|
|
WP<CInputMethodV2> m_inputMethod;
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2022-12-16 17:17:31 +00:00
|
|
|
private:
|
2025-05-01 23:57:11 +02:00
|
|
|
std::vector<UP<CTextInput>> m_textInputs;
|
|
|
|
|
std::vector<UP<CInputPopup>> m_inputMethodPopups;
|
2024-03-22 23:08:52 +00:00
|
|
|
|
2025-05-01 23:57:11 +02:00
|
|
|
WP<CWLSurfaceResource> m_lastKbFocus;
|
2022-08-05 13:03:37 +02:00
|
|
|
|
2024-04-25 23:27:25 +01:00
|
|
|
struct {
|
|
|
|
|
CHyprSignalListener newTIV3;
|
2024-07-29 11:14:19 -05:00
|
|
|
CHyprSignalListener newTIV1;
|
2024-05-01 16:41:17 +01:00
|
|
|
CHyprSignalListener newIME;
|
|
|
|
|
CHyprSignalListener commitIME;
|
|
|
|
|
CHyprSignalListener destroyIME;
|
|
|
|
|
CHyprSignalListener newPopup;
|
2025-05-01 23:57:11 +02:00
|
|
|
} 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;
|
2023-03-14 12:57:50 +00:00
|
|
|
friend class CTextInputV1ProtocolManager;
|
2024-06-08 10:07:59 +02:00
|
|
|
friend class CTextInput;
|
2024-03-24 16:08:25 +00:00
|
|
|
friend class CHyprRenderer;
|
2024-03-01 14:07:36 -06:00
|
|
|
};
|