+// ----------------------------------------------------------------------------
+// Carbon Events handlers
+// ----------------------------------------------------------------------------
+
+// prototype for function in src/mac/carbon/toplevel.cpp
+void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent );
+
+static const EventTypeSpec eventList[] =
+{
+ //{ kEventClassControl, kEventControlTrack } ,
+ { kEventClassMouse, kEventMouseUp },
+ { kEventClassMouse, kEventMouseDown },
+ { kEventClassMouse, kEventMouseMoved },
+ { kEventClassMouse, kEventMouseDragged },
+#if DEBUG_WEBKIT_SIZING == 1
+ { kEventClassControl, kEventControlBoundsChanged } ,
+#endif
+};
+
+static pascal OSStatus wxWebKitCtrlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+
+ wxMacCarbonEvent cEvent( event ) ;
+
+ ControlRef controlRef ;
+ wxWebKitCtrl* thisWindow = (wxWebKitCtrl*) data ;
+ wxTopLevelWindowMac* tlw = NULL;
+ if (thisWindow)
+ tlw = thisWindow->MacGetTopLevelWindow();
+
+ cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
+
+ wxWindow* currentMouseWindow = thisWindow ;
+
+ if ( wxApp::s_captureWindow )
+ currentMouseWindow = wxApp::s_captureWindow;
+
+ switch ( GetEventKind( event ) )
+ {
+ case kEventMouseDragged :
+ case kEventMouseMoved :
+ {
+ wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
+ SetupMouseEvent( wxevent , cEvent ) ;
+
+ currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ;
+ wxevent.SetEventObject( currentMouseWindow ) ;
+ wxevent.SetId( currentMouseWindow->GetId() ) ;
+
+ if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) )
+ {
+ result = noErr;
+ }
+
+ break; // this should enable WebKit to fire mouse dragged and mouse up events...
+ }
+
+ case kEventControlBoundsChanged:
+ {
+ // this is just here for debugging, so we can note any differences between
+ // native event sizes and the sizes the wxWindow receives.
+ Rect origBounds = cEvent.GetParameter<Rect>(kEventParamOriginalBounds, typeQDRectangle) ;
+ Rect prevBounds = cEvent.GetParameter<Rect>(kEventParamPreviousBounds, typeQDRectangle) ;
+ Rect curBounds = cEvent.GetParameter<Rect>(kEventParamCurrentBounds, typeQDRectangle) ;
+
+ fprintf(stderr, "Orig bounds x=%d, y=%d, height=%d, width=%d\n", origBounds.left, origBounds.top, origBounds.bottom -origBounds.top, origBounds.right - origBounds.left);
+ fprintf(stderr, "Prev bounds x=%d, y=%d, height=%d, width=%d\n", prevBounds.left, prevBounds.top, prevBounds.bottom -prevBounds.top, prevBounds.right - prevBounds.left);
+ fprintf(stderr, "Cur bounds x=%d, y=%d, height=%d, width=%d\n", curBounds.left, curBounds.top, curBounds.bottom -curBounds.top, curBounds.right - curBounds.left);
+ }
+ default :
+ break ;
+ }
+
+ result = CallNextEventHandler(handler, event);
+ return result ;
+}
+
+DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebKitCtrlEventHandler )
+
+