Bug 630811 part.2 Replace nsInputEvent::isShift, nsInputEvent::isControl, nsInputEvent::isAlt and nsInputEvent::isMeta r=smaug

This commit is contained in:
Masayuki Nakano 2012-04-25 12:00:02 +09:00
parent e93419bd4b
commit e089b336f8
29 changed files with 169 additions and 271 deletions

View File

@ -4642,7 +4642,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
}
PRUint32 len = nativeKeyEvent->alternativeCharCodes.Length();
if (!nativeKeyEvent->isShift) {
if (!nativeKeyEvent->IsShift()) {
for (PRUint32 i = 0; i < len; ++i) {
PRUint32 ch =
nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode;

View File

@ -3944,10 +3944,7 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
event.pressure = pressure;
event.clickCount = clickCount;
event.inputSource = inputSource;
event.isShift = aSourceEvent->isShift;
event.isControl = aSourceEvent->isControl;
event.isAlt = aSourceEvent->isAlt;
event.isMeta = aSourceEvent->isMeta;
event.modifiers = aSourceEvent->modifiers;
event.flags |= aFlags; // Be careful not to overwrite existing flags!
return DispatchEvent(aPresContext, &event, aTarget, aFullDispatch, aStatus);
@ -5988,8 +5985,8 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_CLICK:
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
if (inputEvent->isControl || inputEvent->isMeta ||
inputEvent->isAlt ||inputEvent->isShift) {
if (inputEvent->IsControl() || inputEvent->IsMeta() ||
inputEvent->IsAlt() ||inputEvent->IsShift()) {
break;
}

View File

@ -357,13 +357,13 @@ GetBasePrefKeyForMouseWheel(nsMouseScrollEvent* aEvent, nsACString& aPref)
if (aEvent->scrollFlags & nsMouseScrollEvent::kIsHorizontal) {
aPref.Append(horizscroll);
}
if (aEvent->isShift) {
if (aEvent->IsShift()) {
aPref.Append(withshift);
} else if (aEvent->isControl) {
} else if (aEvent->IsControl()) {
aPref.Append(withcontrol);
} else if (aEvent->isAlt) {
} else if (aEvent->IsAlt()) {
aPref.Append(withalt);
} else if (aEvent->isMeta) {
} else if (aEvent->IsMeta()) {
aPref.Append(withmetakey);
} else {
aPref.Append(withno);
@ -1198,13 +1198,13 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
PRInt32 modifierMask = 0;
if (keyEvent->isShift)
if (keyEvent->IsShift())
modifierMask |= NS_MODIFIER_SHIFT;
if (keyEvent->isControl)
if (keyEvent->IsControl())
modifierMask |= NS_MODIFIER_CONTROL;
if (keyEvent->isAlt)
if (keyEvent->IsAlt())
modifierMask |= NS_MODIFIER_ALT;
if (keyEvent->isMeta)
if (keyEvent->IsMeta())
modifierMask |= NS_MODIFIER_META;
// Prevent keyboard scrolling while an accesskey modifier is in use.
@ -2004,10 +2004,6 @@ nsEventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
getter_AddRefs(mGestureDownContent));
mGestureDownFrameOwner = inDownFrame->GetContent();
mGestureDownShift = inDownEvent->isShift;
mGestureDownControl = inDownEvent->isControl;
mGestureDownAlt = inDownEvent->isAlt;
mGestureDownMeta = inDownEvent->isMeta;
mGestureModifiers = inDownEvent->modifiers;
mGestureDownButtons = inDownEvent->buttons;
@ -2042,10 +2038,6 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
// different
nsIntPoint tmpPoint = aEvent->widget->WidgetToScreenOffset();
aEvent->refPoint = mGestureDownPoint - tmpPoint;
aEvent->isShift = mGestureDownShift;
aEvent->isControl = mGestureDownControl;
aEvent->isAlt = mGestureDownAlt;
aEvent->isMeta = mGestureDownMeta;
aEvent->modifiers = mGestureModifiers;
aEvent->buttons = mGestureDownButtons;
}
@ -2218,8 +2210,9 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
// occurred, and aSelectionTarget is the node to use when a selection is used
bool canDrag;
nsCOMPtr<nsIContent> dragDataNode;
bool wasAlt = (mGestureModifiers & widget::MODIFIER_ALT) != 0;
nsresult rv = nsContentAreaDragDrop::GetDragData(window, mGestureDownContent,
aSelectionTarget, mGestureDownAlt,
aSelectionTarget, wasAlt,
aDataTransfer, &canDrag, aSelection,
getter_AddRefs(dragDataNode));
if (NS_FAILED(rv) || !canDrag)
@ -2577,10 +2570,6 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.scrollFlags = aEvent->scrollFlags;
@ -2614,10 +2603,6 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.scrollFlags = aEvent->scrollFlags;
@ -3415,10 +3400,6 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.isShift = mouseEvent->isShift;
event.isControl = mouseEvent->isControl;
event.isAlt = mouseEvent->isAlt;
event.isMeta = mouseEvent->isMeta;
event.modifiers = mouseEvent->modifiers;
event.buttons = mouseEvent->buttons;
event.inputSource = mouseEvent->inputSource;
@ -3447,7 +3428,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
//This is to prevent keyboard scrolling while alt modifier in use.
if (!keyEvent->isAlt) {
if (!keyEvent->IsAlt()) {
switch(keyEvent->keyCode) {
case NS_VK_TAB:
case NS_VK_F6:
@ -3455,10 +3436,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && mDocument) {
// Shift focus forward or back depending on shift key
bool isDocMove = ((nsInputEvent*)aEvent)->isControl ||
bool isDocMove = ((nsInputEvent*)aEvent)->IsControl() ||
(keyEvent->keyCode == NS_VK_F6);
PRUint32 dir =
static_cast<nsInputEvent*>(aEvent)->isShift ?
static_cast<nsInputEvent*>(aEvent)->IsShift() ?
(isDocMove ? static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_BACKWARDDOC) :
static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_BACKWARD)) :
(isDocMove ? static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_FORWARDDOC) :
@ -3842,10 +3823,6 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget,
nsMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
event.buttons = ((nsMouseEvent*)aEvent)->buttons;
event.pluginEvent = ((nsMouseEvent*)aEvent)->pluginEvent;
@ -4257,10 +4234,6 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
nsEventStatus status = nsEventStatus_eIgnore;
nsDragEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMsg, aEvent->widget);
event.refPoint = aEvent->refPoint;
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
event.buttons = ((nsMouseEvent*)aEvent)->buttons;
event.relatedTarget = aRelatedTarget;
@ -4421,10 +4394,6 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
nsMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.clickCount = aEvent->clickCount;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.time = aEvent->time;
@ -4444,10 +4413,6 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
aEvent->widget, nsMouseEvent::eReal);
event2.refPoint = aEvent->refPoint;
event2.clickCount = aEvent->clickCount;
event2.isShift = aEvent->isShift;
event2.isControl = aEvent->isControl;
event2.isAlt = aEvent->isAlt;
event2.isMeta = aEvent->isMeta;
event2.modifiers = aEvent->modifiers;
event2.buttons = aEvent->buttons;
event2.flags |= flags;
@ -5048,10 +5013,6 @@ nsEventStateManager::DoQueryScrollTargetInfo(nsQueryContentEvent* aEvent,
aEvent->mInput.mMouseScrollEvent->message,
aEvent->mInput.mMouseScrollEvent->widget);
msEvent.isShift = aEvent->mInput.mMouseScrollEvent->isShift;
msEvent.isControl = aEvent->mInput.mMouseScrollEvent->isControl;
msEvent.isAlt = aEvent->mInput.mMouseScrollEvent->isAlt;
msEvent.isMeta = aEvent->mInput.mMouseScrollEvent->isMeta;
msEvent.modifiers = aEvent->mInput.mMouseScrollEvent->modifiers;
msEvent.buttons = aEvent->mInput.mMouseScrollEvent->buttons;

View File

@ -506,10 +506,6 @@ private:
// an <area> of an image map this is the image. (bug 289667)
nsCOMPtr<nsIContent> mGestureDownFrameOwner;
// State of keys when the original gesture-down happened
bool mGestureDownShift;
bool mGestureDownControl;
bool mGestureDownAlt;
bool mGestureDownMeta;
mozilla::widget::Modifiers mGestureModifiers;
PRUint16 mGestureDownButtons;

View File

@ -2136,8 +2136,8 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
} // switch
}
if (aVisitor.mEvent->message == NS_KEY_PRESS &&
mType == NS_FORM_INPUT_RADIO && !keyEvent->isAlt &&
!keyEvent->isControl && !keyEvent->isMeta) {
mType == NS_FORM_INPUT_RADIO && !keyEvent->IsAlt() &&
!keyEvent->IsControl() && !keyEvent->IsMeta()) {
bool isMovingBack = false;
switch (keyEvent->keyCode) {
case NS_VK_UP:

View File

@ -228,8 +228,8 @@ nsHTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
// have a kbd modifier (which adjusts a selection), or if it's a
// double click (we already forwarded the first click event).
if (dragSelect || event->clickCount > 1 ||
event->isShift || event->isControl || event->isAlt ||
event->isMeta) {
event->IsShift() || event->IsControl() || event->IsAlt() ||
event->IsMeta()) {
break;
}

View File

@ -1666,10 +1666,10 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
NS_IS_TRUSTED_EVENT(aVisitor.mEvent),
aVisitor.mDOMEvent,
nsnull,
orig->isControl,
orig->isAlt,
orig->isShift,
orig->isMeta);
orig->IsControl(),
orig->IsAlt(),
orig->IsShift(),
orig->IsMeta());
} else {
NS_WARNING("A XUL element is attached to a command that doesn't exist!\n");
}

View File

@ -2123,10 +2123,10 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
static unsigned int XInputEventState(const nsInputEvent& anEvent)
{
unsigned int state = 0;
if (anEvent.isShift) state |= ShiftMask;
if (anEvent.isControl) state |= ControlMask;
if (anEvent.isAlt) state |= Mod1Mask;
if (anEvent.isMeta) state |= Mod4Mask;
if (anEvent.IsShift()) state |= ShiftMask;
if (anEvent.IsControl()) state |= ControlMask;
if (anEvent.IsAlt()) state |= Mod1Mask;
if (anEvent.IsMeta()) state |= Mod4Mask;
return state;
}
#endif

View File

@ -2558,13 +2558,13 @@ PluginInstanceChild::AnswerHandleKeyEvent(const nsKeyEvent& aKeyEvent,
AssertPluginThread();
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
Qt::KeyboardModifiers modifier;
if (aKeyEvent.isShift)
if (aKeyEvent.IsShift())
modifier |= Qt::ShiftModifier;
if (aKeyEvent.isControl)
if (aKeyEvent.IsControl())
modifier |= Qt::ControlModifier;
if (aKeyEvent.isAlt)
if (aKeyEvent.IsAlt())
modifier |= Qt::AltModifier;
if (aKeyEvent.isMeta)
if (aKeyEvent.IsMeta())
modifier |= Qt::MetaModifier;
QEvent::Type type;

View File

@ -5078,8 +5078,8 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
aKeyEvent->PreventDefault(); // consumed
return NS_OK;
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
if (nativeKeyEvent->isControl || nativeKeyEvent->isAlt ||
nativeKeyEvent->isMeta) {
if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() ||
nativeKeyEvent->IsMeta()) {
return NS_OK;
}
DeleteSelection(nsIEditor::ePrevious);
@ -5089,8 +5089,8 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
// on certain platforms (such as windows) the shift key
// modifies what delete does (cmd_cut in this case).
// bailing here to allow the keybindings to do the cut.
if (nativeKeyEvent->isShift || nativeKeyEvent->isControl ||
nativeKeyEvent->isAlt || nativeKeyEvent->isMeta) {
if (nativeKeyEvent->IsShift() || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta()) {
return NS_OK;
}
DeleteSelection(nsIEditor::eNext);

View File

@ -646,8 +646,8 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return NS_OK; // let it be used for focus switching
}
if (nativeKeyEvent->isControl || nativeKeyEvent->isAlt ||
nativeKeyEvent->isMeta) {
if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() ||
nativeKeyEvent->IsMeta()) {
return NS_OK;
}
@ -674,12 +674,12 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
bool handled = false;
if (nsHTMLEditUtils::IsTableElement(blockParent)) {
rv = TabInTable(nativeKeyEvent->isShift, &handled);
rv = TabInTable(nativeKeyEvent->IsShift(), &handled);
if (handled) {
ScrollSelectionIntoView(false);
}
} else if (nsHTMLEditUtils::IsListItem(blockParent)) {
rv = Indent(nativeKeyEvent->isShift ?
rv = Indent(nativeKeyEvent->IsShift() ?
NS_LITERAL_STRING("outdent") :
NS_LITERAL_STRING("indent"));
handled = true;
@ -688,7 +688,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
if (handled) {
return aKeyEvent->PreventDefault(); // consumed
}
if (nativeKeyEvent->isShift) {
if (nativeKeyEvent->IsShift()) {
return NS_OK; // don't type text for shift tabs
}
aKeyEvent->PreventDefault();
@ -696,12 +696,12 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
}
case nsIDOMKeyEvent::DOM_VK_RETURN:
case nsIDOMKeyEvent::DOM_VK_ENTER:
if (nativeKeyEvent->isControl || nativeKeyEvent->isAlt ||
nativeKeyEvent->isMeta) {
if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() ||
nativeKeyEvent->IsMeta()) {
return NS_OK;
}
aKeyEvent->PreventDefault(); // consumed
if (nativeKeyEvent->isShift && !IsPlaintextEditor()) {
if (nativeKeyEvent->IsShift() && !IsPlaintextEditor()) {
// only inserts a br node
return TypedText(EmptyString(), eTypedBR);
}
@ -711,8 +711,8 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
// NOTE: On some keyboard layout, some characters are inputted with Control
// key or Alt key, but at that time, widget sets FALSE to these keys.
if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->isControl ||
nativeKeyEvent->isAlt || nativeKeyEvent->isMeta) {
if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta()) {
// we don't PreventDefault() here or keybindings like control-x won't work
return NS_OK;
}

View File

@ -390,8 +390,8 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return NS_OK; // let it be used for focus switching
}
if (nativeKeyEvent->isShift || nativeKeyEvent->isControl ||
nativeKeyEvent->isAlt || nativeKeyEvent->isMeta) {
if (nativeKeyEvent->IsShift() || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta()) {
return NS_OK;
}
@ -401,8 +401,8 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
}
case nsIDOMKeyEvent::DOM_VK_RETURN:
case nsIDOMKeyEvent::DOM_VK_ENTER:
if (IsSingleLineEditor() || nativeKeyEvent->isControl ||
nativeKeyEvent->isAlt || nativeKeyEvent->isMeta) {
if (IsSingleLineEditor() || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta()) {
return NS_OK;
}
aKeyEvent->PreventDefault();
@ -411,8 +411,8 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
// NOTE: On some keyboard layout, some characters are inputted with Control
// key or Alt key, but at that time, widget sets FALSE to these keys.
if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->isControl ||
nativeKeyEvent->isAlt || nativeKeyEvent->isMeta) {
if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta()) {
// we don't PreventDefault() here or keybindings like control-x won't work
return NS_OK;
}

View File

@ -5321,7 +5321,7 @@ PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll)
nsMouseEvent::eSynthesized);
event.refPoint = refpoint.ToNearestPixels(viewAPD);
event.time = PR_IntervalNow();
// XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
// XXX set event.modifiers ?
// XXX mnakano I think that we should get the latest information from widget.
nsCOMPtr<nsIPresShell> shell = pointVM->GetPresShell();
@ -5713,10 +5713,6 @@ EvictTouchPoint(nsCOMPtr<nsIDOMTouch>& aTouch)
return;
}
nsTouchEvent event(true, NS_TOUCH_END, widget);
event.isShift = false;
event.isControl = false;
event.isAlt = false;
event.isMeta = false;
event.widget = widget;
event.time = PR_IntervalNow();
event.touches.AppendElement(aTouch);
@ -6544,7 +6540,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
!AdjustContextMenuKeyEvent(me)) {
return NS_OK;
}
if (me->isShift)
if (me->IsShift())
aEvent->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH |
NS_EVENT_RETARGET_TO_NON_NATIVE_ANONYMOUS;
}

View File

@ -700,10 +700,7 @@ protected:
{
mEvent->time = aEvent->time;
mEvent->refPoint = aEvent->refPoint;
mEvent->isShift = aEvent->isShift;
mEvent->isControl = aEvent->isControl;
mEvent->isAlt = aEvent->isAlt;
mEvent->isMeta = aEvent->isMeta;
mEvent->modifiers = aEvent->modifiers;
}
nsDelayedInputEvent()

View File

@ -2281,16 +2281,16 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
(aMouseEvent->message == NS_MOUSE_MOVE ||
(aMouseEvent->message == NS_MOUSE_BUTTON_UP &&
aMouseEvent->button == nsMouseEvent::eLeftButton) ||
aMouseEvent->isShift);
aMouseEvent->IsShift());
if (!doTableSelection)
{
// In Browser, special 'table selection' key must be pressed for table selection
// or when just Shift is pressed and we're already in table/cell selection mode
#ifdef XP_MACOSX
doTableSelection = aMouseEvent->isMeta || (aMouseEvent->isShift && selectingTableCells);
doTableSelection = aMouseEvent->IsMeta() || (aMouseEvent->IsShift() && selectingTableCells);
#else
doTableSelection = aMouseEvent->isControl || (aMouseEvent->isShift && selectingTableCells);
doTableSelection = aMouseEvent->IsControl() || (aMouseEvent->IsShift() && selectingTableCells);
#endif
}
if (!doTableSelection)
@ -2476,7 +2476,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL;
nsInputEvent* keyEvent = (nsInputEvent*)aEvent;
if (!keyEvent->isAlt) {
if (!keyEvent->IsAlt()) {
for (nsIContent* content = mContent; content;
content = content->GetParent()) {
@ -2537,11 +2537,11 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
nsMouseEvent *me = (nsMouseEvent *)aEvent;
#ifdef XP_MACOSX
if (me->isControl)
if (me->IsControl())
return NS_OK;//short circuit. hard coded for mac due to time restraints.
bool control = me->isMeta;
bool control = me->IsMeta();
#else
bool control = me->isControl;
bool control = me->IsControl();
#endif
nsRefPtr<nsFrameSelection> fc = const_cast<nsFrameSelection*>(frameselection);
@ -2634,7 +2634,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// Do not touch any nsFrame members after this point without adding
// weakFrame checks.
rv = fc->HandleClick(offsets.content, offsets.StartOffset(),
offsets.EndOffset(), me->isShift, control,
offsets.EndOffset(), me->IsShift(), control,
offsets.associateWithNext);
if (NS_FAILED(rv))
@ -2643,7 +2643,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
if (offsets.offset != offsets.secondaryOffset)
fc->MaintainSelection();
if (isEditor && !me->isShift &&
if (isEditor && !me->IsShift() &&
(offsets.EndOffset() - offsets.StartOffset()) == 1)
{
// A single node is selected and we aren't extending an existing
@ -2912,7 +2912,7 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
rv = aFrameSelection->HandleClick(aOffsets.content,
aOffsets.StartOffset(),
aOffsets.EndOffset(),
me->isShift, false,
me->IsShift(), false,
aOffsets.associateWithNext);
if (NS_FAILED(rv)) {
return rv;

View File

@ -1881,7 +1881,7 @@ printf(" * TakeFocus - moving into new cell\n");
// XXXX We need to REALLY get the current key shift state
// (we'd need to add event listener -- let's not bother for now)
event.isShift = false; //aContinueSelection;
event.modifiers &= ~widget::MODIFIER_SHIFT; //aContinueSelection;
if (parent)
{
mCellParent = cellparent;
@ -2427,7 +2427,7 @@ printf("HandleTableSelection: Dragged into a new cell\n");
// Hold down shift, then start selecting in one direction
// If next cell dragged into is in same row, select entire row,
// if next cell is in same column, select entire column
if (mStartSelectedCell && aMouseEvent->isShift)
if (mStartSelectedCell && aMouseEvent->IsShift())
{
result = GetCellIndexes(mStartSelectedCell, startRowIndex, startColIndex);
if (NS_FAILED(result)) return result;
@ -2564,7 +2564,7 @@ printf("HandleTableSelection: Mouse UP event. mDragSelectingCells=%d, mStartSele
if (NS_FAILED(result))
return result;
if (rangeCount > 0 && aMouseEvent->isShift &&
if (rangeCount > 0 && aMouseEvent->IsShift() &&
mAppendStartSelectedCell && mAppendStartSelectedCell != childContent)
{
// Shift key is down: append a block selection
@ -2583,9 +2583,9 @@ printf("HandleTableSelection: Mouse UP event. mDragSelectingCells=%d, mStartSele
// else stop table selection mode
bool doMouseUpAction = false;
#ifdef XP_MACOSX
doMouseUpAction = aMouseEvent->isMeta;
doMouseUpAction = aMouseEvent->IsMeta();
#else
doMouseUpAction = aMouseEvent->isControl;
doMouseUpAction = aMouseEvent->IsControl();
#endif
if (!doMouseUpAction)
{

View File

@ -766,7 +766,7 @@ protected:
nsIntPoint mCachedMousePoint;
// cached modifiers
PRInt8 mCachedModifiers;
mozilla::widget::Modifiers mCachedModifiers;
// set to the currently active menu bar, if any
nsMenuBarFrame* mActiveMenuBar;

View File

@ -161,10 +161,10 @@ nsButtonBoxFrame::DoMouseClick(nsGUIEvent* aEvent, bool aTrustEvent)
bool isAlt = false;
bool isMeta = false;
if(aEvent) {
isShift = ((nsInputEvent*)(aEvent))->isShift;
isControl = ((nsInputEvent*)(aEvent))->isControl;
isAlt = ((nsInputEvent*)(aEvent))->isAlt;
isMeta = ((nsInputEvent*)(aEvent))->isMeta;
isShift = ((nsInputEvent*)(aEvent))->IsShift();
isControl = ((nsInputEvent*)(aEvent))->IsControl();
isAlt = ((nsInputEvent*)(aEvent))->IsAlt();
isMeta = ((nsInputEvent*)(aEvent))->IsMeta();
}
// Have the content handle the event, propagating it according to normal DOM rules.

View File

@ -453,15 +453,15 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
PRUint32 keyCode = keyEvent->keyCode;
#ifdef XP_MACOSX
// On mac, open menulist on either up/down arrow or space (w/o Cmd pressed)
if (!IsOpen() && ((keyEvent->charCode == NS_VK_SPACE && !keyEvent->isMeta) ||
if (!IsOpen() && ((keyEvent->charCode == NS_VK_SPACE && !keyEvent->IsMeta()) ||
(keyCode == NS_VK_UP || keyCode == NS_VK_DOWN))) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
OpenMenu(false);
}
#else
// On other platforms, toggle menulist on unmodified F4 or Alt arrow
if ((keyCode == NS_VK_F4 && !keyEvent->isAlt) ||
((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->isAlt)) {
if ((keyCode == NS_VK_F4 && !keyEvent->IsAlt()) ||
((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->IsAlt())) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
ToggleMenuState();
}
@ -1266,10 +1266,10 @@ nsMenuFrame::CreateMenuCommandEvent(nsGUIEvent *aEvent, bool aFlipChecked)
bool shift = false, control = false, alt = false, meta = false;
if (aEvent && (aEvent->eventStructType == NS_MOUSE_EVENT ||
aEvent->eventStructType == NS_KEY_EVENT)) {
shift = static_cast<nsInputEvent *>(aEvent)->isShift;
control = static_cast<nsInputEvent *>(aEvent)->isControl;
alt = static_cast<nsInputEvent *>(aEvent)->isAlt;
meta = static_cast<nsInputEvent *>(aEvent)->isMeta;
shift = static_cast<nsInputEvent *>(aEvent)->IsShift();
control = static_cast<nsInputEvent *>(aEvent)->IsControl();
alt = static_cast<nsInputEvent *>(aEvent)->IsAlt();
meta = static_cast<nsInputEvent *>(aEvent)->IsMeta();
}
// Because the command event is firing asynchronously, a flag is needed to

View File

@ -548,9 +548,9 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
nsMouseEvent::eLeftButton &&
#ifdef XP_MACOSX
// On Mac the option key inverts the scroll-to-here preference.
(static_cast<nsMouseEvent*>(aEvent)->isAlt != GetScrollToClick())) ||
(static_cast<nsMouseEvent*>(aEvent)->IsAlt() != GetScrollToClick())) ||
#else
(static_cast<nsMouseEvent*>(aEvent)->isShift != GetScrollToClick())) ||
(static_cast<nsMouseEvent*>(aEvent)->IsShift() != GetScrollToClick())) ||
#endif
(gMiddlePref && aEvent->message == NS_MOUSE_BUTTON_DOWN &&
static_cast<nsMouseEvent*>(aEvent)->button ==
@ -1003,9 +1003,9 @@ nsSliderFrame::HandlePress(nsPresContext* aPresContext,
{
#ifdef XP_MACOSX
// On Mac the option key inverts the scroll-to-here preference.
if (((nsMouseEvent *)aEvent)->isAlt != GetScrollToClick())
if (((nsMouseEvent *)aEvent)->IsAlt() != GetScrollToClick())
#else
if (((nsMouseEvent *)aEvent)->isShift != GetScrollToClick())
if (((nsMouseEvent *)aEvent)->IsShift() != GetScrollToClick())
#endif
return NS_OK;

View File

@ -72,11 +72,6 @@
using namespace mozilla;
#define FLAG_ALT 0x01
#define FLAG_CONTROL 0x02
#define FLAG_SHIFT 0x04
#define FLAG_META 0x08
const nsNavigationDirection DirectionFromKeyCodeTable[2][6] = {
{
eNavigationDirection_Last, // NS_VK_END
@ -480,19 +475,7 @@ nsXULPopupManager::InitTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup,
if (event) {
if (event->eventStructType == NS_MOUSE_EVENT ||
event->eventStructType == NS_KEY_EVENT) {
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(event);
if (inputEvent->isAlt) {
mCachedModifiers |= FLAG_ALT;
}
if (inputEvent->isControl) {
mCachedModifiers |= FLAG_CONTROL;
}
if (inputEvent->isShift) {
mCachedModifiers |= FLAG_SHIFT;
}
if (inputEvent->isMeta) {
mCachedModifiers |= FLAG_META;
}
mCachedModifiers = static_cast<nsInputEvent*>(event)->modifiers;
}
nsIDocument* doc = aPopup->GetCurrentDoc();
if (doc) {
@ -1200,12 +1183,7 @@ nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup,
}
event.refPoint = mCachedMousePoint;
event.isAlt = !!(mCachedModifiers & FLAG_ALT);
event.isControl = !!(mCachedModifiers & FLAG_CONTROL);
event.isShift = !!(mCachedModifiers & FLAG_SHIFT);
event.isMeta = !!(mCachedModifiers & FLAG_META);
event.modifiers = mCachedModifiers;
nsEventDispatcher::Dispatch(popup, presContext, &event, nsnull, &status);
mCachedMousePoint = nsIntPoint(0, 0);

View File

@ -1462,10 +1462,7 @@ nsWindow::DispatchMultitouchEvent(nsTouchEvent &event, AndroidGeckoEvent *ae)
{
nsIntPoint offset = WidgetToScreenOffset();
event.isShift = false;
event.isControl = false;
event.isMeta = false;
event.isAlt = false;
event.modifiers = 0;
event.time = ae->Time();
int action = ae->Action() & AndroidMotionEvent::ACTION_MASK;
@ -1580,10 +1577,7 @@ nsWindow::DispatchGestureEvent(PRUint32 msg, PRUint32 direction, double delta,
{
nsSimpleGestureEvent event(true, msg, this, direction, delta);
event.isShift = false;
event.isControl = false;
event.isMeta = false;
event.isAlt = false;
event.modifiers = 0;
event.time = time;
event.refPoint = refPoint;
@ -1597,10 +1591,7 @@ nsWindow::DispatchMotionEvent(nsInputEvent &event, AndroidGeckoEvent *ae,
{
nsIntPoint offset = WidgetToScreenOffset();
event.isShift = false;
event.isControl = false;
event.isMeta = false;
event.isAlt = false;
event.modifiers = 0;
event.time = ae->Time();
// XXX possibly bound the range of event.refPoint here.
@ -1762,10 +1753,10 @@ nsWindow::InitKeyEvent(nsKeyEvent& event, AndroidGeckoEvent& key,
event.pluginEvent = pluginEvent;
}
event.isShift = key.IsShiftPressed();
event.isControl = gMenu;
event.isAlt = key.IsAltPressed();
event.isMeta = false;
event.InitBasicModifiers(gMenu,
key.IsAltPressed(),
key.IsShiftPressed(),
false);
event.time = key.Time();
if (gMenu)
@ -1893,7 +1884,7 @@ nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
pressEvent.flags |= NS_EVENT_FLAG_NO_DEFAULT;
}
#ifdef DEBUG_ANDROID_WIDGET
__android_log_print(ANDROID_LOG_INFO, "Gecko", "Dispatching key pressEvent with keyCode %d charCode %d shift %d alt %d sym/ctrl %d metamask %d", pressEvent.keyCode, pressEvent.charCode, pressEvent.isShift, pressEvent.isAlt, pressEvent.isControl, ae->MetaState());
__android_log_print(ANDROID_LOG_INFO, "Gecko", "Dispatching key pressEvent with keyCode %d charCode %d shift %d alt %d sym/ctrl %d metamask %d", pressEvent.keyCode, pressEvent.charCode, pressEvent.IsShift(), pressEvent.IsAlt(), pressEvent.IsControl(), ae->MetaState());
#endif
DispatchEvent(&pressEvent);
}

View File

@ -148,10 +148,6 @@ sendMouseEvent(PRUint32 msg, uint64_t timeMs, int x, int y)
event.refPoint.x = x;
event.refPoint.y = y;
event.time = timeMs;
event.isShift = false;
event.isControl = false;
event.isMeta = false;
event.isAlt = false;
event.button = nsMouseEvent::eLeftButton;
if (msg != NS_MOUSE_MOVE)
event.clickCount = 1;
@ -199,10 +195,6 @@ sendTouchEvent(UserInputData& data)
nsTouchEvent event(true, msg, NULL);
event.time = data.timeMs;
event.isShift = false;
event.isControl = false;
event.isMeta = false;
event.isAlt = false;
int32_t i;
if (msg == NS_TOUCH_END) {

View File

@ -296,7 +296,7 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
}
for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) {
PRUint32 ch = nativeKeyEvent->isShift ?
PRUint32 ch = nativeKeyEvent->IsShift() ?
nativeKeyEvent->alternativeCharCodes[i].mShiftedCharCode :
nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode;
if (ch && ch != aEvent.charCode) {

View File

@ -6099,10 +6099,12 @@ get_inner_gdk_window (GdkWindow *aWindow,
static inline bool
is_context_menu_key(const nsKeyEvent& aKeyEvent)
{
return ((aKeyEvent.keyCode == NS_VK_F10 && aKeyEvent.isShift &&
!aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt) ||
(aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.isShift &&
!aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt));
return ((aKeyEvent.keyCode == NS_VK_F10 && aKeyEvent.IsShift() &&
!aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
!aKeyEvent.IsAlt()) ||
(aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.IsShift() &&
!aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
!aKeyEvent.IsAlt()));
}
static int

View File

@ -2145,14 +2145,10 @@ bool nsWindow::OnMouseChord(MPARAM mp1, MPARAM mp2)
event.keyCode = NS_VK_INSERT;
if (isCopy) {
event.isShift = false;
event.isControl = true;
event.modifiers = widget::MODIFIER_CONTROL;
} else {
event.isShift = true;
event.isControl = false;
event.modifiers = widget::MODIFIER_SHIFT;
}
event.isAlt = false;
event.isMeta = false;
event.eventStructType = NS_KEY_EVENT;
event.charCode = 0;
@ -2160,13 +2156,13 @@ bool nsWindow::OnMouseChord(MPARAM mp1, MPARAM mp2)
if (SHORT1FROMMP(mp1) & (KC_VIRTUALKEY | KC_KEYUP | KC_LONEKEY)) {
USHORT usVKey = SHORT2FROMMP(mp2);
if (usVKey == VK_SHIFT) {
event.isShift = true;
event.modifiers |= widget::MODIFIER_SHIFT;
}
if (usVKey == VK_CTRL) {
event.isControl = true;
event.modifiers |= widget::MODIFIER_CONTROL;
}
if (usVKey == VK_ALTGRAF || usVKey == VK_ALT) {
event.isAlt = true;
event.modifiers |= widget::MODIFIER_ALT;
}
}
@ -2462,10 +2458,8 @@ bool nsWindow::DispatchKeyEvent(MPARAM mp1, MPARAM mp2)
this);
InitEvent(event, &point);
event.keyCode = WMChar2KeyCode(mp1, mp2);
event.isShift = (fsFlags & KC_SHIFT) ? true : false;
event.isControl = (fsFlags & KC_CTRL) ? true : false;
event.isAlt = (fsFlags & KC_ALT) ? true : false;
event.isMeta = false;
event.InitBasicModifiers(fsFlags & KC_CTRL, fsFlags & KC_ALT,
fsFlags & KC_SHIFT, false);
event.charCode = 0;
// Check for a scroll mouse event vs. a keyboard event. The way we know
@ -2522,15 +2516,15 @@ bool nsWindow::DispatchKeyEvent(MPARAM mp1, MPARAM mp2)
pressEvent.charCode = outbuf[0];
if (pressEvent.isControl && !(fsFlags & (KC_VIRTUALKEY | KC_DEADKEY))) {
if (!pressEvent.isShift && (pressEvent.charCode >= 'A' && pressEvent.charCode <= 'Z')) {
if (pressEvent.IsControl() && !(fsFlags & (KC_VIRTUALKEY | KC_DEADKEY))) {
if (!pressEvent.IsShift() && (pressEvent.charCode >= 'A' && pressEvent.charCode <= 'Z')) {
pressEvent.charCode = tolower(pressEvent.charCode);
}
if (pressEvent.isShift && (pressEvent.charCode >= 'a' && pressEvent.charCode <= 'z')) {
if (pressEvent.IsShift() && (pressEvent.charCode >= 'a' && pressEvent.charCode <= 'z')) {
pressEvent.charCode = toupper(pressEvent.charCode);
}
pressEvent.keyCode = 0;
} else if (!pressEvent.isControl && !pressEvent.isAlt && pressEvent.charCode != 0) {
} else if (!pressEvent.IsControl() && !pressEvent.IsAlt() && pressEvent.charCode != 0) {
if (!(fsFlags & KC_VIRTUALKEY) || // not virtual key
((fsFlags & KC_CHAR) && !pressEvent.keyCode)) {
pressEvent.keyCode = 0;
@ -2799,10 +2793,9 @@ bool nsWindow::DispatchDragDropEvent(PRUint32 aMsg)
nsDragEvent event(true, aMsg, this);
InitEvent(event);
event.isShift = isKeyDown(VK_SHIFT);
event.isControl = isKeyDown(VK_CTRL);
event.isAlt = isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF);
event.isMeta = false;
event.InitBasicModifiers(isKeyDown(VK_CTRL),
isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF),
isKeyDown(VK_SHIFT), false);
return DispatchWindowEvent(&event);
}
@ -2875,9 +2868,9 @@ bool nsWindow::DispatchMouseEvent(PRUint32 aEventType, MPARAM mp1, MPARAM mp2,
}
InitEvent(event, nsnull);
event.isShift = isKeyDown(VK_SHIFT);
event.isControl = isKeyDown(VK_CTRL);
event.isAlt = isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF);
event.InitBasicModifiers(isKeyDown(VK_CTRL),
isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF),
isKeyDown(VK_SHIFT), false);
} else {
POINTL ptl;
if (aEventType == NS_CONTEXTMENU && aIsContextMenuKey) {
@ -2892,11 +2885,9 @@ bool nsWindow::DispatchMouseEvent(PRUint32 aEventType, MPARAM mp1, MPARAM mp2,
InitEvent(event, &pt);
USHORT usFlags = SHORT2FROMMP(mp2);
event.isShift = (usFlags & KC_SHIFT) ? true : false;
event.isControl = (usFlags & KC_CTRL) ? true : false;
event.isAlt = (usFlags & KC_ALT) ? true : false;
event.InitBasicModifiers(usFlags & KC_CTRL, usFlags & KC_ALT,
usFlags & KC_SHIFT, false);
}
event.isMeta = false;
// Dblclicks are used to set the click count, then changed to mousedowns
if (aEventType == NS_MOUSE_DOUBLECLICK &&
@ -3010,10 +3001,9 @@ bool nsWindow::DispatchScrollEvent(ULONG msg, MPARAM mp1, MPARAM mp2)
nsMouseScrollEvent scrollEvent(true, NS_MOUSE_SCROLL, this);
InitEvent(scrollEvent);
scrollEvent.isShift = isKeyDown(VK_SHIFT);
scrollEvent.isControl = isKeyDown(VK_CTRL);
scrollEvent.isAlt = isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF);
scrollEvent.isMeta = false;
scrollEvent.InitBasicModifiers(isKeyDown(VK_CTRL),
isKeyDown(VK_ALT) || isKeyDown(VK_ALTGRAF),
isKeyDown(VK_SHIFT), false);
scrollEvent.scrollFlags = (msg == WM_HSCROLL) ?
nsMouseScrollEvent::kIsHorizontal :
nsMouseScrollEvent::kIsVertical;

View File

@ -213,15 +213,14 @@ isContextMenuKeyEvent(const QKeyEvent *qe)
static void
InitKeyEvent(nsKeyEvent &aEvent, QKeyEvent *aQEvent)
{
aEvent.isShift = (aQEvent->modifiers() & Qt::ShiftModifier) ? true : false;
aEvent.isControl = (aQEvent->modifiers() & Qt::ControlModifier) ? true : false;
aEvent.isAlt = (aQEvent->modifiers() & Qt::AltModifier) ? true : false;
aEvent.isMeta = (aQEvent->modifiers() & Qt::MetaModifier) ? true : false;
aEvent.InitBasicModifiers(aQEvent->modifiers() & Qt::ControlModifier,
aQEvent->modifiers() & Qt::AltModifier,
aQEvent->modifiers() & Qt::ShiftModifier,
aQEvent->modifiers() & Qt::MetaModifier);
aEvent.time = 0;
if (sAltGrModifier) {
aEvent.isControl = true;
aEvent.isAlt = true;
aEvent.modifiers |= (widget::MODIFIER_CONTROL | widget::MODIFIER_ALT);
}
// The transformations above and in qt for the keyval are not invertible
@ -1354,10 +1353,10 @@ nsWindow::InitButtonEvent(nsMouseEvent &aMoveEvent,
aMoveEvent.refPoint.x = nscoord(aEvent->pos().x());
aMoveEvent.refPoint.y = nscoord(aEvent->pos().y());
aMoveEvent.isShift = ((aEvent->modifiers() & Qt::ShiftModifier) != 0);
aMoveEvent.isControl = ((aEvent->modifiers() & Qt::ControlModifier) != 0);
aMoveEvent.isAlt = ((aEvent->modifiers() & Qt::AltModifier) != 0);
aMoveEvent.isMeta = ((aEvent->modifiers() & Qt::MetaModifier) != 0);
aMoveEvent.InitBasicModifiers(aEvent->modifiers() & Qt::ControlModifier,
aEvent->modifiers() & Qt::AltModifier,
aEvent->modifiers() & Qt::ShiftModifier,
aEvent->modifiers() & Qt::MetaModifier);
aMoveEvent.clickCount = aClickCount;
}
@ -1758,9 +1757,9 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
// At that time, we need to reset the modifiers
// because nsEditor will not accept a key event
// for text input if one or more modifiers are set.
event.isControl = false;
event.isAlt = false;
event.isMeta = false;
event.modifiers &= ~(widget::MODIFIER_CONTROL |
widget::MODIFIER_ALT |
widget::MODIFIER_META);
}
KeySym keysym = NoSymbol;
@ -1994,10 +1993,10 @@ nsWindow::OnScrollEvent(QGraphicsSceneWheelEvent *aEvent)
event.refPoint.x = nscoord(aEvent->scenePos().x());
event.refPoint.y = nscoord(aEvent->scenePos().y());
event.isShift = aEvent->modifiers() & Qt::ShiftModifier;
event.isControl = aEvent->modifiers() & Qt::ControlModifier;
event.isAlt = aEvent->modifiers() & Qt::AltModifier;
event.isMeta = aEvent->modifiers() & Qt::MetaModifier;
event.InitBasicModifiers(aEvent->modifiers() & Qt::ControlModifier,
aEvent->modifiers() & Qt::AltModifier,
aEvent->modifiers() & Qt::ShiftModifier,
aEvent->modifiers() & Qt::MetaModifier);
event.time = 0;
return DispatchEvent(&event);
@ -2142,10 +2141,10 @@ nsWindow::DispatchGestureEvent(PRUint32 aMsg, PRUint32 aDirection,
Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
mozGesture.isShift = (modifiers & Qt::ShiftModifier) ? true : false;
mozGesture.isControl = (modifiers & Qt::ControlModifier) ? true : false;
mozGesture.isMeta = false;
mozGesture.isAlt = (modifiers & Qt::AltModifier) ? true : false;
mozGesture.InitBasicModifiers(modifiers & Qt::ControlModifier,
modifiers & Qt::AltModifier,
modifiers & Qt::ShiftModifier,
false);
mozGesture.button = 0;
mozGesture.time = 0;
@ -2603,10 +2602,12 @@ initialize_prefs(void)
inline bool
is_context_menu_key(const nsKeyEvent& aKeyEvent)
{
return ((aKeyEvent.keyCode == NS_VK_F10 && aKeyEvent.isShift &&
!aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt) ||
(aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.isShift &&
!aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt));
return ((aKeyEvent.keyCode == NS_VK_F10 && aKeyEvent.IsShift() &&
!aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
!aKeyEvent.IsAlt()) ||
(aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.IsShift() &&
!aKeyEvent.IsControl() && !aKeyEvent.IsMeta() &&
!aKeyEvent.IsAlt()));
}
void
@ -2614,10 +2615,7 @@ key_event_to_context_menu_event(nsMouseEvent &aEvent,
QKeyEvent *aGdkEvent)
{
aEvent.refPoint = nsIntPoint(0, 0);
aEvent.isShift = false;
aEvent.isControl = false;
aEvent.isAlt = false;
aEvent.isMeta = false;
aEvent.modifiers = 0;
aEvent.time = 0;
aEvent.clickCount = 1;
}

View File

@ -419,10 +419,10 @@ private:
event.refPoint.x = nscoord(mMoveEvent.pos.x());
event.refPoint.y = nscoord(mMoveEvent.pos.y());
event.isShift = ((mMoveEvent.modifiers & Qt::ShiftModifier) != 0);
event.isControl = ((mMoveEvent.modifiers & Qt::ControlModifier) != 0);
event.isAlt = ((mMoveEvent.modifiers & Qt::AltModifier) != 0);
event.isMeta = ((mMoveEvent.modifiers & Qt::MetaModifier) != 0);
event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
mMoveEvent.modifiers & Qt::AltModifier,
mMoveEvent.modifiers & Qt::ShiftModifier,
mMoveEvent.modifiers & Qt::MetaModifier);
event.clickCount = 0;
DispatchEvent(&event);

View File

@ -795,10 +795,10 @@ MouseScrollHandler::HandleScrollMessageAsMouseWheelMessage(nsWindow* aWindow,
aWindow, (aMessage == MOZ_WM_VSCROLL) ? "V" : "H",
aWParam, aLParam, scrollEvent.refPoint.x, scrollEvent.refPoint.y,
scrollEvent.delta, scrollEvent.scrollFlags,
GetBoolName(scrollEvent.isShift),
GetBoolName(scrollEvent.isControl),
GetBoolName(scrollEvent.isAlt),
GetBoolName(scrollEvent.isMeta)));
GetBoolName(scrollEvent.IsShift()),
GetBoolName(scrollEvent.IsControl()),
GetBoolName(scrollEvent.IsAlt()),
GetBoolName(scrollEvent.IsMeta())));
DispatchEvent(aWindow, scrollEvent);
}
@ -966,10 +966,10 @@ MouseScrollHandler::LastEventInfo::InitMouseScrollEvent(
"isMeta: %s }, mRemainingDeltaForScroll: %d",
aWindow, aMouseScrollEvent.refPoint.x, aMouseScrollEvent.refPoint.y,
aMouseScrollEvent.delta, aMouseScrollEvent.scrollFlags,
GetBoolName(aMouseScrollEvent.isShift),
GetBoolName(aMouseScrollEvent.isControl),
GetBoolName(aMouseScrollEvent.isAlt),
GetBoolName(aMouseScrollEvent.isMeta), mRemainingDeltaForScroll));
GetBoolName(aMouseScrollEvent.IsShift()),
GetBoolName(aMouseScrollEvent.IsControl()),
GetBoolName(aMouseScrollEvent.IsAlt()),
GetBoolName(aMouseScrollEvent.IsMeta()), mRemainingDeltaForScroll));
return (aMouseScrollEvent.delta != 0);
}
@ -1036,10 +1036,10 @@ MouseScrollHandler::LastEventInfo::InitMousePixelScrollEvent(
"isMeta: %s }, mRemainingDeltaForScroll: %d",
aWindow, aPixelScrollEvent.refPoint.x, aPixelScrollEvent.refPoint.y,
aPixelScrollEvent.delta, aPixelScrollEvent.scrollFlags,
GetBoolName(aPixelScrollEvent.isShift),
GetBoolName(aPixelScrollEvent.isControl),
GetBoolName(aPixelScrollEvent.isAlt),
GetBoolName(aPixelScrollEvent.isMeta), mRemainingDeltaForPixel));
GetBoolName(aPixelScrollEvent.IsShift()),
GetBoolName(aPixelScrollEvent.IsControl()),
GetBoolName(aPixelScrollEvent.IsAlt()),
GetBoolName(aPixelScrollEvent.IsMeta()), mRemainingDeltaForPixel));
return (aPixelScrollEvent.delta != 0);
}