summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosintegration.mm
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Change main-wrapper logic to not require changing the user's mainTor Arne Vestbø2013-09-111-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a define to rename the user's main() function during compilation, we leave the user code alone, and inject our wrapper one step earlier in the process, at the application entry point 'start'. This entry point is provided by crt1.o, which is normally linked into the application automatically. The start() function sets up some state and then calls main(), but we change the start() function to instead call our main wrapper. Instead of shipping our own crt1 binary/sources, we make a copy of the appropriate crt1.o at build time, and modify its symbol table in place. This is unproblematic as long as we keep the same length for the wrapper function name, as the symbol names are just entries in the global string table of the object file. The result is that for the regular Qt use-case the user won't see any changes to their main function, and we have more control over the startup sequence. For the hybrid use-case, we no longer rely on the fragile solution of having our back-up 'main' symbol in a single translation unit, which would break eg with --load_all, and we don't need to provide a dummy 'qt_user_main' symbol. OSX 10.8 and iOS 6.0 introduced a new load command called LC_MAIN, which places the state setup in the shared dyld, and then just calls main() directly. Once we bump the minimum deployment target to iOS 6.0 we can start using this loader instead of LC_UNIXTHREAD, but for now we force the classic loader using the -no_new_main flag. There's also a bug in the ld64 linker provided by the current Xcode toolchains that results in the -e linker flag (to set the entry point) having no effect, but hopefully this bug has been fixed (or Apple has switched to the LLVM lld linker) by the time we bump our deployment target. Change-Id: Ie0ba869c13ddc5277dc95c539aebaeb60e949dc2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Rename QIOSEventDispatcher to QEventDispatcherCoreFoundationTor Arne Vestbø2013-08-231-2/+2
| | | | | | | | | | Now that it lives in QPlatformSupport, will be fleshed out more, and might be used on OSX at some point in time. Still iOS specific, as none of the iOS API usages have been ifdef'ed. Change-Id: Ib7fde6403ef2dfef175a6f306a85d58027569a30 Reviewed-by: Ian Dean <ian@mediator-software.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: add support for new style hint: SetFocusOnTouchReleaseRichard Moe Gustavsen2013-06-251-0/+2
| | | | | Change-Id: I3ec2e2397d76f750f3263e67745aff082d253d15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add support for Qt::ApplicationStatesRichard Moe Gustavsen2013-06-251-0/+2
| | | | | Change-Id: I39858fe835c131d5c681db535f2ec9308e2f8223 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Move iOS event dispatcher from platform plugin to platform support.Ian Dean2013-06-131-1/+1
| | | | | | | | Move iOS event dispatcher from platform plugin to platform support, so that it can be used by multiple iOS platform plugins. Change-Id: I9041b2de5e00e5fe8f30af2dfd922b4f5c594802 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Set current directory to application bundle on startup.Ian Dean2013-05-271-0/+4
| | | | | | | | | Set the current directory to application bundle on startup. This allows Qt examples etc. that load resources from the deployment path to work correctly without modification. Change-Id: I5846de135c39d2158ee6c1ae21493739c3532239 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: don't delete m_touchDevice, QPA takes ownershipRichard Moe Gustavsen2013-04-221-5/+0
| | | | | | | | | | | | When registering m_touchDevice with QWindowSystemInterface, it will also transfer ownership to it. It will eventually be deleted in clenupDevicesList on qtouchdevice.cpp. This patch will also stop the app from crashing when telling it to quit. Change-Id: I97070efdf16b4db7d076935fbec62e60f094a7df Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Remove debug output noiseRichard Moe Gustavsen2013-02-271-3/+0
| | | | | | | | This debug information is not needed anymore, and only causes noise when trying to debug other stuff. Change-Id: I076826e251b84a3883e63aa7669f6e1bb55a0d1f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Add QIOSIntegration::hasCapability functionRichard Moe Gustavsen2013-02-271-0/+12
| | | | | | | | Add the missing override, and report that we support OpenGL (and multiple windows). Change-Id: If95138cab9099b547d12d3dfed008bd63b6d2acf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: implement QIOSWindow::winId()Richard Moe Gustavsen2013-02-271-1/+1
| | | | | Change-Id: I3dd7accae43bcf7d4d6dfd8b272ab65d67bd935c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Implement touch events.Morten Johan Sørvig2013-02-271-0/+11
| | | | | | | | | | | | | | | Track touch events during the standard [Began -> Moved -> Ended] event sequence based on the UITouch pointer which stays constant. Enable multiTouch on Qt's UIView. Mouse events should now be automatically created from (unhanded) touch events by QGuiApplication. Reviewed by: Ada Sørvig (fingerpaint app approved) Change-Id: I2aeb48c962c697d8b8337f8ceab062070c2a4240 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Make fusion style the default style on iOS, not the windows styleTor Arne Vestbø2013-02-271-0/+14
| | | | | Change-Id: I81b6049ff666bf23ac58d60e10d7c3d8713a19ea Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: add class QIOSInputContext (to handle keyboard)Richard Moe Gustavsen2013-02-271-0/+7
| | | | | | | | This change will add an initial implementation of the QPlatformInputContext for dealing with the keyboard. Change-Id: I29c1cfbbebb8456977b8a1db0e966973cd2c24a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Enable the ShowIsFullScreen style-hint so that show() implies fullscreenTor Arne Vestbø2013-02-271-0/+10
| | | | | | | | | | We may need to qualify this setting for UC2, so that the user may still create windows as sub-controls of a regular iOS user interface, but for UC1 it makes sense. Change-Id: I1a7019f901fabed8b5b9cbb18a929913780e6595 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: insert Digia license headersRichard Moe Gustavsen2013-02-271-24/+24
| | | | | | | Remove Nokia. Change-Id: Iec7095ef4e3099453b6103814e826039b377ecce Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Ensure UIApplicationMain is started before QApplication by wrapping main()Tor Arne Vestbø2013-02-271-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the typical Qt app the developer will have an existing main() that looks something like: int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); return app.exec(); } To support this, we provide our own 'main' function in the qtmain static library that we link into the application, which calls UIApplicationMain and redirects to the 'main' function of the application after the event loop has started spinning. For this to work, the applications 'main' function needs to manually be renamed 'qt_main' for now. In a later patch, this renaming will happen automatically by redefining main from either a header file, or more likely, from the Makefile created by qmake. For the case of an iOS developer wanting to use Qt in their existing app the main will look something like: int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } This is supported right now by just linking in libqios.a without libqiosmain.a. QGuiApplication should then be created e.g inside the native apps application delegate (but QGuiApplication::exec should not be called). In the future, we plan to but use a wrapper library that brings in all the Qt dependencies into one single static library. This library will not link against qtmain, so there won't be a symbol clash if the -ObjC linker option is used. We should then add the required magic to the future Objective-C convenience wrapper for QML to bring up a QGuiApplication, which would allow using Qt from storyboards and NIBs. This would also be the place to inject our own application delegate into the mix, while proxying the delegate callbacks to the user's application delegate. Change-Id: Iba5ade114b27216be8285f36100fd735a08b9d59 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Use default createPlatformPixmap implementationMorten Johan Sorvig2013-02-271-8/+0
| | | | | | | | No need to implement this one, the standard implementation creates a raster pixmap. Change-Id: I9bb25188bd95159d76e760b2be6870e0bede7b56 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Implement QIOSBackingStore in terms of a QOpenGLPaintDeviceTor Arne Vestbø2013-02-271-0/+1
| | | | | | | | | | | | | | | | We build on top of the QPlatformOpenGLContext implementation to get automatic support for QBackingStore-based painting. Since the OpenGL renderer does not clear the backingstore between frames, we actually also get support for partial updates, and we get the benefit of an accelerated paint engine for Qt Quick 1 without setting a GLWidget as the viewport, which would cause issues such as an extra QWindow. This patch also removes the dependency to QtOpenGL and QtWidgets, which were leftovers from the Qt4 platform plugin. In Qt5 the needed GL bits are in QtGui. Change-Id: Id9b736bfb2e4aec56c0fa9f5b7b4d8bff8e3d1dc Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Implement QPlatformOpenGLContextTor Arne Vestbø2013-02-271-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | The iOS platform GL context is an EAGLContext, which is wrapped by the new class QIOSContext. The class takes care of makeCurrent() and swapBuffers(), but defers framebuffer management to the corresponding QIOSWindow. At the moment only a single framebuffer is created, and changing the geometry of the QWindow does not trigger any sort of invalidation of the buffers. The implementation assumes OpenGL ES2.x support. Though strictly speaking we could support ES1 for QtGui, it serves little purpose as Qt Quick 2 requires ES2. This patch also disabled touch event synthesization until we have figured out where we will maintain the connection to UIWindow. QPlatformOpenGLContext::getProcAddress() for getting extensions is implemented by using dlsym() to look up the symbol. This should not present any issues for App Store deployment, like dlopen() would. Change-Id: I166f800f3ecc0d180133c590465371ac1642b0ec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Fix build on case sensitive filesystemsTor Arne Vestbø2013-02-271-1/+1
| | | | | Change-Id: Ic7a2b38ffcc2bd83e268c5caf5bec17006879969 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Add ability to get the UIView for a QWindow through ↵Tor Arne Vestbø2013-02-271-0/+20
| | | | | | | QPlatformNativeInterface Change-Id: Iab2742bbaa97ff345871ad07ef0162b12248506a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Style nitpicking, rename m_fontDb to m_fontDatabaseTor Arne Vestbø2013-02-271-2/+3
| | | | | Change-Id: I9d92843af9018d51b73fadcc7c20d792fad772fa Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Keep UIScreen* for current QIOSScreen instead of looking up each timeTor Arne Vestbø2013-02-271-1/+1
| | | | | | | Also, add enum for screen numbers, for better code readability. Change-Id: Id5162c34e80ff5efb149ae86b49f51df183d1c1d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Add screen like other platform pluginsTor Arne Vestbø2013-02-271-7/+2
| | | | | | | | | | We may add support for external displays at a later point, but for now we follow the same pattern as the other platform plugins. Either way we should call screenAdded() to let the platform integration know about the screen. Change-Id: Id01785a5262df0180caf957c7de8ecbbf169f233 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Get rid of singleton instance accessor in platform pluginTor Arne Vestbø2013-02-271-9/+0
| | | | | | | None of the other platform plugins have one, and it's not used anywhere. Change-Id: Id46ab5f75c9819511c3e9d123d0338c3c8799869 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Change member variable style to be consistent with Qt's de facto standardTor Arne Vestbø2013-02-271-4/+4
| | | | | Change-Id: Idd65ad9cbb77114466c5b69a799b98a7fee5068f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: copy brute-force port of Qt4 uikit plugin into Qt5.Richard Moe Gustavsen2013-02-261-0/+106
The plugin has been renamed from uikit to ios. Other than that, the plugin will now build, but do nothing. Most of the Qt4 code is preserved, with a rough translation into the Qt5 qpa API. A lot of code has simply been commented out so far, and most lacking at the moment is the event dispatcher which will need to be rewritten, and the opengl paint device implementation. But it should suffice as a starting ground. Also: The plugin will currently not automatically build when building Qt, this needs to be enabled from configure first. Change-Id: I0d229a453a8477618e06554655bffc5505203b44 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>