static const EventTypeSpec eventList[] =
{
// TODO: remove control related event like key and mouse (except for WindowLeave events)
-#if 1
- { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
{ kEventClassKeyboard, kEventRawKeyDown } ,
{ kEventClassKeyboard, kEventRawKeyRepeat } ,
{ kEventClassKeyboard, kEventRawKeyUp } ,
{ kEventClassKeyboard, kEventRawKeyModifiersChanged } ,
-#endif
+
+ { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
+ { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } ,
{ kEventClassWindow , kEventWindowShown } ,
{ kEventClassWindow , kEventWindowActivated } ,
{ kEventClassMouse , kEventMouseDragged } ,
} ;
-static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
-{
- OSStatus result = eventNotHandledErr ;
- wxWindow* focus ;
- UInt32 keyCode, modifiers ;
- Point point ;
- EventRef rawEvent ;
- unsigned char charCode ;
-
- GetEventParameter( event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent ) ;
-
- GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode );
- GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
- GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
- GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point );
-
- focus = wxWindow::FindFocus() ;
-
- switch ( GetEventKind( event ) )
- {
- case kEventTextInputUnicodeForKeyEvent :
- {
- // this is only called when no default handler has jumped in, e.g. a wxControl on a floater window does not
- // get its own kEventTextInputUnicodeForKeyEvent, so we reroute the event back to the control
- wxControl* control = wxDynamicCast( focus , wxControl ) ;
- if ( control )
- {
- ControlRef macControl = (ControlRef) control->GetHandle() ;
- if ( macControl )
- {
- ::HandleControlKey( macControl , keyCode , charCode , modifiers ) ;
- result = noErr ;
- }
- }
-
-#if 0
- // this may lead to double events sent to a window in case all handlers have skipped the key down event
- UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
- UInt32 message = (keyCode << 8) + charCode;
-
- if ( (focus != NULL) &&
- wxTheApp->MacSendKeyDownEvent( focus , message , modifiers , when , point.h , point.v ) )
- {
- result = noErr ;
- }
-#endif
- }
- break ;
-
- default:
- break ;
- }
-
- return result ;
-}
-
static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
Point windowMouseLocation = screenMouseLocation ;
- WindowRef window ;
+ WindowRef window = NULL;
short windowPart = ::FindWindow(screenMouseLocation, &window);
wxWindow* currentMouseWindow = NULL ;
#endif
}
}
+
+ // disabled windows must not get any input messages
+ if ( currentMouseWindow && !currentMouseWindow->MacIsReallyEnabled() )
+ currentMouseWindow = NULL;
}
}
// make tooltips current
#if wxUSE_TOOLTIPS
- if ( wxevent.GetEventType() == wxEVT_MOTION
- || wxevent.GetEventType() == wxEVT_ENTER_WINDOW
- || wxevent.GetEventType() == wxEVT_LEAVE_WINDOW )
+ if ( wxevent.GetEventType() == wxEVT_MOTION )
wxToolTip::RelayEvent( currentMouseWindow , wxevent );
#endif
cursorPoint += cursorTarget->GetPosition();
}
- } // else if ( currentMouseWindow )
- else
+ }
+ else // currentMouseWindow == NULL
{
// don't mess with controls we don't know about
// for some reason returning eventNotHandledErr does not lead to the correct behaviour
{
EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
Point clickLocation = windowMouseLocation ;
+#if TARGET_API_MAC_OSX
if ( toplevelWindow->MacUsesCompositing() )
{
-#ifdef __WXMAC_OSX__
HIPoint hiPoint ;
hiPoint.x = clickLocation.h ;
hiPoint.y = clickLocation.v ;
HIViewConvertPoint( &hiPoint , (ControlRef) toplevelWindow->GetHandle() , control ) ;
clickLocation.h = (int)hiPoint.x ;
clickLocation.v = (int)hiPoint.y ;
-#endif
}
+#endif // TARGET_API_MAC_OSX
HandleControlClick( control , clickLocation , modifiers , (ControlActionUPP ) -1 ) ;
result = noErr ;
wxFrame *frame = wxDynamicCast( toplevelWindow , wxFrame ) ;
if ( frame )
{
-#if wxUSE_STATUSBAR
- frame->PositionStatusBar();
-#endif
-#if wxUSE_TOOLBAR
- frame->PositionToolBar();
-#endif
+ frame->PositionBars();
}
wxSizeEvent event( r.GetSize() , toplevelWindow->GetId() ) ;
return result ;
}
+// mix this in from window.cpp
+pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ;
+
pascal OSStatus wxMacTopLevelEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
switch ( GetEventClass( event ) )
{
- case kEventClassKeyboard :
- result = KeyboardEventHandler( handler, event , data ) ;
+ case kEventClassTextInput :
+ result = wxMacUnicodeTextEventHandler( handler, event , data ) ;
break ;
- case kEventClassTextInput :
- result = TextInputEventHandler( handler, event , data ) ;
+ case kEventClassKeyboard :
+ result = KeyboardEventHandler( handler, event , data ) ;
break ;
case kEventClassWindow :
{
wxPoint m_position ;
wxSize m_size ;
+ bool m_wasResizable ;
}
FullScreenData ;
// the root control level handler
MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ;
-#if TARGET_API_MAC_OSX
+ // Causes the inner part of the window not to be metal
+ // if the style is used before window creation.
+#if 0 // TARGET_API_MAC_OSX
if ( m_macUsesCompositing && m_macWindow != NULL )
{
if ( GetExtraStyle() & wxFRAME_EX_METAL )
if ( !wxTopLevelWindowBase::Show(show) )
return false;
- if (show)
- {
+ bool plainTransition = false;
+
#if wxUSE_SYSTEM_OPTIONS
- // code contributed by Ryan Wilcox December 18, 2003
- bool plainTransition = UMAGetSystemVersion() >= 0x1000 ;
- if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
- plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
+ // code contributed by Ryan Wilcox December 18, 2003
+ plainTransition = UMAGetSystemVersion() >= 0x1000 ;
+ if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
+ plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
+#endif
+ if (show)
+ {
if ( plainTransition )
::ShowWindow( (WindowRef)m_macWindow );
else
::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL );
-#else
-
- ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL );
-#endif
::SelectWindow( (WindowRef)m_macWindow ) ;
}
else
{
-#if wxUSE_SYSTEM_OPTIONS
- bool plainTransition = UMAGetSystemVersion() >= 0x1000 ;
- if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
- plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
if ( plainTransition )
- {
- ::HideWindow((WindowRef) m_macWindow );
- }
+ ::HideWindow( (WindowRef)m_macWindow );
else
-#endif
- {
- ::TransitionWindow((WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowHideTransitionAction, NULL );
- }
+ ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowHideTransitionAction, NULL );
}
MacPropagateVisibilityChanged() ;
m_macFullScreenData = data ;
data->m_position = GetPosition() ;
data->m_size = GetSize() ;
+ data->m_wasResizable = MacGetWindowAttributes() & kWindowResizableAttribute ;
if ( style & wxFULLSCREEN_NOMENUBAR )
HideMenuBar() ;
}
SetSize( x , y , w, h ) ;
+ if ( data->m_wasResizable )
+ MacChangeWindowAttributes( kWindowNoAttributes , kWindowResizableAttribute ) ;
}
else
{
ShowMenuBar() ;
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
+ if ( data->m_wasResizable )
+ MacChangeWindowAttributes( kWindowResizableAttribute , kWindowNoAttributes ) ;
SetPosition( data->m_position ) ;
SetSize( data->m_size ) ;
return m_macFullScreenData != NULL ;
}
-void wxTopLevelWindowMac::SetExtraStyle(long exStyle)
+void wxTopLevelWindowMac::SetExtraStyle(long exStyle)
{
if ( GetExtraStyle() == exStyle )
return ;
-
+
wxTopLevelWindowBase::SetExtraStyle( exStyle ) ;
#if TARGET_API_MAC_OSX
#endif
}
-// we are still using coordinates of the content view; TODO: switch to structure bounds
-
+// TODO: switch to structure bounds -
+// we are still using coordinates of the content view
+//
void wxTopLevelWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )
{
- Rect content ;
- Rect structure ;
+ Rect content, structure ;
+
GetWindowBounds( (WindowRef) m_macWindow, kWindowStructureRgn , &structure ) ;
GetWindowBounds( (WindowRef) m_macWindow, kWindowContentRgn , &content ) ;