X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8803596043af5d782f7a7ee7221103844ecedf8a..49a91764b57168d9f441578001b3206a7330ee70:/src/mac/window.cpp diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 7252027515..62f65318ea 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -152,6 +152,20 @@ void wxWindow::Init() // Destructor wxWindow::~wxWindow() { + // deleting a window while it is shown invalidates the region + if ( IsShown() ) { + wxWindow* iter = this ; + while( iter ) { + if ( iter->m_macWindowData ) + { + Refresh() ; + break ; + } + iter = iter->GetParent() ; + + } + } + m_isBeingDeleted = TRUE; if ( s_lastMouseWindow == this ) @@ -282,6 +296,11 @@ void wxWindow::CaptureMouse() wxTheApp->s_captureWindow = this ; } +wxWindow* wxWindowBase::GetCapture() +{ + return wxTheApp->s_captureWindow ; +} + void wxWindow::ReleaseMouse() { wxTheApp->s_captureWindow = NULL ; @@ -629,7 +648,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) if ( focus.Ok() ) { Rect clientrect = { 0 , 0 , m_height , m_width } ; - ClipRect( &clientrect ) ; + // ClipRect( &clientrect ) ; InvalWindowRect( GetMacRootWindow() , &clientrect ) ; } } @@ -664,7 +683,7 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) if ( focus.Ok() ) { Rect clientrect = { 0 , 0 , m_height , m_width } ; - ClipRect( &clientrect ) ; + // ClipRect( &clientrect ) ; InvalWindowRect( GetMacRootWindow() , &clientrect ) ; } } @@ -675,16 +694,18 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) MacRepositionScrollBars() ; if ( doMove ) { - wxMoveEvent event(wxPoint(m_x, m_y), m_windowId); + wxPoint point(m_x, m_y); + wxMoveEvent event(point, m_windowId); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event) ; } if ( doResize ) { - MacRepositionScrollBars() ; - wxSizeEvent event(wxSize(m_width, m_height), m_windowId); - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); + MacRepositionScrollBars() ; + wxSize size(m_width, m_height); + wxSizeEvent event(size, m_windowId); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); } } } @@ -743,7 +764,8 @@ bool wxWindow::Show(bool show) UMASelectWindow( m_macWindowData->m_macWindow ) ; // no need to generate events here, they will get them triggered by macos // actually they should be , but apparently they are not - wxSizeEvent event(wxSize(m_width, m_height), m_windowId); + wxSize size(m_width, m_height); + wxSizeEvent event(size, m_windowId); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } @@ -754,11 +776,7 @@ bool wxWindow::Show(bool show) } MacSuperShown( show ) ; Refresh() ; - /* - // this will be done by the activate event - if(m_macWindowData) - MacUpdateImmediately() ; - */ + return TRUE; } @@ -899,11 +917,14 @@ void wxWindow::MacEraseBackground( Rect *rect ) void wxWindow::Refresh(bool eraseBack, const wxRect *rect) { +// if ( !IsShown() ) +// return ; + wxMacDrawingHelper focus( this ) ; if ( focus.Ok() ) { Rect clientrect = { 0 , 0 , m_height , m_width } ; - ClipRect( &clientrect ) ; + // ClipRect( &clientrect ) ; if ( rect ) { @@ -1143,6 +1164,7 @@ void wxWindow::MacCreateRealWindow( const wxString& title, UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; m_macWindowData->m_macFocus = NULL ; + m_macWindowData->m_macHasReceivedFirstActivate = true ; } void wxWindow::MacPaint( wxPaintEvent &event ) @@ -1501,13 +1523,19 @@ void wxWindow::OnIdle(wxIdleEvent& event) // Raise the window to the top of the Z order void wxWindow::Raise() { - // TODO + if ( m_macWindowData ) + { + UMABringToFront( m_macWindowData->m_macWindow ) ; + } } // Lower the window to the bottom of the Z order void wxWindow::Lower() { - // TODO + if ( m_macWindowData ) + { + UMASendBehind( m_macWindowData->m_macWindow , NULL ) ; + } } void wxWindow::DoSetClientSize(int width, int height) @@ -1694,8 +1722,12 @@ void wxWindow::MacFireMouseEvent( EventRecord *ev ) else event.SetEventType(wxEVT_LEFT_DCLICK ) ; } + lastWhen = 0 ; + } + else + { + lastWhen = ev->when ; } - lastWhen = ev->when ; lastWhere = localwhere ; } @@ -1768,15 +1800,18 @@ void wxWindow::MacMouseMoved( EventRecord *ev , short part) } void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating ) { + if ( !m_macWindowData->m_macHasReceivedFirstActivate ) + m_macWindowData->m_macHasReceivedFirstActivate = true ; + wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); event.m_timeStamp = ev->when ; event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); + Refresh(false) ; UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ; - Refresh() ; - MacUpdateImmediately() ; +// MacUpdateImmediately() ; } void wxWindow::MacRedraw( RgnHandle updatergn , long time) @@ -1851,7 +1886,7 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time) RGBBackColor( &m_backgroundColour.GetPixel()) ; } // subtract all non transparent children from updatergn - + RgnHandle childarea = NewRgn() ; for (wxNode *node = GetChildren().First(); node; node = node->Next()) { @@ -1859,7 +1894,7 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time) // eventually test for transparent windows if ( child->GetMacRootWindow() == window && child->IsShown() ) { - if ( !child->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)child)->GetMacControl() ) + if ( child->GetBackgroundColour() != m_backgroundColour && !child->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)child)->GetMacControl() ) { SetRectRgn( childarea , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ; DiffRgn( ownUpdateRgn , childarea , ownUpdateRgn ) ; @@ -1942,7 +1977,7 @@ void wxWindow::MacUpdateImmediately() GetPortVisibleRegion( GetWindowPort( window ), region ); // if windowshade gives incompatibility , take the follwing out - if ( !EmptyRgn( region ) ) + if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate ) { win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ; } @@ -1973,7 +2008,7 @@ void wxWindow::MacUpdate( EventRecord *ev ) GetPortVisibleRegion( GetWindowPort( window ), region ); // if windowshade gives incompatibility , take the follwing out - if ( !EmptyRgn( region ) ) + if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate ) { MacRedraw( region , ev->when ) ; }