зеркало из https://github.com/mozilla/pjs.git
propagate state of event modifier keys to menu command handlers. bug 126189 r=bryner,jag
This commit is contained in:
Родитель
87fdb5011b
Коммит
3bd6dfd2a3
|
@ -458,7 +458,7 @@ nsMenuFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
mMenuParent->GetIsContextMenu(isContextMenu);
|
mMenuParent->GetIsContextMenu(isContextMenu);
|
||||||
if ( isContextMenu ) {
|
if ( isContextMenu ) {
|
||||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
Execute();
|
Execute(aEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP && !IsMenu() && mMenuParent && !IsDisabled()) {
|
else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP && !IsMenu() && mMenuParent && !IsDisabled()) {
|
||||||
|
@ -479,7 +479,7 @@ nsMenuFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the execute event handler.
|
// Execute the execute event handler.
|
||||||
Execute();
|
Execute(aEvent);
|
||||||
}
|
}
|
||||||
else if (aEvent->message == NS_MOUSE_EXIT_SYNTH) {
|
else if (aEvent->message == NS_MOUSE_EXIT_SYNTH) {
|
||||||
// Kill our timer if one is active.
|
// Kill our timer if one is active.
|
||||||
|
@ -1281,7 +1281,7 @@ nsMenuFrame::Enter()
|
||||||
if (!mMenuOpen) {
|
if (!mMenuOpen) {
|
||||||
// The enter key press applies to us.
|
// The enter key press applies to us.
|
||||||
if (!IsMenu() && mMenuParent)
|
if (!IsMenu() && mMenuParent)
|
||||||
Execute(); // Execute our event handler
|
Execute(0); // Execute our event handler
|
||||||
else {
|
else {
|
||||||
OpenMenu(PR_TRUE);
|
OpenMenu(PR_TRUE);
|
||||||
SelectFirstItem();
|
SelectFirstItem();
|
||||||
|
@ -1625,7 +1625,7 @@ nsMenuFrame::BuildAcceleratorText()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsMenuFrame::Execute()
|
nsMenuFrame::Execute(nsGUIEvent *aEvent)
|
||||||
{
|
{
|
||||||
// Temporarily disable rollup events on this menu. This is
|
// Temporarily disable rollup events on this menu. This is
|
||||||
// to suppress this menu getting removed in the case where
|
// to suppress this menu getting removed in the case where
|
||||||
|
@ -1648,10 +1648,20 @@ nsMenuFrame::Execute()
|
||||||
nsMouseEvent event;
|
nsMouseEvent event;
|
||||||
event.eventStructType = NS_EVENT;
|
event.eventStructType = NS_EVENT;
|
||||||
event.message = NS_XUL_COMMAND;
|
event.message = NS_XUL_COMMAND;
|
||||||
event.isShift = PR_FALSE;
|
if (aEvent && (aEvent->eventStructType == NS_MOUSE_EVENT ||
|
||||||
event.isControl = PR_FALSE;
|
aEvent->eventStructType == NS_KEY_EVENT ||
|
||||||
event.isAlt = PR_FALSE;
|
aEvent->eventStructType == NS_ACCESSIBLE_EVENT)) {
|
||||||
event.isMeta = PR_FALSE;
|
|
||||||
|
event.isShift = NS_STATIC_CAST(nsInputEvent *, aEvent)->isShift;
|
||||||
|
event.isControl = NS_STATIC_CAST(nsInputEvent *, aEvent)->isControl;
|
||||||
|
event.isAlt = NS_STATIC_CAST(nsInputEvent *, aEvent)->isAlt;
|
||||||
|
event.isMeta = NS_STATIC_CAST(nsInputEvent *, aEvent)->isMeta;
|
||||||
|
} else {
|
||||||
|
event.isShift = PR_FALSE;
|
||||||
|
event.isControl = PR_FALSE;
|
||||||
|
event.isAlt = PR_FALSE;
|
||||||
|
event.isMeta = PR_FALSE;
|
||||||
|
}
|
||||||
event.clickCount = 0;
|
event.clickCount = 0;
|
||||||
event.widget = nsnull;
|
event.widget = nsnull;
|
||||||
// The order of the nsIViewManager and nsIPresShell COM pointers is
|
// The order of the nsIViewManager and nsIPresShell COM pointers is
|
||||||
|
|
|
@ -210,7 +210,7 @@ protected:
|
||||||
void BuildAcceleratorText();
|
void BuildAcceleratorText();
|
||||||
|
|
||||||
// Called to execute our command handler.
|
// Called to execute our command handler.
|
||||||
void Execute();
|
void Execute(nsGUIEvent *aEvent);
|
||||||
|
|
||||||
// Called as a hook just before the menu gets opened.
|
// Called as a hook just before the menu gets opened.
|
||||||
PRBool OnCreate();
|
PRBool OnCreate();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче