diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-13 22:18:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-13 22:18:51 +0000 |
commit | fc5bf903988ed773e8fc0199fb5a427ced6b01d9 (patch) | |
tree | e5b1fd80d870ef9692cbb0796581a60883628ace /src/core/modules.cpp | |
parent | a04043571f2d04ff9d117f921115f97f7bf42870 (diff) |
roadmap milestone #1
git-svn-id: http://svn.miranda-ng.org/main/trunk@402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/modules.cpp')
-rw-r--r-- | src/core/modules.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 7b2a833c32..a24d554a29 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -344,9 +344,41 @@ int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook) return 0;
}
-int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam )
+int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
- int i, returnVal = 0;
+ int returnVal = 0;
+ THook* p = ( THook* )hEvent;
+ if ( p == NULL )
+ return -1;
+
+ EnterCriticalSection( &p->csHook );
+ for ( int i = 0; i < p->subscriberCount; i++ ) {
+ THookSubscriber* s = &p->subscriber[i];
+ if ( s->hOwner != hInst )
+ continue;
+
+ switch ( s->type ) {
+ case 1: returnVal = s->pfnHook( wParam, lParam ); break;
+ case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
+ case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
+ case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
+ case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ default: continue;
+ }
+ if ( returnVal )
+ break;
+ }
+
+ if ( p->subscriberCount == 0 && p->pfnHook != 0 )
+ returnVal = p->pfnHook( wParam, lParam );
+
+ LeaveCriticalSection( &p->csHook );
+ return returnVal;
+}
+
+int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
+{
+ int returnVal = 0;
THook* p = ( THook* )hEvent;
if ( p == NULL )
return -1;
@@ -354,7 +386,7 @@ int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam ) EnterCriticalSection( &p->csHook );
// NOTE: We've got the critical section while all this lot are called. That's mostly safe, though.
- for ( i = 0; i < p->subscriberCount; i++ ) {
+ for ( int i = 0; i < p->subscriberCount; i++ ) {
THookSubscriber* s = &p->subscriber[i];
switch ( s->type ) {
case 1: returnVal = s->pfnHook( wParam, lParam ); break;
|