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
|
|
@ -1,9 +1,8 @@
|
|||
#include "ExtWorkspace.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/eventLoop/EventLoopManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
#include <algorithm>
|
||||
#include <any>
|
||||
#include <utility>
|
||||
#include "core/Output.hpp"
|
||||
|
||||
|
|
@ -297,17 +296,13 @@ void CExtWorkspaceManagerResource::onWorkspaceCreated(const PHLWORKSPACE& worksp
|
|||
}
|
||||
|
||||
CExtWorkspaceProtocol::CExtWorkspaceProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P1 = g_pHookSystem->hookDynamic("createWorkspace", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
auto workspace = std::any_cast<CWorkspace*>(data)->m_self.lock();
|
||||
|
||||
static auto P1 = Event::bus()->m_events.workspace.created.listen([this](PHLWORKSPACEREF workspace) {
|
||||
for (auto const& m : m_managers) {
|
||||
m->onWorkspaceCreated(workspace);
|
||||
m->onWorkspaceCreated(workspace.lock());
|
||||
}
|
||||
});
|
||||
|
||||
static auto P2 = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
auto monitor = std::any_cast<PHLMONITOR>(data);
|
||||
|
||||
static auto P2 = Event::bus()->m_events.monitor.added.listen([this](PHLMONITOR monitor) {
|
||||
for (auto const& m : m_managers) {
|
||||
m->onMonitorCreated(monitor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include "Fifo.hpp"
|
||||
#include "Compositor.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
|
||||
CFifoResource::CFifoResource(UP<CWpFifoV1>&& resource_, SP<CWLSurfaceResource> surface) : m_resource(std::move(resource_)), m_surface(surface) {
|
||||
if UNLIKELY (!m_resource->resource())
|
||||
|
|
@ -153,9 +153,7 @@ bool CFifoManagerResource::good() {
|
|||
}
|
||||
|
||||
CFifoProtocol::CFifoProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
auto M = std::any_cast<PHLMONITOR>(param);
|
||||
|
||||
static auto P = Event::bus()->m_events.monitor.added.listen([this](PHLMONITOR M) {
|
||||
M->m_events.presented.listenStatic([this, m = PHLMONITORREF{M}]() {
|
||||
if (!m || !PROTO::fifo)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "ForeignToplevel.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
|
||||
CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : m_resource(resource_), m_window(pWindow_) {
|
||||
if UNLIKELY (!resource_->resource())
|
||||
|
|
@ -123,9 +123,7 @@ bool CForeignToplevelList::good() {
|
|||
}
|
||||
|
||||
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
auto window = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
static auto P = Event::bus()->m_events.window.open.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
|
|
@ -134,9 +132,7 @@ CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, co
|
|||
}
|
||||
});
|
||||
|
||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
auto window = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
static auto P1 = Event::bus()->m_events.window.close.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
|
|
@ -145,9 +141,7 @@ CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, co
|
|||
}
|
||||
});
|
||||
|
||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
auto window = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
static auto P2 = Event::bus()->m_events.window.title.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/EventManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
|
||||
CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : m_resource(resource_), m_window(pWindow_) {
|
||||
if UNLIKELY (!resource_->resource())
|
||||
|
|
@ -343,70 +343,57 @@ bool CForeignToplevelWlrManager::good() {
|
|||
}
|
||||
|
||||
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
if (!windowValidForForeign(PWINDOW))
|
||||
static auto P = Event::bus()->m_events.window.open.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onMap(PWINDOW);
|
||||
m->onMap(window);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
if (!windowValidForForeign(PWINDOW))
|
||||
static auto P1 = Event::bus()->m_events.window.close.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onUnmap(PWINDOW);
|
||||
m->onUnmap(window);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
if (!windowValidForForeign(PWINDOW))
|
||||
static auto P2 = Event::bus()->m_events.window.title.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onTitle(PWINDOW);
|
||||
m->onTitle(window);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<Desktop::View::SWindowActiveEvent>(data).window;
|
||||
|
||||
if (PWINDOW && !windowValidForForeign(PWINDOW))
|
||||
static auto P3 = Event::bus()->m_events.window.active.listen([this](PHLWINDOW window, Desktop::eFocusReason reason) {
|
||||
if (window && !windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onNewFocus(PWINDOW);
|
||||
m->onNewFocus(window);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
|
||||
const auto PWORKSPACE = std::any_cast<PHLWORKSPACE>(std::any_cast<std::vector<std::any>>(data).at(1));
|
||||
|
||||
if (!PWORKSPACE)
|
||||
static auto P4 = Event::bus()->m_events.window.moveToWorkspace.listen([this](PHLWINDOW window, PHLWORKSPACE ws) {
|
||||
if (!ws)
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onMoveMonitor(PWINDOW, PWORKSPACE->m_monitor.lock());
|
||||
m->onMoveMonitor(window, ws->m_monitor.lock());
|
||||
}
|
||||
});
|
||||
|
||||
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
|
||||
if (!windowValidForForeign(PWINDOW))
|
||||
static auto P5 = Event::bus()->m_events.window.fullscreen.listen([this](PHLWINDOW window) {
|
||||
if (!windowValidForForeign(window))
|
||||
return;
|
||||
|
||||
for (auto const& m : m_managers) {
|
||||
m->onFullscreen(PWINDOW);
|
||||
m->onFullscreen(window);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
#include "core/Compositor.hpp"
|
||||
#include "types/DMABuffer.hpp"
|
||||
#include "types/WLBuffer.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../render/OpenGL.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
|
||||
using namespace Hyprutils::OS;
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ void CLinuxDMABUFResource::sendMods() {
|
|||
}
|
||||
|
||||
CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("ready", [this](void* self, SCallbackInfo& info, std::any d) {
|
||||
static auto P = Event::bus()->m_events.ready.listen([this] {
|
||||
int rendererFD = g_pCompositor->m_drmRenderNode.fd >= 0 ? g_pCompositor->m_drmRenderNode.fd : g_pCompositor->m_drm.fd;
|
||||
auto dev = devIDFromFD(rendererFD);
|
||||
|
||||
|
|
@ -467,24 +467,22 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
|||
tches.emplace_back(std::make_pair<>(mon, tranche));
|
||||
}
|
||||
|
||||
static auto monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
||||
auto tranche = SDMABUFTranche{
|
||||
.device = m_mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
.formats = pMonitor->m_output->getRenderFormats(),
|
||||
static auto monitorAdded = Event::bus()->m_events.monitor.added.listen([this](PHLMONITOR mon) {
|
||||
auto tranche = SDMABUFTranche{
|
||||
.device = m_mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
.formats = mon->m_output->getRenderFormats(),
|
||||
};
|
||||
m_formatTable->m_monitorTranches.emplace_back(std::make_pair<>(pMonitor, tranche));
|
||||
m_formatTable->m_monitorTranches.emplace_back(std::make_pair<>(mon, tranche));
|
||||
resetFormatTable();
|
||||
});
|
||||
|
||||
static auto monitorRemoved = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
||||
std::erase_if(m_formatTable->m_monitorTranches, [pMonitor](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == pMonitor; });
|
||||
static auto monitorRemoved = Event::bus()->m_events.monitor.removed.listen([this](PHLMONITOR mon) {
|
||||
std::erase_if(m_formatTable->m_monitorTranches, [mon](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == mon; });
|
||||
resetFormatTable();
|
||||
});
|
||||
|
||||
static auto configReloaded = g_pHookSystem->hookDynamic("configReloaded", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
static auto configReloaded = Event::bus()->m_events.config.reloaded.listen([this] {
|
||||
static const auto PSKIP_NON_KMS = CConfigValue<Hyprlang::INT>("quirks:skip_non_kms_dmabuf_formats");
|
||||
static auto prev = *PSKIP_NON_KMS;
|
||||
if (prev != *PSKIP_NON_KMS) {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#include <algorithm>
|
||||
#include "../Compositor.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
|
||||
using namespace Aquamarine;
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ bool COutputConfigurationHead::good() {
|
|||
}
|
||||
|
||||
COutputManagementProtocol::COutputManagementProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("monitorLayoutChanged", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
static auto P = Event::bus()->m_events.monitor.layoutChanged.listen([this] {
|
||||
updateAllOutputs();
|
||||
sendPendingSuccessEvents();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "PresentationTime.hpp"
|
||||
#include <algorithm>
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "core/Output.hpp"
|
||||
#include <aquamarine/output/Output.hpp>
|
||||
|
|
@ -77,10 +77,8 @@ void CPresentationFeedback::sendQueued(WP<CQueuedPresentationData> data, const t
|
|||
}
|
||||
|
||||
CPresentationProtocol::CPresentationProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
const auto PMONITOR = PHLMONITORREF{std::any_cast<PHLMONITOR>(param)};
|
||||
std::erase_if(m_queue, [PMONITOR](const auto& other) { return !other->m_surface || other->m_monitor == PMONITOR; });
|
||||
});
|
||||
static auto P = Event::bus()->m_events.monitor.removed.listen(
|
||||
[this](PHLMONITOR mon) { std::erase_if(m_queue, [mon](const auto& other) { return !other->m_surface || other->m_monitor == mon; }); });
|
||||
}
|
||||
|
||||
void CPresentationProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
#include "TearingControl.hpp"
|
||||
#include "../managers/ProtocolManager.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
|
||||
CTearingControlProtocol::CTearingControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P =
|
||||
g_pHookSystem->hookDynamic("destroyWindow", [this](void* self, SCallbackInfo& info, std::any param) { this->onWindowDestroy(std::any_cast<PHLWINDOW>(param)); });
|
||||
static auto P = Event::bus()->m_events.window.destroy.listen([this](PHLWINDOW window) { onWindowDestroy(window); });
|
||||
}
|
||||
|
||||
void CTearingControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "../Compositor.hpp"
|
||||
#include "ForeignToplevelWlr.hpp"
|
||||
#include "../managers/screenshare/ScreenshareManager.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../helpers/Format.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "../config/ConfigValue.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../xwayland/XWayland.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../event/EventBus.hpp"
|
||||
#include "core/Output.hpp"
|
||||
|
||||
#define OUTPUT_MANAGER_VERSION 3
|
||||
|
|
@ -36,8 +36,8 @@ void CXDGOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver
|
|||
}
|
||||
|
||||
CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("monitorLayoutChanged", [this](void* self, SCallbackInfo& info, std::any param) { this->updateAllOutputs(); });
|
||||
static auto P2 = g_pHookSystem->hookDynamic("configReloaded", [this](void* self, SCallbackInfo& info, std::any param) { this->updateAllOutputs(); });
|
||||
static auto P = Event::bus()->m_events.monitor.layoutChanged.listen([this] { updateAllOutputs(); });
|
||||
static auto P2 = Event::bus()->m_events.config.reloaded.listen([this] { updateAllOutputs(); });
|
||||
}
|
||||
|
||||
void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32_t id, wl_resource* outputResource) {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
#include "../../xwayland/XWayland.hpp"
|
||||
#include "../../xwayland/Server.hpp"
|
||||
#include "../../managers/input/InputManager.hpp"
|
||||
#include "../../managers/HookSystemManager.hpp"
|
||||
#include "../../managers/cursor/CursorShapeOverrideController.hpp"
|
||||
#include "../../helpers/Monitor.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../../xwayland/Dnd.hpp"
|
||||
#include "../../event/EventBus.hpp"
|
||||
using namespace Hyprutils::OS;
|
||||
|
||||
CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_) : m_source(source_), m_resource(resource_) {
|
||||
|
|
@ -586,29 +586,26 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
|||
});
|
||||
}
|
||||
|
||||
m_dnd.mouseButton = g_pHookSystem->hookDynamic("mouseButton", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||
auto E = std::any_cast<IPointer::SButtonEvent>(e);
|
||||
if (E.state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||
m_dnd.mouseButton = Event::bus()->m_events.input.mouse.button.listen([this](IPointer::SButtonEvent e, Event::SCallbackInfo&) {
|
||||
if (e.state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||
LOGM(Log::DEBUG, "Dropping drag on mouseUp");
|
||||
dropDrag();
|
||||
}
|
||||
});
|
||||
|
||||
m_dnd.touchUp = g_pHookSystem->hookDynamic("touchUp", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||
m_dnd.touchUp = Event::bus()->m_events.input.touch.up.listen([this](ITouch::SUpEvent e, Event::SCallbackInfo&) {
|
||||
LOGM(Log::DEBUG, "Dropping drag on touchUp");
|
||||
dropDrag();
|
||||
});
|
||||
|
||||
m_dnd.tabletTip = g_pHookSystem->hookDynamic("tabletTip", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||
auto E = std::any_cast<CTablet::STipEvent>(e);
|
||||
if (!E.in) {
|
||||
m_dnd.tabletTip = Event::bus()->m_events.input.tablet.tip.listen([this](CTablet::STipEvent e, Event::SCallbackInfo&) {
|
||||
if (!e.in) {
|
||||
LOGM(Log::DEBUG, "Dropping drag on tablet tipUp");
|
||||
dropDrag();
|
||||
}
|
||||
});
|
||||
|
||||
m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||
auto V = std::any_cast<const Vector2D>(e);
|
||||
m_dnd.mouseMove = Event::bus()->m_events.input.mouse.move.listen([this](Vector2D pos, Event::SCallbackInfo&) {
|
||||
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
||||
auto surf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
||||
|
||||
|
|
@ -620,13 +617,12 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
|||
if (!box.has_value())
|
||||
return;
|
||||
|
||||
m_dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), V - box->pos());
|
||||
LOGM(Log::DEBUG, "Drag motion {}", V - box->pos());
|
||||
m_dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), pos - box->pos());
|
||||
LOGM(Log::DEBUG, "Drag motion {}", pos - box->pos());
|
||||
}
|
||||
});
|
||||
|
||||
m_dnd.touchMove = g_pHookSystem->hookDynamic("touchMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||
m_dnd.touchMove = Event::bus()->m_events.input.touch.motion.listen([this](ITouch::SMotionEvent e, Event::SCallbackInfo&) {
|
||||
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
||||
auto surf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
||||
|
||||
|
|
@ -638,8 +634,8 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
|||
if (!box.has_value())
|
||||
return;
|
||||
|
||||
m_dnd.focusedDevice->sendMotion(E.timeMs, E.pos);
|
||||
LOGM(Log::DEBUG, "Drag motion {}", E.pos);
|
||||
m_dnd.focusedDevice->sendMotion(e.timeMs, e.pos);
|
||||
LOGM(Log::DEBUG, "Drag motion {}", e.pos);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -178,11 +178,11 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
|
|||
CHyprSignalListener dndSurfaceCommit;
|
||||
|
||||
// for ending a dnd
|
||||
SP<HOOK_CALLBACK_FN> mouseMove;
|
||||
SP<HOOK_CALLBACK_FN> mouseButton;
|
||||
SP<HOOK_CALLBACK_FN> touchUp;
|
||||
SP<HOOK_CALLBACK_FN> touchMove;
|
||||
SP<HOOK_CALLBACK_FN> tabletTip;
|
||||
CHyprSignalListener mouseMove;
|
||||
CHyprSignalListener mouseButton;
|
||||
CHyprSignalListener touchUp;
|
||||
CHyprSignalListener touchMove;
|
||||
CHyprSignalListener tabletTip;
|
||||
} m_dnd;
|
||||
|
||||
void abortDrag();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue