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();
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;
}
void wxTopLevelWindowDFB::DoRefreshRect(const wxRect& rect)
{
- wxASSERT_MSG( rect.width > 0 && rect.height > 0, _T("invalid rect") );
+ // don't overlap outside of the window (NB: 'rect' is in window coords):
+ wxRect r(rect);
+ r.Intersect(wxRect(GetSize()));
+ if ( r.IsEmpty() )
+ return;
wxLogTrace(TRACE_PAINT,
_T("%p ('%s'): [TLW] refresh rect [%i,%i,%i,%i]"),
// 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_)
{