diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 4a95418df5..c2a5623317 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -970,6 +970,9 @@ BView::KeyDown(const char* bytes, int32 numBytes) { // HOOK function STRACE(("\tHOOK: BView(%s)::KeyDown()\n", Name())); + if (numBytes > 0 && bytes[0] == B_TAB) { + // TODO: handle tab navigation here instead of in BWindow + } } @@ -1243,13 +1246,16 @@ BView::MakeFocus(bool focusState) // TODO: If this view has focus and focusState==false, // will there really be no other view with focus? No // cycling to the next one? + BView *focus = owner->CurrentFocus(); if (focusState) { + // Unfocus a previous focus view + if (focus && focus != this) + focus->MakeFocus(false); // if we want to make this view the current focus view owner->fFocus = this; owner->SetPreferredHandler(this); } else { // we want to unfocus this view, but only if it actually has focus - BView *focus = owner->CurrentFocus(); if (focus == this) { owner->fFocus = NULL; owner->SetPreferredHandler(NULL); @@ -3326,6 +3332,10 @@ BView::MoveTo(float x, float y) originX = x; originY = y; +// TODO: investigate R5 behaviour for unattached views +// maybe the message is generated, but postponed until the view is added +if (!owner && fFlags & B_FRAME_EVENTS) + FrameMoved(BPoint(originX, originY)); } @@ -3364,6 +3374,11 @@ BView::ResizeTo(float width, float height) fBounds.right = fBounds.left + width; fBounds.bottom = fBounds.top + height; + +// TODO: investigate R5 behaviour for unattached views +// maybe the message is generated, but postponed until the view is added +if (!owner && fFlags & B_FRAME_EVENTS) + FrameResized(width, height); } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 291c2fabc0..5ed1d76f8b 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -919,6 +919,8 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target) } case B_VIEW_MOVED: { + // NOTE: This message only arrives if the + // view has flags B_FRAME_EVENTS BPoint where; int32 token = B_NULL_TOKEN; BView *view; @@ -931,7 +933,6 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target) if (view) { STRACE(("Calling BView(%s)::FrameMoved( %f, %f )\n", view->Name(), where.x, where.y)); - // TODO: only if B_FRAME_EVENTS, no? view->FrameMoved( where ); } else @@ -941,6 +942,8 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target) } case B_VIEW_RESIZED: { + // NOTE: This message only arrives if the + // view has flags B_FRAME_EVENTS float newWidth, newHeight; BPoint where; @@ -956,7 +959,6 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target) view = findView(top_view, token); if (view){ STRACE(("Calling BView(%s)::FrameResized( %f, %f )\n", view->Name(), newWidth, newHeight)); - // TODO: only if B_FRAME_EVENTS, no? view->FrameResized( newWidth, newHeight ); } else @@ -2580,24 +2582,14 @@ void BWindow::setFocus(BView *focusView, bool notifyInputServer) if (previousFocus == focusView) return; - fFocus = NULL; - - if (previousFocus != NULL) - previousFocus->Invalidate(); - - fFocus = focusView; - - if (focusView != NULL) - focusView->Invalidate(); + if (focusView) + focusView->MakeFocus(true); // TODO: find out why do we have to notify input server. if (notifyInputServer) { // what am I suppose to do here?? } - - // TODO: find out why R5 does this - SetPreferredHandler(fFocus); } //------------------------------------------------------------------------------ @@ -2706,6 +2698,7 @@ bool BWindow::handleKeyDown( const char key, uint32 modifiers){ } // Keyboard navigation through views!!!! + // TODO: Not correct, only Option-Tab should be handled here. if ( key == B_TAB) { BView *nextFocus;