]> git.saurik.com Git - wxWidgets.git/commitdiff
setting up current event also when mouse is captured ...
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 26 Feb 2012 10:21:03 +0000 (10:21 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 26 Feb 2012 10:21:03 +0000 (10:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/nonownedwnd.mm

index a11208f4ada25e931aff6db2b03815e940e5a602..6413556029bf69b0abc340f410919e21f6f17eb6 100644 (file)
@@ -120,9 +120,14 @@ bool shouldHandleSelector(SEL selector)
     bool handled = false;
     if ( ([event type] >= NSLeftMouseDown) && ([event type] <= NSMouseExited) )
     {
+        WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent();
+        WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef();
+
         wxWindow* cw = wxWindow::GetCapture();
         if ( cw != NULL )
         {
+            if (wxTheApp)
+                wxTheApp->MacSetCurrentEvent(event, NULL);
             ((wxWidgetCocoaImpl*)cw->GetPeer())->DoHandleMouseEvent( event);
             handled = true;
         }
@@ -136,10 +141,17 @@ bool shouldHandleSelector(SEL selector)
             wxWindow* mw = ::wxFindWindowAtPoint(pt);
             if ( mw )
             {
+                if (wxTheApp)
+                    wxTheApp->MacSetCurrentEvent(event, NULL);
                 ((wxWidgetCocoaImpl*)mw->GetPeer())->DoHandleMouseEvent( event);
                 handled = true;
             }
         }
+        if ( handled )
+        {
+            if (wxTheApp)
+                wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
+        }
     }
     return handled;
 }
@@ -469,8 +481,8 @@ extern int wxOSXGetIdFromSelector(SEL action );
             [editor release];
         }
         return editor;
-    }
-
+    } 
     return nil;
 }