зеркало из https://github.com/mozilla/gecko-dev.git
Bug 428988 - Expose mouse event pressure. r=Olli.Pettay, sr=roc.
This commit is contained in:
Родитель
c8c8af4e5b
Коммит
ec25478838
|
@ -3415,9 +3415,12 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
|
||||||
aSourceEvent->widget, nsMouseEvent::eReal);
|
aSourceEvent->widget, nsMouseEvent::eReal);
|
||||||
event.refPoint = aSourceEvent->refPoint;
|
event.refPoint = aSourceEvent->refPoint;
|
||||||
PRUint32 clickCount = 1;
|
PRUint32 clickCount = 1;
|
||||||
|
float pressure = 0;
|
||||||
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
|
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||||
clickCount = static_cast<nsMouseEvent*>(aSourceEvent)->clickCount;
|
clickCount = static_cast<nsMouseEvent*>(aSourceEvent)->clickCount;
|
||||||
|
pressure = static_cast<nsMouseEvent*>(aSourceEvent)->pressure;
|
||||||
}
|
}
|
||||||
|
event.pressure = pressure;
|
||||||
event.clickCount = clickCount;
|
event.clickCount = clickCount;
|
||||||
event.isShift = aSourceEvent->isShift;
|
event.isShift = aSourceEvent->isShift;
|
||||||
event.isControl = aSourceEvent->isControl;
|
event.isControl = aSourceEvent->isControl;
|
||||||
|
|
|
@ -822,6 +822,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||||
mouseEvent->context = oldMouseEvent->context;
|
mouseEvent->context = oldMouseEvent->context;
|
||||||
mouseEvent->relatedTarget = oldMouseEvent->relatedTarget;
|
mouseEvent->relatedTarget = oldMouseEvent->relatedTarget;
|
||||||
mouseEvent->button = oldMouseEvent->button;
|
mouseEvent->button = oldMouseEvent->button;
|
||||||
|
mouseEvent->pressure = oldMouseEvent->pressure;
|
||||||
newEvent = mouseEvent;
|
newEvent = mouseEvent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
|
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MouseEvent)
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MouseEvent)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||||
|
|
||||||
|
@ -136,6 +137,24 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
|
||||||
|
nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||||
|
PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY,
|
||||||
|
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||||
|
PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget,
|
||||||
|
float aPressure)
|
||||||
|
{
|
||||||
|
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
|
||||||
|
aView, aDetail, aScreenX, aScreenY,
|
||||||
|
aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey,
|
||||||
|
aMetaKey, aButton, aRelatedTarget);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
static_cast<nsMouseEvent_base*>(mEvent)->pressure = aPressure;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMMouseEvent::GetButton(PRUint16* aButton)
|
nsDOMMouseEvent::GetButton(PRUint16* aButton)
|
||||||
{
|
{
|
||||||
|
@ -249,6 +268,14 @@ nsDOMMouseEvent::GetWhich(PRUint32* aWhich)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMMouseEvent::GetMozPressure(float* aPressure)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aPressure);
|
||||||
|
*aPressure = static_cast<nsMouseEvent_base*>(mEvent)->pressure;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
|
nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsInputEvent *aEvent)
|
nsInputEvent *aEvent)
|
||||||
|
|
|
@ -41,13 +41,14 @@
|
||||||
|
|
||||||
#include "nsIDOMMouseEvent.h"
|
#include "nsIDOMMouseEvent.h"
|
||||||
#include "nsDOMUIEvent.h"
|
#include "nsDOMUIEvent.h"
|
||||||
|
#include "nsIDOMNSMouseEvent.h"
|
||||||
|
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsIScrollableView;
|
class nsIScrollableView;
|
||||||
class nsEvent;
|
class nsEvent;
|
||||||
|
|
||||||
class nsDOMMouseEvent : public nsIDOMMouseEvent,
|
class nsDOMMouseEvent : public nsDOMUIEvent,
|
||||||
public nsDOMUIEvent
|
public nsIDOMNSMouseEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDOMMouseEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);
|
nsDOMMouseEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);
|
||||||
|
@ -58,6 +59,9 @@ public:
|
||||||
// nsIDOMMouseEvent Interface
|
// nsIDOMMouseEvent Interface
|
||||||
NS_DECL_NSIDOMMOUSEEVENT
|
NS_DECL_NSIDOMMOUSEEVENT
|
||||||
|
|
||||||
|
// nsIDOMNSMouseEvent Interface
|
||||||
|
NS_DECL_NSIDOMNSMOUSEEVENT
|
||||||
|
|
||||||
// Forward to base class
|
// Forward to base class
|
||||||
NS_FORWARD_TO_NSDOMUIEVENT
|
NS_FORWARD_TO_NSDOMUIEVENT
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ _TEST_FILES = \
|
||||||
test_bug447736.html \
|
test_bug447736.html \
|
||||||
test_bug456273.html \
|
test_bug456273.html \
|
||||||
test_bug457672.html \
|
test_bug457672.html \
|
||||||
|
test_bug428988.html \
|
||||||
bug457672.html \
|
bug457672.html \
|
||||||
test_draggableprop.html \
|
test_draggableprop.html \
|
||||||
test_dragstart.html \
|
test_dragstart.html \
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=428988
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 428988</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428988">Mozilla Bug 428988</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
/** Test for Bug 428988 **/
|
||||||
|
|
||||||
|
function listenerForClick(evt) {
|
||||||
|
is(Math.round(evt.mozPressure*100), 56, "Wrong .mozPressure");
|
||||||
|
}
|
||||||
|
|
||||||
|
function doTest() {
|
||||||
|
var target = document.getElementById("testTarget");
|
||||||
|
target.addEventListener("click", listenerForClick, true);
|
||||||
|
var me = document.createEvent("MouseEvent");
|
||||||
|
me.initNSMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
|
||||||
|
false, false, false, false, 0, null, 0.56);
|
||||||
|
target.dispatchEvent(me);
|
||||||
|
target.removeEventListener("click", listenerForClick, true);
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
addLoadEvent(doTest);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
<span id="testTarget" style="border: 1px solid black;">testTarget</span>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -77,6 +77,7 @@ XPIDLSRCS = \
|
||||||
nsIDOMMessageEvent.idl \
|
nsIDOMMessageEvent.idl \
|
||||||
nsIDOMNotifyPaintEvent.idl \
|
nsIDOMNotifyPaintEvent.idl \
|
||||||
nsIDOMSimpleGestureEvent.idl \
|
nsIDOMSimpleGestureEvent.idl \
|
||||||
|
nsIDOMNSMouseEvent.idl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Netscape Communications Corporation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Oleg Romashin <romaxa@gmail.com> (original author)
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#include "nsIDOMMouseEvent.idl"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The nsIDOMNSMouseEvent interface extends nsIDOMMouseEvent
|
||||||
|
* by providing various information related to the mouse event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[scriptable, uuid(1b8e528d-7dca-44ee-8ee6-c44594ebcef1)]
|
||||||
|
interface nsIDOMNSMouseEvent : nsIDOMMouseEvent
|
||||||
|
{
|
||||||
|
// Finger or touch pressure event value
|
||||||
|
// ranges between 0.0 and 1.0
|
||||||
|
readonly attribute float mozPressure;
|
||||||
|
|
||||||
|
void initNSMouseEvent(in DOMString typeArg,
|
||||||
|
in boolean canBubbleArg,
|
||||||
|
in boolean cancelableArg,
|
||||||
|
in nsIDOMAbstractView viewArg,
|
||||||
|
in long detailArg,
|
||||||
|
in long screenXArg,
|
||||||
|
in long screenYArg,
|
||||||
|
in long clientXArg,
|
||||||
|
in long clientYArg,
|
||||||
|
in boolean ctrlKeyArg,
|
||||||
|
in boolean altKeyArg,
|
||||||
|
in boolean shiftKeyArg,
|
||||||
|
in boolean metaKeyArg,
|
||||||
|
in unsigned short buttonArg,
|
||||||
|
in nsIDOMEventTarget relatedTargetArg,
|
||||||
|
in float pressure);
|
||||||
|
};
|
|
@ -465,6 +465,8 @@
|
||||||
// Simple gestures include
|
// Simple gestures include
|
||||||
#include "nsIDOMSimpleGestureEvent.h"
|
#include "nsIDOMSimpleGestureEvent.h"
|
||||||
|
|
||||||
|
#include "nsIDOMNSMouseEvent.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
||||||
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||||
|
|
||||||
|
@ -2149,17 +2151,20 @@ nsDOMClassInfo::Init()
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(MouseEvent, nsIDOMMouseEvent)
|
DOM_CLASSINFO_MAP_BEGIN(MouseEvent, nsIDOMMouseEvent)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||||
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(MouseScrollEvent, nsIDOMMouseScrollEvent)
|
DOM_CLASSINFO_MAP_BEGIN(MouseScrollEvent, nsIDOMMouseScrollEvent)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseScrollEvent)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseScrollEvent)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||||
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(DragEvent, nsIDOMDragEvent)
|
DOM_CLASSINFO_MAP_BEGIN(DragEvent, nsIDOMDragEvent)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDragEvent)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDragEvent)
|
||||||
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
|
@ -679,12 +679,16 @@ class nsMouseEvent_base : public nsInputEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMouseEvent_base(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 type)
|
nsMouseEvent_base(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 type)
|
||||||
: nsInputEvent(isTrusted, msg, w, type), button(0) {}
|
: nsInputEvent(isTrusted, msg, w, type), button(0), pressure(0) {}
|
||||||
|
|
||||||
/// The possible related target
|
/// The possible related target
|
||||||
nsCOMPtr<nsISupports> relatedTarget;
|
nsCOMPtr<nsISupports> relatedTarget;
|
||||||
|
|
||||||
PRInt16 button;
|
PRInt16 button;
|
||||||
|
|
||||||
|
// Finger or touch pressure of event
|
||||||
|
// ranges between 0.0 and 1.0
|
||||||
|
float pressure;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsMouseEvent : public nsMouseEvent_base
|
class nsMouseEvent : public nsMouseEvent_base
|
||||||
|
|
|
@ -398,6 +398,7 @@ nsWindow::nsWindow()
|
||||||
mDragMotionY = 0;
|
mDragMotionY = 0;
|
||||||
mDragMotionTime = 0;
|
mDragMotionTime = 0;
|
||||||
mDragMotionTimerID = 0;
|
mDragMotionTimerID = 0;
|
||||||
|
mLastMotionPressure = 0;
|
||||||
|
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
mIMEData = nsnull;
|
mIMEData = nsnull;
|
||||||
|
@ -2534,6 +2535,15 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
||||||
|
|
||||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
||||||
|
|
||||||
|
// should we move this into !synthEvent?
|
||||||
|
gdouble pressure = 0;
|
||||||
|
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||||
|
// Sometime gdk generate 0 pressure value between normal values
|
||||||
|
// We have to ignore that and use last valid value
|
||||||
|
if (pressure)
|
||||||
|
mLastMotionPressure = pressure;
|
||||||
|
event.pressure = mLastMotionPressure;
|
||||||
|
|
||||||
nsRect windowRect;
|
nsRect windowRect;
|
||||||
ScreenToWidget(nsRect(nscoord(cursorX), nscoord(cursorY), 1, 1), windowRect);
|
ScreenToWidget(nsRect(nscoord(cursorX), nscoord(cursorY), 1, 1), windowRect);
|
||||||
|
|
||||||
|
@ -2587,6 +2597,14 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
||||||
|
|
||||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
||||||
|
|
||||||
|
gdouble pressure = 0;
|
||||||
|
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||||
|
// Sometime gdk generate 0 pressure value between normal values
|
||||||
|
// We have to ignore that and use last valid value
|
||||||
|
if (pressure)
|
||||||
|
mLastMotionPressure = pressure;
|
||||||
|
event.pressure = mLastMotionPressure;
|
||||||
|
|
||||||
if (synthEvent) {
|
if (synthEvent) {
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
event.refPoint.x = nscoord(xevent.xmotion.x);
|
event.refPoint.x = nscoord(xevent.xmotion.x);
|
||||||
|
@ -2715,6 +2733,10 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||||
if (gConsumeRollupEvent && rolledUp)
|
if (gConsumeRollupEvent && rolledUp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gdouble pressure = 0;
|
||||||
|
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||||
|
mLastMotionPressure = pressure;
|
||||||
|
|
||||||
PRUint16 domButton;
|
PRUint16 domButton;
|
||||||
switch (aEvent->button) {
|
switch (aEvent->button) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -2731,6 +2753,7 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
|
nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
|
||||||
|
event.pressure = mLastMotionPressure;
|
||||||
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||||
event.refPoint.x = nscoord(aEvent->x);
|
event.refPoint.x = nscoord(aEvent->x);
|
||||||
event.refPoint.y = nscoord(aEvent->y);
|
event.refPoint.y = nscoord(aEvent->y);
|
||||||
|
@ -2761,6 +2784,7 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
|
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
|
||||||
event.button = domButton;
|
event.button = domButton;
|
||||||
InitButtonEvent(event, aEvent);
|
InitButtonEvent(event, aEvent);
|
||||||
|
event.pressure = mLastMotionPressure;
|
||||||
|
|
||||||
DispatchEvent(&event, status);
|
DispatchEvent(&event, status);
|
||||||
|
|
||||||
|
@ -2770,6 +2794,7 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||||
nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
|
nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
|
||||||
nsMouseEvent::eReal);
|
nsMouseEvent::eReal);
|
||||||
InitButtonEvent(contextMenuEvent, aEvent);
|
InitButtonEvent(contextMenuEvent, aEvent);
|
||||||
|
contextMenuEvent.pressure = mLastMotionPressure;
|
||||||
DispatchEvent(&contextMenuEvent, status);
|
DispatchEvent(&contextMenuEvent, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2797,9 +2822,13 @@ nsWindow::OnButtonReleaseEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
|
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
|
||||||
event.button = domButton;
|
event.button = domButton;
|
||||||
InitButtonEvent(event, aEvent);
|
InitButtonEvent(event, aEvent);
|
||||||
|
gdouble pressure = 0;
|
||||||
|
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||||
|
event.pressure = pressure ? pressure : mLastMotionPressure;
|
||||||
|
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
DispatchEvent(&event, status);
|
DispatchEvent(&event, status);
|
||||||
|
mLastMotionPressure = pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -550,6 +550,7 @@ private:
|
||||||
guint mDragMotionTime;
|
guint mDragMotionTime;
|
||||||
guint mDragMotionTimerID;
|
guint mDragMotionTimerID;
|
||||||
nsCOMPtr<nsITimer> mDragLeaveTimer;
|
nsCOMPtr<nsITimer> mDragLeaveTimer;
|
||||||
|
float mLastMotionPressure;
|
||||||
|
|
||||||
static PRBool sIsDraggingOutOf;
|
static PRBool sIsDraggingOutOf;
|
||||||
// drag in progress
|
// drag in progress
|
||||||
|
|
Загрузка…
Ссылка в новой задаче