X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bb78b682be2374a6910e4f8f53d0b2954353b95c..b9d880d6382e24156cdce4ae0390c843cc6208d9:/src/dfb/toplevel.cpp diff --git a/src/dfb/toplevel.cpp b/src/dfb/toplevel.cpp index b607ecc863..db6224a74b 100644 --- a/src/dfb/toplevel.cpp +++ b/src/dfb/toplevel.cpp @@ -214,7 +214,11 @@ void wxTopLevelWindowDFB::DoMoveWindow(int x, int y, int width, int height) wxSize cursize = GetSize(); if ( cursize.x != width || cursize.y != height ) { + // changing window's size changes its surface: + InvalidateDfbSurface(); + m_dfbwin->Resize(width, height); + // we must repaint the window after it changed size: if ( IsShown() ) DoRefreshWindow(); @@ -276,10 +280,21 @@ bool wxTopLevelWindowDFB::Show(bool show) GetEventHandler()->ProcessEvent(event); } - // FIXME_DFB: do this at all? - if ( show && AcceptsFocus() ) - SetFocus(); - // FIXME_DFB -- don't do this for popup windows? + if ( show ) + { + wxWindow *focused = wxWindow::FindFocus(); + if ( focused && focused->GetTLW() == this ) + { + SetDfbFocus(); + } + else if ( AcceptsFocus() ) + { + // FIXME: we should probably always call SetDfbFocus instead + // and call SetFocus() from wxActivateEvent/DWET_GOTFOCUS + // handler + SetFocus(); + } + } return true; } @@ -465,6 +480,15 @@ void wxTopLevelWindowDFB::Update() // events handling // --------------------------------------------------------------------------- +void wxTopLevelWindowDFB::SetDfbFocus() +{ + wxCHECK_RET( IsShown(), _T("cannot set focus to hidden window") ); + wxASSERT_MSG( FindFocus() && FindFocus()->GetTLW() == this, + _T("setting DirectFB focus to unexpected window") ); + + GetDirectFBWindow()->RequestFocus(); +} + /* static */ void wxTopLevelWindowDFB::HandleDFBWindowEvent(const wxDFBWindowEvent& event_) {