From 25f4443f89900231b45cd11d8731ecf5232c3aa6 Mon Sep 17 00:00:00 2001 From: "joki%netscape.com" Date: Thu, 9 Dec 1999 21:02:09 +0000 Subject: [PATCH] fix 21337, set modifier keys for generated events. r:brendan a:brendan --- content/events/src/nsEventStateManager.cpp | 32 ++++++++++++++++++++++ layout/events/src/nsEventStateManager.cpp | 32 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 0575d081749..11de6a261ff 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -980,6 +980,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; //The frame has change but the content may not have. Check before dispatching to content mLastMouseOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1015,6 +1019,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; mCurrentTargetContent = targetContent; NS_IF_ADDREF(mCurrentTargetContent); @@ -1058,6 +1066,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; nsCOMPtr lastContent; mLastMouseOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1117,6 +1129,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; //The frame has change but the content may not have. Check before dispatching to content mLastDragOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1155,6 +1171,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; mCurrentTargetContent = targetContent; NS_IF_ADDREF(mCurrentTargetContent); @@ -1200,6 +1220,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; // dispatch to content via DOM nsCOMPtr lastContent; @@ -1332,6 +1356,10 @@ nsEventStateManager::CheckForAndDispatchClick(nsIPresContext* aPresContext, event.refPoint.x = aEvent->refPoint.x; event.refPoint.y = aEvent->refPoint.y; event.clickCount = aEvent->clickCount; + event.isShift = aEvent->isShift; + event.isControl = aEvent->isControl; + event.isAlt = aEvent->isAlt; + event.isMeta = aEvent->isMeta; if (mouseContent) { ret = mouseContent->HandleDOMEvent(aPresContext, &event, nsnull, @@ -1358,6 +1386,10 @@ nsEventStateManager::DispatchKeyPressEvent(nsIPresContext* aPresContext, event.message = NS_KEY_PRESS; event.widget = nsnull; event.keyCode = aEvent->keyCode; + event.isShift = aEvent->isShift; + event.isControl = aEvent->isControl; + event.isAlt = aEvent->isAlt; + event.isMeta = aEvent->isMeta; nsIContent *content; mCurrentTarget->GetContent(&content); diff --git a/layout/events/src/nsEventStateManager.cpp b/layout/events/src/nsEventStateManager.cpp index 0575d081749..11de6a261ff 100644 --- a/layout/events/src/nsEventStateManager.cpp +++ b/layout/events/src/nsEventStateManager.cpp @@ -980,6 +980,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; //The frame has change but the content may not have. Check before dispatching to content mLastMouseOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1015,6 +1019,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; mCurrentTargetContent = targetContent; NS_IF_ADDREF(mCurrentTargetContent); @@ -1058,6 +1066,10 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; nsCOMPtr lastContent; mLastMouseOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1117,6 +1129,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; //The frame has change but the content may not have. Check before dispatching to content mLastDragOverFrame->GetContent(getter_AddRefs(lastContent)); @@ -1155,6 +1171,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; mCurrentTargetContent = targetContent; NS_IF_ADDREF(mCurrentTargetContent); @@ -1200,6 +1220,10 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG event.clickCount = 0; event.point = aEvent->point; event.refPoint = aEvent->refPoint; + event.isShift = ((nsMouseEvent*)aEvent)->isShift; + event.isControl = ((nsMouseEvent*)aEvent)->isControl; + event.isAlt = ((nsMouseEvent*)aEvent)->isAlt; + event.isMeta = ((nsMouseEvent*)aEvent)->isMeta; // dispatch to content via DOM nsCOMPtr lastContent; @@ -1332,6 +1356,10 @@ nsEventStateManager::CheckForAndDispatchClick(nsIPresContext* aPresContext, event.refPoint.x = aEvent->refPoint.x; event.refPoint.y = aEvent->refPoint.y; event.clickCount = aEvent->clickCount; + event.isShift = aEvent->isShift; + event.isControl = aEvent->isControl; + event.isAlt = aEvent->isAlt; + event.isMeta = aEvent->isMeta; if (mouseContent) { ret = mouseContent->HandleDOMEvent(aPresContext, &event, nsnull, @@ -1358,6 +1386,10 @@ nsEventStateManager::DispatchKeyPressEvent(nsIPresContext* aPresContext, event.message = NS_KEY_PRESS; event.widget = nsnull; event.keyCode = aEvent->keyCode; + event.isShift = aEvent->isShift; + event.isControl = aEvent->isControl; + event.isAlt = aEvent->isAlt; + event.isMeta = aEvent->isMeta; nsIContent *content; mCurrentTarget->GetContent(&content);