mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 719320 part.13 Replace legacy mouse scroll event dispatchers with D3E wheel event dispatcher on GTK r=karlt
This commit is contained in:
parent
f4626c0cee
commit
227be1a7d1
@ -114,6 +114,8 @@ extern "C" {
|
||||
|
||||
#include "nsShmImage.h"
|
||||
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
using mozilla::gl::GLContext;
|
||||
@ -2746,23 +2748,8 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
// These are mapped to horizontal scroll
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
nsMouseScrollEvent event(true, NS_MOUSE_SCROLL, this);
|
||||
event.pressure = mLastMotionPressure;
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
// XXX Why is this delta value different from the scroll event?
|
||||
event.delta = (aEvent->button == 6) ? -2 : 2;
|
||||
|
||||
KeymapWrapper::InitInputEvent(event, aEvent->state);
|
||||
|
||||
event.time = aEvent->time;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
NS_WARNING("We're not supporting legacy horizontal scroll event");
|
||||
return;
|
||||
}
|
||||
// Map buttons 8-9 to back/forward
|
||||
case 8:
|
||||
DispatchCommandEvent(nsGkAtoms::Back);
|
||||
@ -3124,44 +3111,44 @@ nsWindow::OnScrollEvent(GtkWidget *aWidget, GdkEventScroll *aEvent)
|
||||
if (gConsumeRollupEvent && rolledUp)
|
||||
return;
|
||||
|
||||
nsMouseScrollEvent event(true, NS_MOUSE_SCROLL, this);
|
||||
WheelEvent wheelEvent(true, NS_WHEEL_WHEEL, this);
|
||||
wheelEvent.deltaMode = nsIDOMWheelEvent::DOM_DELTA_LINE;
|
||||
switch (aEvent->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
event.delta = -3;
|
||||
wheelEvent.deltaY = wheelEvent.lineOrPageDeltaY = -3;
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
event.delta = 3;
|
||||
wheelEvent.deltaY = wheelEvent.lineOrPageDeltaY = 3;
|
||||
break;
|
||||
case GDK_SCROLL_LEFT:
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||
event.delta = -1;
|
||||
wheelEvent.deltaX = wheelEvent.lineOrPageDeltaX = -1;
|
||||
break;
|
||||
case GDK_SCROLL_RIGHT:
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||
event.delta = 1;
|
||||
wheelEvent.deltaX = wheelEvent.lineOrPageDeltaX = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
NS_ASSERTION(wheelEvent.deltaX || wheelEvent.deltaY,
|
||||
"deltaX or deltaY must be non-zero");
|
||||
|
||||
if (aEvent->window == mGdkWindow) {
|
||||
// we are the window that the event happened on so no need for expensive WidgetToScreenOffset
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
wheelEvent.refPoint.x = nscoord(aEvent->x);
|
||||
wheelEvent.refPoint.y = nscoord(aEvent->y);
|
||||
} else {
|
||||
// XXX we're never quite sure which GdkWindow the event came from due to our custom bubbling
|
||||
// in scroll_event_cb(), so use ScreenToWidget to translate the screen root coordinates into
|
||||
// coordinates relative to this widget.
|
||||
nsIntPoint point(NSToIntFloor(aEvent->x_root), NSToIntFloor(aEvent->y_root));
|
||||
event.refPoint = point - WidgetToScreenOffset();
|
||||
wheelEvent.refPoint = point - WidgetToScreenOffset();
|
||||
}
|
||||
|
||||
KeymapWrapper::InitInputEvent(event, aEvent->state);
|
||||
KeymapWrapper::InitInputEvent(wheelEvent, aEvent->state);
|
||||
|
||||
event.time = aEvent->time;
|
||||
wheelEvent.time = aEvent->time;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
DispatchEvent(&wheelEvent, status);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user