]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/nonownedwnd.mm
Add support for VT_I8 (long long) values to wxAutomationObject.
[wxWidgets.git] / src / osx / cocoa / nonownedwnd.mm
index a11208f4ada25e931aff6db2b03815e940e5a602..a83bd48ba0e50b95d1c731cb3ef18c73da1553ae 100644 (file)
@@ -120,25 +120,21 @@ 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;
         }
-        else if ( [event type] == NSMouseMoved )
+        if ( handled )
         {
-            NSPoint nsPoint = [event locationInWindow];
-            if ( [event window] != nil )
-                nsPoint = [[event window] convertBaseToScreen:nsPoint];
-
-            wxPoint pt = wxFromNSPoint(NULL, nsPoint);
-            wxWindow* mw = ::wxFindWindowAtPoint(pt);
-            if ( mw )
-            {
-                ((wxWidgetCocoaImpl*)mw->GetPeer())->DoHandleMouseEvent( event);
-                handled = true;
-            }
+            if (wxTheApp)
+                wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
         }
     }
     return handled;
@@ -255,7 +251,18 @@ bool shouldHandleSelector(SEL selector)
 - (void)sendEvent:(NSEvent *) event
 {
     if ( ![self WX_filterSendEvent: event] )
+    {
+        WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent();
+        WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef();
+        
+        if (wxTheApp)
+            wxTheApp->MacSetCurrentEvent(event, NULL);
+        
         [super sendEvent: event];
+        
+        if (wxTheApp)
+            wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
+    }
 }
 
 @end
@@ -469,8 +476,8 @@ extern int wxOSXGetIdFromSelector(SEL action );
             [editor release];
         }
         return editor;
-    }
-
+    } 
     return nil;
 }
 
@@ -631,8 +638,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
 
     [m_macWindow setDelegate:controller];
 
-    [m_macWindow setAcceptsMouseMovedEvents: YES];
-    
     if ( ( style & wxFRAME_SHAPED) )
     {
         [m_macWindow setOpaque:NO];