Multitouch fix

This commit is contained in:
Joshua Granick
2013-12-01 12:31:22 -08:00
parent 94c01f1cb1
commit c7d151e9f8
3 changed files with 56 additions and 6 deletions

View File

@@ -19,8 +19,11 @@ namespace lime {
void Flip ();
void GetMouse ();
bool getMultitouchSupported ();
bool getMultitouchActive ();
void Resize (const int inWidth, const int inHeight);
void SetCursor (Cursor inCursor);
void setMultitouchActive (bool inActive);
Surface *GetPrimarySurface () { return mPrimarySurface; }
bool isOpenGL () const { return true; }

View File

@@ -8,6 +8,7 @@ namespace lime {
int gFixedOrientation = -1;
int mSingleTouchID;
FrameCreationCallback sgCallback;
unsigned int sgFlags;
int sgHeight;
@@ -15,6 +16,8 @@ namespace lime {
TizenFrame *sgTizenFrame;
int sgWidth;
enum { NO_TOUCH = -1 };
void CreateMainFrame (FrameCreationCallback inOnFrame, int inWidth, int inHeight, unsigned int inFlags, const char *inTitle, Surface *inIcon) {
@@ -24,6 +27,8 @@ namespace lime {
sgFlags = inFlags;
sgTitle = inTitle;
mSingleTouchID = NO_TOUCH;
//if (sgWidth == 0 && sgHeight == 0) {
// Hard-code screen size for now
@@ -233,9 +238,14 @@ namespace lime {
void TizenApplication::OnTouchMoved (const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo) {
Event mouse (etMouseMove, currentPosition.x, currentPosition.y);
Event mouse (etTouchMove, currentPosition.x, currentPosition.y);
mouse.value = touchInfo.GetPointId ();
mouse.flags |= efLeftDown;
if (mSingleTouchID == NO_TOUCH || mouse.value == mSingleTouchID) {
mouse.flags |= efPrimaryTouch;
}
sgTizenFrame->HandleEvent (mouse);
@@ -244,9 +254,14 @@ namespace lime {
void TizenApplication::OnTouchPressed (const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo) {
Event mouse (etMouseDown, currentPosition.x, currentPosition.y);
Event mouse (etTouchBegin, currentPosition.x, currentPosition.y);
mouse.value = touchInfo.GetPointId ();
mouse.flags |= efLeftDown;
if (mSingleTouchID == NO_TOUCH || mouse.value == mSingleTouchID) {
mouse.flags |= efPrimaryTouch;
}
sgTizenFrame->HandleEvent (mouse);
@@ -255,9 +270,20 @@ namespace lime {
void TizenApplication::OnTouchReleased (const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo) {
Event mouse (etMouseUp, currentPosition.x, currentPosition.y);
Event mouse (etTouchEnd, currentPosition.x, currentPosition.y);
mouse.value = touchInfo.GetPointId ();
mouse.flags |= efLeftDown;
if (mSingleTouchID == NO_TOUCH || mouse.value == mSingleTouchID) {
mouse.flags |= efPrimaryTouch;
}
if (mSingleTouchID == mouse.value) {
mSingleTouchID = NO_TOUCH;
}
sgTizenFrame->HandleEvent (mouse);

View File

@@ -64,6 +64,20 @@ namespace lime {
void TizenStage::GetMouse () {}
bool TizenStage::getMultitouchSupported () {
return true;
}
bool TizenStage::getMultitouchActive () {
//return mMultiTouch;
return true;
}
void TizenStage::Resize (const int inWidth, const int inHeight) {
AppLog ("Resize: %d x %d\n", inWidth, inHeight);
@@ -109,6 +123,13 @@ namespace lime {
}
void TizenStage::setMultitouchActive (bool inActive) {
//mMultiTouch = inActive;
}
/*#define TIZEN_TRANS(x) case TIZEN_KEY_##x: return key##x;