Bug 839641 - Implement handling for APZC-reported gestures. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2013-04-26 13:26:46 -04:00
parent 5d262f9292
commit 6968125e22
2 changed files with 18 additions and 3 deletions

View File

@ -34,6 +34,7 @@
#include "nsIDOMClientRect.h"
#include "StrongPointer.h"
#include "mozilla/ClearOnShutdown.h"
#include "nsPrintfCString.h"
#ifdef DEBUG
#define ALOG_BRIDGE(args...) ALOG(args)
@ -2724,19 +2725,25 @@ AndroidBridge::RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrame
void
AndroidBridge::HandleDoubleTap(const nsIntPoint& aPoint)
{
// FIXME implement this
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:DoubleTap"), data));
}
void
AndroidBridge::HandleSingleTap(const nsIntPoint& aPoint)
{
// FIXME implement this
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:SingleTap"), data));
}
void
AndroidBridge::HandleLongTap(const nsIntPoint& aPoint)
{
// FIXME implement this
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:LongPress"), data));
}
void

View File

@ -516,6 +516,14 @@ public:
return event;
}
static AndroidGeckoEvent* MakeBroadcastEvent(const nsCString& topic, const nsCString& data) {
AndroidGeckoEvent* event = new AndroidGeckoEvent();
event->Init(BROADCAST);
CopyUTF8toUTF16(topic, event->mCharacters);
CopyUTF8toUTF16(data, event->mCharactersExtra);
return event;
}
int Action() { return mAction; }
int Type() { return mType; }
bool AckNeeded() { return mAckNeeded; }