diff options
-rw-r--r-- | include/m_core.h | 1 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 321512 -> 321758 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 322540 -> 322762 bytes | |||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/modules.cpp | 28 |
6 files changed, 31 insertions, 0 deletions
diff --git a/include/m_core.h b/include/m_core.h index f39e711750..00ac529c3d 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -101,6 +101,7 @@ MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name); MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent);
MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook);
MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam = 0, LPARAM lParam = 0);
+MIR_CORE_DLL(int) CallObjectEventHook(void *pObject, HANDLE hEvent, WPARAM wParam = 0, LPARAM lParam = 0);
MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam = 0, LPARAM lParam = 0);
MIR_CORE_DLL(int) NotifyFastHook(HANDLE hEvent, WPARAM wParam = 0, LPARAM lParam = 0);
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 732885b31d..f0a817b50e 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 707908ed12..cba2f307f8 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 6e7bf951ce..2d117035ea 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1066,3 +1066,4 @@ IsTerminalDisconnected @1245 ??0CCtrlLabel@@QAE@PAVCDlgBase@@H@Z @1256 NONAME
??1CCtrlLabel@@UAE@XZ @1257 NONAME
??_7CCtrlLabel@@6B@ @1258 NONAME
+CallObjectEventHook @1259
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 748925cc79..98e8fb7ca2 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1066,3 +1066,4 @@ IsTerminalDisconnected @1245 ??0CCtrlLabel@@QEAA@PEAVCDlgBase@@H@Z @1256 NONAME
??1CCtrlLabel@@UEAA@XZ @1257 NONAME
??_7CCtrlLabel@@6B@ @1258 NONAME
+CallObjectEventHook @1259
diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index a57f0d19ea..707cf91523 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -191,6 +191,34 @@ MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wPa return 0; } +MIR_CORE_DLL(int) CallObjectEventHook(void *pObject, HANDLE hEvent, WPARAM wParam, LPARAM lParam) +{ + THook *p = (THook*)hEvent; + if (p == nullptr || pObject == nullptr) + return -1; + + mir_cslock lck(p->csHook); + for (int i = 0; i < p->subscriberCount; i++) { + THookSubscriber* s = &p->subscriber[i]; + if (s->object != pObject) + continue; + + int returnVal; + switch (s->type) { + case 3: returnVal = s->pfnHookObj(s->object, wParam, lParam); break; + case 4: returnVal = s->pfnHookObjParam(s->object, wParam, lParam, s->lParam); break; + default: continue; + } + if (returnVal) + return returnVal; + } + + if (p->subscriberCount == 0 && p->pfnHook != nullptr) + return p->pfnHook(wParam, lParam); + + return 0; +} + static int CallHookSubscribers(THook *p, WPARAM wParam, LPARAM lParam) { if (p == nullptr) |