event: refactor HookSystem into a typed event bus (#13333)
Refactors the old HookSystem into a typed event bus with clear separation, discovery and types.
This commit is contained in:
parent
b4ee4674f9
commit
b88813c7ef
58 changed files with 493 additions and 516 deletions
|
|
@ -2,9 +2,9 @@
|
|||
#include "../../render/OpenGL.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../HookSystemManager.hpp"
|
||||
#include "../EventManager.hpp"
|
||||
#include "../eventLoop/EventLoopManager.hpp"
|
||||
#include "../../event/EventBus.hpp"
|
||||
|
||||
using namespace Screenshare;
|
||||
|
||||
|
|
@ -119,18 +119,18 @@ void CScreenshareSession::calculateConstraints() {
|
|||
void CScreenshareSession::screenshareEvents(bool startSharing) {
|
||||
if (startSharing && !m_sharing) {
|
||||
m_sharing = true;
|
||||
EMIT_HOOK_EVENT("screencast", (std::vector<std::any>{1, m_type}));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "screencast", .data = std::format("1,{}", m_type)});
|
||||
EMIT_HOOK_EVENT("screencastv2", (std::vector<std::any>{1, m_type, m_name}));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "screencastv2", .data = std::format("1,{},{}", m_type, m_name)});
|
||||
LOGM(Log::INFO, "New screenshare session for ({}): {}", m_type, m_name);
|
||||
|
||||
Event::bus()->m_events.screenshare.state.emit(true, m_type, m_name);
|
||||
} else if (!startSharing && m_sharing) {
|
||||
m_sharing = false;
|
||||
EMIT_HOOK_EVENT("screencast", (std::vector<std::any>{0, m_type}));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "screencast", .data = std::format("0,{}", m_type)});
|
||||
EMIT_HOOK_EVENT("screencastv2", (std::vector<std::any>{0, m_type, m_name}));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "screencastv2", .data = std::format("0,{},{}", m_type, m_name)});
|
||||
LOGM(Log::INFO, "Stopped screenshare session for ({}): {}", m_type, m_name);
|
||||
|
||||
Event::bus()->m_events.screenshare.state.emit(false, m_type, m_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue