From 672456655288ae8bfd67ab7047adffef6b959d77 Mon Sep 17 00:00:00 2001
From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Thu, 11 Sep 2003 18:03:59 +0000
Subject: [PATCH] mouse event handling extended

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/mac/carbon/toplevel.cpp | 7 +++++--
 src/mac/toplevel.cpp        | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp
index f5598a3c9f..a78d68ecf0 100644
--- a/src/mac/carbon/toplevel.cpp
+++ b/src/mac/carbon/toplevel.cpp
@@ -242,7 +242,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
     return result ;
 }
 
-static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
 
@@ -267,7 +267,10 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
     WindowRef window ;
     short windowPart = ::FindWindow(point, &window);
 
-    if ( IsWindowActive(window) && windowPart == inContent )
+    // either we really are active or we are capturing mouse events
+
+    if ( (IsWindowActive(window) && windowPart == inContent) || 
+        (wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindow() == toplevelWindow) )
     {
         switch ( GetEventKind( event ) )
         {
diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp
index f5598a3c9f..a78d68ecf0 100644
--- a/src/mac/toplevel.cpp
+++ b/src/mac/toplevel.cpp
@@ -242,7 +242,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
     return result ;
 }
 
-static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
 
@@ -267,7 +267,10 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
     WindowRef window ;
     short windowPart = ::FindWindow(point, &window);
 
-    if ( IsWindowActive(window) && windowPart == inContent )
+    // either we really are active or we are capturing mouse events
+
+    if ( (IsWindowActive(window) && windowPart == inContent) || 
+        (wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindow() == toplevelWindow) )
     {
         switch ( GetEventKind( event ) )
         {
-- 
2.47.2