From c609b780c7cbf113ae147ba401a2373689f3bc77 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 3 Jun 2013 13:01:50 +0000 Subject: [PATCH 1/1] refactoring SizeEvent sending git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/toolbar.mm | 3 --- src/osx/cocoa/window.mm | 2 -- src/osx/nonownedwnd_osx.cpp | 16 +++------------- src/osx/toplevel_osx.cpp | 3 ++- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index 1a989ddd6c..ed713512c8 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -1244,9 +1244,6 @@ bool wxToolBar::Realize() SetInitialSize( wxSize(m_minWidth, m_minHeight)); SendSizeEventToParent(); - wxWindow * const parent = GetParent(); - if ( parent && !parent->IsBeingDeleted() ) - parent->MacOnInternalSize(); return true; } diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index c46dcd273f..acd1ced638 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -1745,7 +1745,6 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible ) wxUnusedVar(progress); m_win->SendSizeEvent(); - m_win->MacOnInternalSize(); } - (void)animationDidEnd:(NSAnimation*)animation @@ -1922,7 +1921,6 @@ wxWidgetCocoaImpl::ShowViewOrWindowWithEffect(wxWindow *win, // refresh it once again after the end to ensure that everything is in // place win->SendSizeEvent(); - win->MacOnInternalSize(); } [anim setDelegate:nil]; diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 10daf9d052..edcba5d9ce 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -249,10 +249,7 @@ bool wxNonOwnedWindow::OSXShowWithEffect(bool show, { // as apps expect a size event to occur when the window is shown, // generate one when it is shown with effect too - MacOnInternalSize(); - wxSizeEvent event(GetSize(), m_windowId); - event.SetEventObject(this); - HandleWindowEvent(event); + SendSizeEvent(); } return true; @@ -312,11 +309,7 @@ void wxNonOwnedWindow::HandleActivated( double timestampsec, bool didActivate ) void wxNonOwnedWindow::HandleResized( double timestampsec ) { - MacOnInternalSize(); - wxSizeEvent wxevent( GetSize() , GetId()); - wxevent.SetTimestamp( (int) (timestampsec * 1000) ); - wxevent.SetEventObject( this ); - HandleWindowEvent(wxevent); + SendSizeEvent(); // we have to inform some controls that have to reset things // relative to the toplevel window (e.g. OpenGL buffers) wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified @@ -387,10 +380,7 @@ bool wxNonOwnedWindow::Show(bool show) if ( show ) { // because apps expect a size event to occur at this moment - MacOnInternalSize(); - wxSizeEvent event(GetSize() , m_windowId); - event.SetEventObject(this); - HandleWindowEvent(event); + SendSizeEvent(); } return true ; diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index f92665932e..be18e7bc1a 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -187,7 +187,8 @@ void wxTopLevelWindowMac::ShowWithoutActivating() m_nowpeer->ShowWithoutActivating(); - // TODO: Should we call EVT_SIZE here? + // because apps expect a size event to occur at this moment + SendSizeEvent(); } bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) -- 2.45.2