From 01df3b73d815beaa892849ae7bd4eddc94642dc7 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 25 Apr 2024 14:32:35 +0100 Subject: shortcuts-inhibitor: move to new impl --- src/protocols/ShortcutsInhibit.hpp | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/protocols/ShortcutsInhibit.hpp (limited to 'src/protocols/ShortcutsInhibit.hpp') diff --git a/src/protocols/ShortcutsInhibit.hpp b/src/protocols/ShortcutsInhibit.hpp new file mode 100644 index 00000000..4e06938f --- /dev/null +++ b/src/protocols/ShortcutsInhibit.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include +#include "WaylandProtocol.hpp" +#include "keyboard-shortcuts-inhibit-unstable-v1.hpp" + +class CKeyboardShortcutsInhibitor { + public: + CKeyboardShortcutsInhibitor(SP resource_, wlr_surface* surf); + + // read-only pointer, may be invalid + wlr_surface* surface(); + bool good(); + + private: + SP resource; + wlr_surface* pSurface = nullptr; +}; + +class CKeyboardShortcutsInhibitProtocol : public IWaylandProtocol { + public: + CKeyboardShortcutsInhibitProtocol(const wl_interface* iface, const int& ver, const std::string& name); + + virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); + + bool isInhibited(); + + private: + void onManagerResourceDestroy(wl_resource* res); + void destroyInhibitor(CKeyboardShortcutsInhibitor* pointer); + void onInhibit(CZwpKeyboardShortcutsInhibitManagerV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* seat); + + // + std::vector> m_vManagers; + std::vector> m_vInhibitors; + + friend class CKeyboardShortcutsInhibitor; +}; + +namespace PROTO { + inline UP shortcutsInhibit; +}; \ No newline at end of file -- cgit v1.2.3