Bug 387990 [a11y] mouse pointer position can prevent keyboard access to submenus

r+sr=roc a=roc


git-svn-id: svn://10.0.0.236/trunk@236196 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ginn.chen%sun.com 2007-09-18 05:48:16 +00:00
parent 90a78bfbee
commit 2abc58be9c
2 changed files with 28 additions and 0 deletions

View File

@ -227,6 +227,9 @@ static nsresult initialize_prefs (void);
nsWindow *nsWindow::mLastDragMotionWindow = NULL;
PRBool nsWindow::sIsDraggingOutOf = PR_FALSE;
// the last window that had a MOUSE_ENTER event
nsWindow *nsWindow::sLastMouseEnterWindow = nsnull;
// This is the time of the last button press event. The drag service
// uses it as the time to start drags.
guint32 nsWindow::mLastButtonPressTime = 0;
@ -419,6 +422,10 @@ nsWindow::Destroy(void)
if (mIsDestroyed || !mCreated)
return NS_OK;
if (this == sLastMouseEnterWindow) {
sLastMouseEnterWindow = nsnull;
}
LOG(("nsWindow::Destroy [%p]\n", (void *)this));
mIsDestroyed = PR_TRUE;
mCreated = PR_FALSE;
@ -1889,6 +1896,14 @@ nsWindow::OnEnterNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
if (aEvent->subwindow != NULL)
return;
// Do not fire MOUSE_ENTER event if the mouse pointer is not on it.
// In this case, enter_notify_event is not triggered by mouse.
if (aEvent->x < 0 || aEvent->y < 0 ||
aEvent->x >= mBounds.width || aEvent->y >= mBounds.height) {
return;
}
sLastMouseEnterWindow = this;
nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
event.refPoint.x = nscoord(aEvent->x);
@ -1909,6 +1924,16 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
if (aEvent->subwindow != NULL)
return;
// Do not fire MOUSE_EXIT event if the last MOUSE_ENTER event was not for
// the leaving window, or the mouse pointer is still on the leaving window.
// In this case, leave_notify_event is not triggered by mouse.
if (this != sLastMouseEnterWindow ||
(aEvent->x >= 0 && aEvent->y >= 0 &&
aEvent->x < mBounds.width && aEvent->y < mBounds.height)) {
return;
}
sLastMouseEnterWindow = nsnull;
nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
event.refPoint.x = nscoord(aEvent->x);

View File

@ -426,6 +426,9 @@ private:
// drag in progress
static PRBool DragInProgress(void);
// the last window that had a MOUSE_ENTER event
static nsWindow *sLastMouseEnterWindow;
void ResetDragMotionTimer (GtkWidget *aWidget,
GdkDragContext *aDragContext,
gint aX,