#pragma once #include "nogui_platform.h" #include #include #include #include #include #include class VTYNoGUIPlatform : public NoGUIPlatform { public: VTYNoGUIPlatform(); ~VTYNoGUIPlatform(); bool Initialize(); void ReportError(const std::string_view& title, const std::string_view& message) override; bool ConfirmMessage(const std::string_view& title, const std::string_view& message) override; void SetDefaultConfig(SettingsInterface& si) override; bool CreatePlatformWindow(std::string title) override; void DestroyPlatformWindow() override; std::optional GetPlatformWindowInfo() override; void SetPlatformWindowTitle(std::string title) override; std::optional ConvertHostKeyboardStringToCode(const std::string_view& str) override; std::optional ConvertHostKeyboardCodeToString(u32 code) override; void RunMessageLoop() override; void ExecuteInMessageLoop(std::function func) override; void QuitMessageLoop() override; void SetFullscreen(bool enabled) override; bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override; bool OpenURL(const std::string_view& url) override; bool CopyTextToClipboard(const std::string_view& text) override; private: void OpenEVDevFDs(); void CloseEVDevFDs(); void PollEvDevKeyboards(); void SetImGuiKeyMap(); struct EvDevKeyboard { struct libevdev* obj; int fd; }; std::vector m_evdev_keyboards; std::deque> m_callback_queue; std::mutex m_callback_queue_mutex; std::atomic_bool m_message_loop_running{false}; };