зеркало из https://github.com/mozilla/gecko-dev.git
Dispatch crossing events. Remove superflous DispatchFocusEvent() methods.
NOT PART OF BUILD.
This commit is contained in:
Родитель
c00458de39
Коммит
b031e46c56
|
@ -352,12 +352,23 @@ nsAppShell::DispatchXEvent(XEvent *event)
|
|||
case KeyRelease:
|
||||
HandleKeyReleaseEvent(event, widget);
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
HandleFocusInEvent(event, widget);
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
HandleFocusOutEvent(event, widget);
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
HandleEnterEvent(event, widget);
|
||||
break;
|
||||
|
||||
case LeaveNotify:
|
||||
HandleLeaveEvent(event, widget);
|
||||
break;
|
||||
|
||||
case NoExpose:
|
||||
// these annoy me.
|
||||
break;
|
||||
|
@ -592,7 +603,7 @@ nsAppShell::HandleFocusInEvent(XEvent *event, nsWidget *aWidget)
|
|||
focusEvent.point.y = 0;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchFocusEvent(focusEvent);
|
||||
aWidget->DispatchWindowEvent(focusEvent);
|
||||
NS_RELEASE(aWidget);
|
||||
}
|
||||
|
||||
|
@ -613,7 +624,54 @@ nsAppShell::HandleFocusOutEvent(XEvent *event, nsWidget *aWidget)
|
|||
focusEvent.point.y = 0;
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
aWidget->DispatchFocusEvent(focusEvent);
|
||||
aWidget->DispatchWindowEvent(focusEvent);
|
||||
NS_RELEASE(aWidget);
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShell::HandleEnterEvent(XEvent *event, nsWidget *aWidget)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Enter event for window 0x%lx\n",
|
||||
event->xcrossing.window));
|
||||
nsMouseEvent enterEvent;
|
||||
|
||||
enterEvent.message = NS_MOUSE_ENTER;
|
||||
enterEvent.widget = aWidget;
|
||||
|
||||
enterEvent.eventStructType = NS_MOUSE_EVENT;
|
||||
|
||||
enterEvent.time = event->xcrossing.time;
|
||||
enterEvent.point.x = nscoord(event->xcrossing.x);
|
||||
enterEvent.point.y = nscoord(event->xcrossing.y);
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
|
||||
aWidget->DispatchWindowEvent(enterEvent);
|
||||
|
||||
NS_RELEASE(aWidget);
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShell::HandleLeaveEvent(XEvent *event, nsWidget *aWidget)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Leave event for window 0x%lx\n",
|
||||
event->xcrossing.window));
|
||||
|
||||
nsMouseEvent leaveEvent;
|
||||
|
||||
leaveEvent.message = NS_MOUSE_EXIT;
|
||||
leaveEvent.widget = aWidget;
|
||||
|
||||
leaveEvent.eventStructType = NS_MOUSE_EVENT;
|
||||
|
||||
leaveEvent.time = event->xcrossing.time;
|
||||
leaveEvent.point.x = nscoord(event->xcrossing.x);
|
||||
leaveEvent.point.y = nscoord(event->xcrossing.y);
|
||||
|
||||
NS_ADDREF(aWidget);
|
||||
|
||||
aWidget->DispatchWindowEvent(leaveEvent);
|
||||
|
||||
NS_RELEASE(aWidget);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ class nsAppShell : public nsIAppShell
|
|||
static void HandleVisibilityNotifyEvent(XEvent *event, nsWidget *aWidget);
|
||||
static void HandleMapNotifyEvent(XEvent *event, nsWidget *aWidget);
|
||||
static void HandleUnmapNotifyEvent(XEvent *event, nsWidget *aWidget);
|
||||
static void HandleEnterEvent(XEvent *event, nsWidget *aWidget);
|
||||
static void HandleLeaveEvent(XEvent *event, nsWidget *aWidget);
|
||||
|
||||
protected:
|
||||
nsIEventQueueService * mEventQueueService;
|
||||
|
|
|
@ -734,17 +734,6 @@ PRBool nsWidget::DispatchKeyEvent(nsKeyEvent & aKeyEvent)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsWidget::DispatchFocusEvent(nsGUIEvent & aEvent)
|
||||
{
|
||||
if (mEventCallback)
|
||||
{
|
||||
return DispatchWindowEvent(aEvent);
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Turning TRACE_EVENTS on will cause printfs for all
|
||||
|
|
|
@ -109,17 +109,16 @@ public:
|
|||
virtual PRBool OnResize(nsSizeEvent &event);
|
||||
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
|
||||
virtual PRBool DispatchKeyEvent(nsKeyEvent &aKeyEvent);
|
||||
virtual PRBool DispatchFocusEvent(nsGUIEvent &aEvent);
|
||||
|
||||
|
||||
static nsWidget * GetWidgetForWindow(Window aWindow);
|
||||
void SetVisibility(int aState); // using the X constants here
|
||||
void SetMapStatus(PRBool aState);
|
||||
|
||||
PRBool DispatchWindowEvent(nsGUIEvent & aEvent);
|
||||
|
||||
protected:
|
||||
|
||||
// private event functions
|
||||
PRBool DispatchWindowEvent(nsGUIEvent & aEvent);
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
|
||||
// create the native window for this class
|
||||
|
|
|
@ -82,10 +82,12 @@ nsWindow::GetEventMask()
|
|||
ButtonMotionMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
EnterWindowMask |
|
||||
ExposureMask |
|
||||
FocusChangeMask |
|
||||
KeyPressMask |
|
||||
KeyReleaseMask |
|
||||
LeaveWindowMask |
|
||||
PointerMotionMask |
|
||||
StructureNotifyMask |
|
||||
VisibilityChangeMask;
|
||||
|
|
Загрузка…
Ссылка в новой задаче