+ EventRecord* ev = (EventRecord*) evr ;
+ switch( ( ev->message & osEvtMessageMask ) >> 24 )
+ {
+ case suspendResumeMessage :
+ {
+ bool isResuming = ev->message & resumeFlag ;
+ bool convertClipboard = ev->message & convertClipboardFlag ;
+
+ bool doesActivate = UMAGetProcessModeDoesActivateOnFGSwitch() ;
+ if ( isResuming )
+ {
+ WindowRef oldFrontWindow = NULL ;
+ WindowRef newFrontWindow = NULL ;
+
+ // in case we don't take care of activating ourselves, we have to synchronize
+ // our idea of the active window with the process manager's - which it already activated
+
+ if ( !doesActivate )
+ oldFrontWindow = ::FrontNonFloatingWindow() ;
+
+ MacResume( convertClipboard ) ;
+
+ newFrontWindow = ::FrontNonFloatingWindow() ;
+
+ if ( oldFrontWindow )
+ {
+ wxTopLevelWindowMac* win = wxFindWinFromMacWindow( oldFrontWindow ) ;
+ if ( win )
+ win->MacActivate( ev->when , false ) ;
+ }
+ if ( newFrontWindow )
+ {
+ wxTopLevelWindowMac* win = wxFindWinFromMacWindow( newFrontWindow ) ;
+ if ( win )
+ win->MacActivate( ev->when , true ) ;
+ }
+ }
+ else
+ {
+ MacSuspend( convertClipboard ) ;
+ }
+ }
+ break ;
+ case mouseMovedMessage :
+ {
+ WindowRef window;
+
+ wxWindow* currentMouseWindow = NULL ;
+
+ if (s_captureWindow )
+ {
+ currentMouseWindow = s_captureWindow ;
+ }
+ else
+ {
+ wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
+ ¤tMouseWindow ) ;
+ }
+
+ if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
+ {
+ wxMouseEvent event ;
+
+ bool isDown = !(ev->modifiers & btnState) ; // 1 is for up
+ bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
+
+ event.m_leftDown = isDown && !controlDown;
+ event.m_middleDown = FALSE;
+ event.m_rightDown = isDown && controlDown;
+ event.m_shiftDown = ev->modifiers & shiftKey;
+ event.m_controlDown = ev->modifiers & controlKey;
+ event.m_altDown = ev->modifiers & optionKey;
+ event.m_metaDown = ev->modifiers & cmdKey;
+ event.m_x = ev->where.h;
+ event.m_y = ev->where.v;
+ event.m_timeStamp = ev->when;
+ event.SetEventObject(this);
+
+ if ( wxWindow::s_lastMouseWindow )
+ {
+ wxMouseEvent eventleave(event);
+ eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
+ wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
+ eventleave.SetEventObject( wxWindow::s_lastMouseWindow ) ;
+
+ wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
+ }
+ if ( currentMouseWindow )
+ {
+ wxMouseEvent evententer(event);
+ evententer.SetEventType( wxEVT_ENTER_WINDOW );
+ currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
+ evententer.SetEventObject( currentMouseWindow ) ;
+ currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
+ }
+ wxWindow::s_lastMouseWindow = currentMouseWindow ;
+ }
+
+ short windowPart = inNoWindow ;
+
+ if ( s_captureWindow )
+ {
+ window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
+ windowPart = inContent ;
+ }
+ else
+ {
+ windowPart = ::FindWindow(ev->where, &window);
+ }
+
+ switch (windowPart)
+ {
+ case inContent :
+ {
+ wxTopLevelWindowMac* win = wxFindWinFromMacWindow( window ) ;
+ if ( win )
+ win->MacMouseMoved( ev , windowPart ) ;
+ else
+ {
+ if ( wxIsBusy() )
+ {
+ }
+ else
+ UMAShowArrowCursor();
+ }
+ }
+ break;
+ default :
+ {
+ if ( wxIsBusy() )
+ {
+ }
+ else
+ UMAShowArrowCursor();
+ }
+ break ;
+ }
+ }
+ break ;
+
+ }