X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/467e3168b33200bf6d62317294799363ed7dd50e..2ac013b1a5d8210ab0c53f7eb9687399b9312162:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 8e269242e8..0ef67a8a20 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -169,6 +169,13 @@ wxWindowMac::~wxWindowMac() { s_lastMouseWindow = NULL ; } + + wxFrame* frame = wxDynamicCast( wxGetTopLevelParent( this ) , wxFrame ) ; + if ( frame ) + { + if ( frame->GetLastFocus() == this ) + frame->SetLastFocus( NULL ) ; + } if ( gFocusWindow == this ) { @@ -346,7 +353,17 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) ::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ; long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ; - menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ; + if ( HiWord(menuResult) != 0 ) + { + MenuCommand id ; + GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ; + + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id ); + event.m_timeStamp = TickCount() ; + event.SetEventObject(this->GetEventHandler()); + event.SetInt( id ); + GetEventHandler()->ProcessEvent(event); + } ::DeleteMenu( menu->MacGetMenuId() ) ; menu->SetInvokingWindow(NULL); @@ -374,9 +391,9 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const MacRootWindowToWindow( x , y ) ; if ( x ) - x -= MacGetLeftBorderSize() ; + *x -= MacGetLeftBorderSize() ; if ( y ) - y -= MacGetTopBorderSize() ; + *y -= MacGetTopBorderSize() ; } void wxWindowMac::DoClientToScreen(int *x, int *y) const @@ -384,9 +401,9 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const WindowRef window = (WindowRef) MacGetRootWindow() ; if ( x ) - x += MacGetLeftBorderSize() ; + *x += MacGetLeftBorderSize() ; if ( y ) - y += MacGetTopBorderSize() ; + *y += MacGetTopBorderSize() ; MacWindowToRootWindow( x , y ) ; @@ -588,7 +605,35 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) { // erase former position - Refresh() ; + bool partialRepaint = false ; + + if ( HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) ) + { + wxPoint oldPos( m_x , m_y ) ; + wxPoint newPos( actualX , actualY ) ; + MacWindowToRootWindow( &oldPos.x , &oldPos.y ) ; + MacWindowToRootWindow( &newPos.x , &newPos.y ) ; + if ( oldPos == newPos ) + { + partialRepaint = true ; + RgnHandle oldRgn,newRgn,diffRgn ; + oldRgn = NewRgn() ; + newRgn = NewRgn() ; + diffRgn = NewRgn() ; + SetRectRgn(oldRgn , oldPos.x , oldPos.y , oldPos.x + m_width , oldPos.y + m_height ) ; + SetRectRgn(newRgn , newPos.x , newPos.y , newPos.x + actualWidth , newPos.y + actualHeight ) ; + DiffRgn( newRgn , oldRgn , diffRgn ) ; + InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ; + DiffRgn( oldRgn , newRgn , diffRgn ) ; + InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ; + DisposeRgn(oldRgn) ; + DisposeRgn(newRgn) ; + DisposeRgn(diffRgn) ; + } + } + + if ( !partialRepaint ) + Refresh() ; m_x = actualX ; m_y = actualY ; @@ -600,7 +645,8 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) MacUpdateDimensions() ; // erase new position - Refresh() ; + if ( !partialRepaint ) + Refresh() ; if ( doMove ) wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified