X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/98e04c1376e251d11804371233a52cccbcf34cc0..63c6e6c80637791d4a290811108157a51c13f72d:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 2407ac63e4..e4405c5492 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -87,8 +87,6 @@ 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 } , @@ -112,62 +110,6 @@ static const EventTypeSpec eventList[] = { 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 ; @@ -866,10 +808,6 @@ pascal OSStatus wxMacTopLevelEventHandler( EventHandlerCallRef handler , EventRe result = KeyboardEventHandler( handler, event , data ) ; break ; - case kEventClassTextInput : - result = TextInputEventHandler( handler, event , data ) ; - break ; - case kEventClassWindow : result = wxMacTopLevelWindowEventHandler( handler, event , data ) ; break ; @@ -938,6 +876,7 @@ typedef struct { wxPoint m_position ; wxSize m_size ; + bool m_wasResizable ; } FullScreenData ; @@ -1357,22 +1296,21 @@ bool wxTopLevelWindowMac::Show(bool show) 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 ) ; @@ -1383,19 +1321,10 @@ bool wxTopLevelWindowMac::Show(bool show) } 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() ; @@ -1414,6 +1343,7 @@ bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) m_macFullScreenData = data ; data->m_position = GetPosition() ; data->m_size = GetSize() ; + data->m_wasResizable = MacGetWindowAttributes() & kWindowResizableAttribute ; if ( style & wxFULLSCREEN_NOMENUBAR ) HideMenuBar() ; @@ -1454,11 +1384,15 @@ bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) } 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 ) ; @@ -1491,12 +1425,13 @@ void wxTopLevelWindowMac::SetExtraStyle(long exStyle) #endif } -// we are still using coordinates of the content view; TODO: switch to structure bounds - +// we are still using coordinates of the content view +// TODO: switch to structure bounds +// 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 ) ;