aboutsummaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-03-31 18:34:24 +0100
committervaxerski <[email protected]>2023-03-31 18:34:24 +0100
commit1df8b1957eec9e45e9fa7ec337ef0d22d69957bd (patch)
tree1d6942411855fb6a15c4407cd06aa1d3b3930a62 /example
parent430778293e4ce7c2ae418ff11601d61833b99a67 (diff)
downloadHyprland-1df8b1957eec9e45e9fa7ec337ef0d22d69957bd.tar.gz
Hyprland-1df8b1957eec9e45e9fa7ec337ef0d22d69957bd.zip
plugins: use new lookups in example
Diffstat (limited to 'example')
-rw-r--r--example/examplePlugin/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/example/examplePlugin/main.cpp b/example/examplePlugin/main.cpp
index 6007a58b..ef829ae0 100644
--- a/example/examplePlugin/main.cpp
+++ b/example/examplePlugin/main.cpp
@@ -73,9 +73,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
g_pFocusHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&CCompositor::focusWindow, (void*)&hkFocusWindow);
// Hook a public non-member
g_pMotionHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&wlr_seat_pointer_notify_motion, (void*)&hkNotifyMotion);
- // Hook a private member (!WARNING: the signature may differ in clang. This one is for gcc ONLY.)
- g_pMouseDownHook = HyprlandAPI::createFunctionHook(
- PHANDLE, HyprlandAPI::getFunctionAddressFromSignature(PHANDLE, "_ZN13CInputManager22processMouseDownNormalEP24wlr_pointer_button_event"), (void*)&hkProcessMouseDownNormal);
+ // Hook a private member
+ static const auto METHODS = HyprlandAPI::findFunctionsByName(PHANDLE, "processMouseDownNormal");
+ g_pMouseDownHook = HyprlandAPI::createFunctionHook(PHANDLE, METHODS[0].address, (void*)&hkProcessMouseDownNormal);
// fancy notifications
HyprlandAPI::addNotificationV2(PHANDLE, {{"text", "Example hint"}, {"time", (uint64_t)10000}, {"color", CColor(0.2, 0.2, 0.9, 1.0)}, {"icon", ICON_HINT}});