From Stephan Huber, "attached you’ll find a bunch of fixes + enhancements for iOS and OS X based on current trunk. I incorporated + tested the submission from Colin Cochran, so his submission is not needed anymore.

* fixed a bug with multi-touch and touch-id-generation on iOS and OS X. (will fix a bug reported by Colin Cochran, without ditching the existing logic)
* removed unnecessary warning-flagss when generating xcode-projects via cmake, will enable the usage of OSG_AGGRESSIVE_WARNING_FLAGS
* added support for 10.9 (OS X)
* new cmake-variable: IPHONE_VERSION_MIN, this will set the deployment-target (previously hard-coded) If you set the IPHONE_VERSION_MIN to something like 7.0 osg gets compiled also for 64bit (amd64)
* cmake defaults now to the clang compiler if IPHONE_VERSION_MIN > 4.2
* cmake now sets some xcode-settings so the compiler uses the c++98-standard (clang defaults to c++11, w/o this I got a lot of linking errors)
* removed include-dir for avfoundation-plugin as not needed on OSX/IOS.
* enhanced the ios-example, will now show multitouch-information on a hud (similar to the  osgmultitouch-example), and more importantly, will compile + link out of the box
* small enhancements for the osc-device-plugin (send only one msg for MOVE/DRAG, even if multiple msgs/event is enabled)
* better memory-handling for the zeroconf-plugin
* fixed a possible bug in the rest-http-plugin when receiving mouse-events.
* incorporated a fix from Colin Cochran "forwarded touch events are not transformed into the GL UIView“
"
This commit is contained in:
Robert Osfield
2013-10-07 10:38:58 +00:00
parent 320c51aa96
commit 2f71509ebf
14 changed files with 378 additions and 176 deletions

View File

@@ -312,7 +312,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
- (osgGA::GUIEventAdapter::TouchPhase) convertTouchPhase: (NSTouchPhase) phase;
- (unsigned int)computeTouchId: (NSTouch*) touch;
- (unsigned int)computeTouchId: (NSTouch*) touch mayCleanup: (BOOL) may_cleanup;
- (void)touchesBeganWithEvent:(NSEvent *)event;
- (void)touchesMovedWithEvent:(NSEvent *)event;
- (void)touchesEndedWithEvent:(NSEvent *)event;
@@ -813,7 +813,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
}
- (unsigned int)computeTouchId: (NSTouch*) touch
- (unsigned int)computeTouchId: (NSTouch*) touch mayCleanup: (BOOL) may_cleanup
{
unsigned int result(0);
@@ -847,7 +847,8 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
{
NSNumber* n = [_touchPoints objectForKey: [touch identity]];
result = [n intValue];
[_touchPoints removeObjectForKey: [touch identity]];
if(may_cleanup)
[_touchPoints removeObjectForKey: [touch identity]];
if([_touchPoints count] == 0) {
_lastTouchPointId = 0;
}
@@ -876,7 +877,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1-pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup:FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchBegan(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
} else {
@@ -897,7 +898,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1 - pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup:FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchMoved(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
} else {
@@ -919,7 +920,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1 - pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup: TRUE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchEnded(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y(), 1);
} else {

View File

@@ -163,7 +163,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
}
- (unsigned int)computeTouchId: (UITouch*) touch
- (unsigned int)computeTouchId: (UITouch*) touch mayCleanup: (bool)may_cleanup
{
unsigned int result(0);
@@ -202,10 +202,10 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
{
TouchPointsIdMapping::iterator itr = _touchPointsIdMapping->find(touch);
// std::cout<< "remove: " << touch << " num: " << _touchPointsIdMapping->size() << " found: " << (itr != _touchPointsIdMapping->end()) << std::endl;
if (itr != _touchPointsIdMapping->end()) {
result = itr->second;
_touchPointsIdMapping->erase(itr);
if(may_cleanup)
_touchPointsIdMapping->erase(itr);
}
if(_touchPointsIdMapping->size() == 0) {
_lastTouchPointId = 0;
@@ -576,9 +576,9 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
{
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
CGPoint pos = [touch locationInView:touch.view];
CGPoint pos = [touch locationInView:self];
osg::Vec2 pixelPos = [self convertPointToPixel: osg::Vec2(pos.x,pos.y)];
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup: FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchBegan(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
@@ -599,9 +599,9 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
for(int i=0; i<[allTouches count]; i++)
{
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
CGPoint pos = [touch locationInView:touch.view];
CGPoint pos = [touch locationInView:self];
osg::Vec2 pixelPos = [self convertPointToPixel: osg::Vec2(pos.x,pos.y)];
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup: FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchMoved(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
@@ -623,9 +623,9 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
for(int i=0; i<[allTouches count]; i++)
{
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
CGPoint pos = [touch locationInView:touch.view];
CGPoint pos = [touch locationInView:self];
osg::Vec2 pixelPos = [self convertPointToPixel: osg::Vec2(pos.x,pos.y)];
unsigned int touch_id = [self computeTouchId: touch];
unsigned int touch_id = [self computeTouchId: touch mayCleanup: TRUE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchEnded(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y(), [touch tapCount]);
} else {