Fixing more mouse/keyboard issues. I'm having to eat the mouse move windows

sends me when a window gets the focus.  What a righteous hack.
This commit is contained in:
hyatt%netscape.com 1999-07-26 06:29:48 +00:00
parent cbf9fde516
commit cd355a2efd
2 changed files with 24 additions and 12 deletions

View File

@ -35,6 +35,8 @@
#define NS_MENU_POPUP_LIST_INDEX (NS_AREA_FRAME_ABSOLUTE_LIST_INDEX + 1)
static gEatMouseMove = PR_FALSE;
//
// NS_NewMenuFrame
//
@ -252,6 +254,11 @@ nsMenuFrame::HandleEvent(nsIPresContext& aPresContext,
}
}
else if (aEvent->message == NS_MOUSE_MOVE && mMenuParent) {
if (gEatMouseMove) {
gEatMouseMove = PR_FALSE;
return NS_OK;
}
// Let the menu parent know we're the new item.
mMenuParent->SetCurrentMenuItem(this);
@ -296,6 +303,8 @@ nsMenuFrame::SelectMenu(PRBool aActivateFlag)
void
nsMenuFrame::OpenMenu(PRBool aActivateFlag)
{
gEatMouseMove = PR_TRUE;
if (!mIsMenu)
return;

View File

@ -448,15 +448,22 @@ void
nsMenuPopupFrame::KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag)
{
// This method only gets called if we're open.
if (!mCurrentMenu) {
// We've been opened, but we haven't had anything selected.
// We can't handle LEFT or RIGHT, but our parent can.
if (aDirection == NS_VK_RIGHT || aDirection == NS_VK_LEFT)
return;
}
nsMenuFrame* menuFrame = (nsMenuFrame*)mCurrentMenu;
if (!mCurrentMenu && (aDirection == NS_VK_RIGHT || aDirection == NS_VK_LEFT)) {
// We've been opened, but we haven't had anything selected.
// We can handle RIGHT, but our parent handles LEFT.
if (aDirection == NS_VK_RIGHT) {
nsIFrame* nextItem;
GetNextMenuItem(nsnull, &nextItem);
if (nextItem) {
aHandledFlag = PR_TRUE;
SetCurrentMenuItem(nextItem);
}
}
return;
}
if (menuFrame) {
if (menuFrame->IsOpen()) {
// Give our child a shot.
@ -487,14 +494,10 @@ nsMenuPopupFrame::KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag)
aHandledFlag = PR_TRUE;
}
else if (mCurrentMenu && menuFrame->IsMenu() && menuFrame->IsOpen()) {
aHandledFlag = PR_TRUE;
if (aDirection == NS_VK_LEFT) {
// Close it up.
menuFrame->OpenMenu(PR_FALSE);
}
else if (aDirection == NS_VK_RIGHT) {
// Select the first item.
menuFrame->SelectFirstItem();
aHandledFlag = PR_TRUE;
}
}
}