From 0dbee6a5e1e3945dab404f8784df24a9260f0d52 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Nov 2012 22:57:17 +0100 Subject: iOS: send mouse events (from touch events) from EAGLView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia6c955f2c5bcde8e41d5908bfb8fd52bd449b3ec Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.h | 3 +++ src/plugins/platforms/ios/qioswindow.mm | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/plugins/platforms/ios') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index d8f49db55b..c2bf1bb6f0 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -47,6 +47,7 @@ #import class QIOSContext; +class QIOSWindow; @interface EAGLView : UIView { @@ -57,8 +58,10 @@ class QIOSContext; UIKeyboardType keyboardType; UIReturnKeyType returnKeyType; BOOL secureTextEntry; + QIOSWindow *m_qioswindow; } +- (id)initWithQIOSWindow:(QIOSWindow *)qioswindow; - (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons; @property(nonatomic) UITextAutocapitalizationType autocapitalizationType; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 2888228f18..59508d83f3 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -58,6 +58,14 @@ return [CAEAGLLayer class]; } +-(id)initWithQIOSWindow:(QIOSWindow *)qioswindow +{ + if (self = [super init]) { + m_qioswindow = qioswindow; + } + return self; +} + - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { @@ -83,22 +91,13 @@ - (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons { - Q_UNUSED(touches); - Q_UNUSED(event); - Q_UNUSED(buttons); - - // FIXME: Reintroduce relation to UIWindow - qDebug() << __FUNCTION__ << "not implemented"; - -#if 0 UITouch *touch = [touches anyObject]; CGPoint locationInView = [touch locationInView:self]; CGFloat scaleFactor = [self contentScaleFactor]; QPoint p(locationInView.x * scaleFactor, locationInView.y * scaleFactor); // TODO handle global touch point? for status bar? - QWindowSystemInterface::handleMouseEvent(m_window->window(), (ulong)(event.timestamp*1000), p, p, buttons); -#endif + QWindowSystemInterface::handleMouseEvent(m_qioswindow->window(), (ulong)(event.timestamp*1000), p, p, buttons); } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event @@ -169,7 +168,7 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) - , m_view([[EAGLView alloc] init]) + , m_view([[EAGLView alloc] initWithQIOSWindow:this]) { UIApplication *uiApplication = [UIApplication sharedApplication]; if (uiApplication) { -- cgit v1.2.3