Keyboard messages are dispached to BWindow's handler if no focus view

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10931 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-01-21 17:58:09 +00:00
parent 984c3a2ec3
commit 6e8a11dda4

View File

@ -795,8 +795,12 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target)
// TODO: it is NOT "bytes" field you should pass to KeyDown(), it is "byte" field. // TODO: it is NOT "bytes" field you should pass to KeyDown(), it is "byte" field.
if ( !handleKeyDown( raw_char, (uint32)modifiers) ) if ( !handleKeyDown( raw_char, (uint32)modifiers) )
if(fFocus && string) {
if(fFocus)
fFocus->KeyDown( string, strlen(string)-1 ); fFocus->KeyDown( string, strlen(string)-1 );
else
BLooper::DispatchMessage(msg, target);
}
break; break;
} }
case B_KEY_UP: case B_KEY_UP:
@ -804,33 +808,43 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target)
const char *string=NULL; const char *string=NULL;
msg->FindString( "bytes", &string ); msg->FindString( "bytes", &string );
if(fFocus && string) if(fFocus)
fFocus->KeyUp( string, strlen(string)-1 ); fFocus->KeyUp( string, strlen(string)-1 );
else
BLooper::DispatchMessage(msg, target);
break; break;
} }
case B_UNMAPPED_KEY_DOWN: case B_UNMAPPED_KEY_DOWN:
{ {
if (fFocus) if (fFocus)
fFocus->MessageReceived( msg ); fFocus->MessageReceived( msg );
else
BLooper::DispatchMessage(msg, target);
break; break;
} }
case B_UNMAPPED_KEY_UP: case B_UNMAPPED_KEY_UP:
{ {
if (fFocus) if (fFocus)
fFocus->MessageReceived( msg ); fFocus->MessageReceived( msg );
else
BLooper::DispatchMessage(msg, target);
break; break;
} }
case B_MODIFIERS_CHANGED: case B_MODIFIERS_CHANGED:
{ {
if (fFocus) if (fFocus)
fFocus->MessageReceived( msg ); fFocus->MessageReceived( msg );
else
BLooper::DispatchMessage(msg, target);
break; break;
} }
case B_MOUSE_WHEEL_CHANGED: case B_MOUSE_WHEEL_CHANGED:
{ {
BView *wheelView=LastMouseMovedView(); if (fFocus)
if(wheelView) fFocus->MessageReceived( msg );
wheelView->MessageReceived( msg ); else
BLooper::DispatchMessage(msg, target);
break; break;
} }
case B_MOUSE_DOWN: case B_MOUSE_DOWN: