Bug 602787 part.7 Don't implement methods which use Widget*Event in qt/nsWindow.h r=romaxa

This commit is contained in:
Masayuki Nakano 2013-10-22 22:27:35 +09:00
Родитель 71be00a2ce
Коммит abc4e3fac6
2 изменённых файлов: 45 добавлений и 36 удалений

Просмотреть файл

@ -2808,6 +2808,14 @@ nsWindow::GetDPI()
return float(rootWindow->height()/heightInches); return float(rootWindow->height()/heightInches);
} }
nsEventStatus
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
{
nsEventStatus status;
DispatchEvent(aEvent, status);
return status;
}
void void
nsWindow::DispatchActivateEvent(void) nsWindow::DispatchActivateEvent(void)
{ {
@ -3170,3 +3178,37 @@ nsWindow::GetGLFrameBufferFormat()
return LOCAL_GL_NONE; return LOCAL_GL_NONE;
} }
void
nsWindow::ProcessMotionEvent()
{
if (mPinchEvent.needDispatch) {
double distance = DistanceBetweenPoints(mPinchEvent.centerPoint,
mPinchEvent.touchPoint);
distance *= 2;
mPinchEvent.delta = distance - mPinchEvent.prevDistance;
nsIntPoint centerPoint(mPinchEvent.centerPoint.x(),
mPinchEvent.centerPoint.y());
DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
0, mPinchEvent.delta, centerPoint);
mPinchEvent.prevDistance = distance;
}
if (mMoveEvent.needDispatch) {
WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
WidgetMouseEvent::eReal);
event.refPoint.x = nscoord(mMoveEvent.pos.x());
event.refPoint.y = nscoord(mMoveEvent.pos.y());
event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
mMoveEvent.modifiers & Qt::AltModifier,
mMoveEvent.modifiers & Qt::ShiftModifier,
mMoveEvent.modifiers & Qt::MetaModifier);
event.clickCount = 0;
DispatchEvent(&event);
mMoveEvent.needDispatch = false;
}
mTimerStarted = false;
}

Просмотреть файл

@ -16,7 +16,7 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsBaseWidget.h" #include "nsBaseWidget.h"
#include "mozilla/MouseEvents.h" #include "mozilla/EventForwards.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
@ -183,12 +183,7 @@ public:
void DispatchDeactivateEventOnTopLevelWindow(void); void DispatchDeactivateEventOnTopLevelWindow(void);
void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus); void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent) nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
{
nsEventStatus status;
DispatchEvent(aEvent, status);
return status;
}
// Some of the nsIWidget methods // Some of the nsIWidget methods
virtual bool IsEnabled() const; virtual bool IsEnabled() const;
@ -378,35 +373,7 @@ private:
// event (like a keypress or mouse click). // event (like a keypress or mouse click).
void UserActivity(); void UserActivity();
inline void ProcessMotionEvent() { inline void ProcessMotionEvent();
if (mPinchEvent.needDispatch) {
double distance = DistanceBetweenPoints(mPinchEvent.centerPoint, mPinchEvent.touchPoint);
distance *= 2;
mPinchEvent.delta = distance - mPinchEvent.prevDistance;
nsIntPoint centerPoint(mPinchEvent.centerPoint.x(), mPinchEvent.centerPoint.y());
DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
0, mPinchEvent.delta, centerPoint);
mPinchEvent.prevDistance = distance;
}
if (mMoveEvent.needDispatch) {
WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
WidgetMouseEvent::eReal);
event.refPoint.x = nscoord(mMoveEvent.pos.x());
event.refPoint.y = nscoord(mMoveEvent.pos.y());
event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
mMoveEvent.modifiers & Qt::AltModifier,
mMoveEvent.modifiers & Qt::ShiftModifier,
mMoveEvent.modifiers & Qt::MetaModifier);
event.clickCount = 0;
DispatchEvent(&event);
mMoveEvent.needDispatch = false;
}
mTimerStarted = false;
}
void DispatchMotionToMainThread() { void DispatchMotionToMainThread() {
if (!mTimerStarted) { if (!mTimerStarted) {