summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-11-07 22:57:17 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:39 +0100
commit0dbee6a5e1e3945dab404f8784df24a9260f0d52 (patch)
treea1b6dbae9776e88713aefcb84fd8cecb6040f498 /src
parentea1e5ccd621115d8103ceac962ac89dc0db65b70 (diff)
iOS: send mouse events (from touch events) from EAGLView
Change-Id: Ia6c955f2c5bcde8e41d5908bfb8fd52bd449b3ec Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qioswindow.h3
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm21
2 files changed, 13 insertions, 11 deletions
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 <UIKit/UIKit.h>
class QIOSContext;
+class QIOSWindow;
@interface EAGLView : UIView <UIKeyInput>
{
@@ -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) {