summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.mm
Commit message (Collapse)AuthorAgeFilesLines
* port to modularized platformsupport librariesOswald Buddenhagen2016-10-151-1/+1
| | | | | Change-Id: I20eb0e33abfd70b6a5240e7b6b0aa0425f2d2ee7 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* macOS: Rename m_contentView to m_view, to distinguish from [NSWindow ↵Tor Arne Vestbø2016-10-051-1/+1
| | | | | | | | | | | | | | contentView] The contentView is the root view of a NSWindow, but our m_contentView is just the corresponding NSView of a QWindow, and doesn't always match the contentView property of the NSWindow. This is part of a multi part cleanup to the Cocoa platform plugin in preparation for improved foreign-window support. Change-Id: Ifaffb12f35544ec05e4a83964b346b47fa4b0576 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-211-0/+5
|\ | | | | | | Change-Id: I9cfefaf22b010fca937be77979f5fb50574bb71e
| * Update swap interval of QCocoaGLContext after creationTor Arne Vestbø2016-09-191-0/+5
| | | | | | | | | | | | | | | | | | QSurfaceFormat is recreated from scratch, and by not reading back the swap interval the QCocoaGLContext seemed to be vsynced even if it actually was not. Change-Id: I72ddaae9a4c695fe4c74d7b4b70ca9db84bcc084 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-051-1/+9
|\| | | | | | | | | | | | | Conflicts: tests/auto/testlib/selftests/generate_expected_output.py Change-Id: If856162abf9a24ae2c9946d336a7d1da03520fa7
| * Cocoa: Add support for triple-buffered GL contextsTor Arne Vestbø2016-08-291-1/+9
| | | | | | | | | | | | | | | | | | As usual, the requested format may not be available, so clients should check the actual format to confirm triple-buffering. Change-Id: Icf073cc9ddf2c912eb5c3ce0ac80d1694d1c56d7 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Simplify and speed up code resolving gl functionsLars Knoll2016-03-021-1/+2
| | | | | | | | | | Change-Id: I36d8881b658760dde18e4f52742c49f3c0cab7a5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Avoid repeated QByteArray creation when resolving opengl functionsLars Knoll2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-09-251-5/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/io.pri src/corelib/io/qdatastream.cpp src/corelib/io/qdatastream.h src/network/socket/qabstractsocket.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h src/widgets/styles/qgtkstyle.cpp tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro tests/auto/dbus/qdbusconnection/qdbusconnection.pro tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp Change-Id: I347549a024eb5bfa986699e0a11f96cc55c797a7
| * Cocoa: Clean up context creation.Morten Johan Sørvig2015-09-021-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Make the fallback to creating an unshared context actually work by using correct [initWithFormat: ] code. Warn and return early on context creation failure instead of continuing and crashing. Change-Id: Ic88f419eaa717436aefc9c1da36c47e0ccb3e956 Task-number: QTBUG-47825 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Link to AppKit instead of Cocoa.Jake Petroules2015-09-051-1/+1
|/ | | | | | | | | | | | | Cocoa is basically just AppKit + CoreData. Since we do not use CoreData in Qt, there is no reason to link to it or (transitively) import its headers. This is just a mechanical replacement of -framework Cocoa with -framework AppKit and <Cocoa/Cocoa.h> with <AppKit/AppKit.h> Change-Id: Ibcfc8a03c0ddff27a67fbc87dd7bd58a4b648956 Reviewed-by: Mika Lindqvist <postmaster@raasu.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Add shared implementation of a NSAutoreleasePool wrapper to qglobalTor Arne Vestbø2015-05-271-3/+2
| | | | | | | | | | | We have at least 5 different (but equal) implementations of a wrapper in Qt, and some code uses explicit NSAutoreleasePools. Having a shared implementation lets us clean up things a bit and makes it easier to reason about which pools are actually needed. Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fixed compilation on Mac OS X (qt namespace and preprocessor issues))Sergei Kulik2015-03-201-0/+5
| | | | | | | | Configured with -qtnamespace <...> -no-opengl -D QT_NO_PRINTER Change-Id: I1c959a89afda08d29a854f21e6e51732d136753c Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Support adapting an existing NSOpenGLContext in cocoaLaszlo Agocs2014-06-251-1/+29
| | | | | Change-Id: I61b4055020c82dd5ac40850fe7def91d26ffb6fe Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Enable QQuickWidget on Mac OS X.Morten Johan Sørvig2014-03-201-1/+1
| | | | | Change-Id: I0635bf0bfcd49c20987a81c6f8895fc3343fbd20 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Cocoa: Clear GL context pointer on deletion.Morten Johan Sørvig2014-02-251-0/+3
| | | | | | | | | | | | | | | The QGLWidget destructor sequence is such that the GL context will be deleted before the window is hidden. This would leave QCocoaWindow with a stale m_glContext pointer. Clear QCocoaWindow's context pointer on context deletion. Task-number: QTBUG-36820 Change-Id: I710e3813f9ce90ddd37ad7b406693f0c58a1436d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Cocoa: Option handling.Morten Johan Sørvig2014-02-081-0/+6
| | | | | | | | | | | | | | | | | | | | Add qt_mac_resolveOption(). Support setting options using either an environment variable or a QWindow property, with a default fallback value. The options are resolved with precedence in the mentioned order. Adds options for the following: NSView setWantsBestResolutionOPenGLSurface NSVIew setWantsLayer NSOpenGLContext NSOpenGLCPSurfaceOrder The window properties use the _q_mac_camelCase format. The environment variables use the QT_MAC_ALL_CAPS format. Change-Id: I1978a02d62e107a2120d81ffdd0f7b32f7731644 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-161-2/+0
|\ | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qplatformtheme.h tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp Change-Id: Iecd3343d6a050b8764f78d809c4a1532aeba69e5
| * Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-051-2/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/macx-ios-clang/features/default_post.prf tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp Change-Id: Iaba97eed2272bccf54289640b8197d40e22f7bf5
| | * Revert "Cocoa (OpenGL): If no view is attached, makeCurrent() should return ↵Morten Johan Sørvig2013-12-041-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | false" This reverts commit 2eb1e28a90eaf82f4405dc65584021f16415014b, which makes several of the OpenGL examples crash on startup. (textures, hellogl_es2) Change-Id: Id47d2df6f57b2396c333e478b3c062f4cb4becb5 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* | | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-051-0/+10
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/sql/drivers/sqlite/qsql_sqlite.cpp Change-Id: Ia7cffd2c99ae3d5eea6b5740683c06e921336dcd
| * | Clear QCocoaGLContext's m_currentWindow when window is hidden.Gunnar Sletta2013-12-051-0/+10
| |/ | | | | | | | | | | Task-number: QTBUG-35363 Change-Id: I1b3d883ed10200af8a2d4188fb1725b36eb78022 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* / cocoa: Use swapInterval from QSurfaceFormatLaszlo Agocs2013-11-291-1/+1
|/ | | | | | | | | | xcb and windows already do this. The default value is 1 so the behavior on cocoa does not change when setSwapInterval() is not called. Task-number: QTBUG-31939 Change-Id: Id9d9204c9324f1cc187c6aee4286e7da42583759 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Remove stray debug outputLars Knoll2013-11-151-1/+0
| | | | | | | | This was actually causing test failures in qtdeclarative and blocking the CI there. Change-Id: I4538342f16b6468ad60b283c19948863b20ad5d4 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update QSurfaceFormat when creating a GL context in the cocoa qpaSean Harmer2013-11-141-0/+139
| | | | | | Task-number: QTBUG-34471 Change-Id: I99f643280b8a4aaa8d63329232c0c3f4b2faed4b Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Cocoa (OpenGL): If no view is attached, makeCurrent() should return falseGabriel de Dietrich2013-11-051-0/+2
| | | | | Change-Id: Ie2869fae1549c3b0a8ef78702410e6ca0c980737 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Fix Open GL resolution in high-dpiGabriel de Dietrich2013-05-151-12/+0
| | | | | | | | | | | | We permanently enable 'wantsBestResolutionOpenGLSurface' when creating an Open GL window/surface. We were enabling it once we would detect a high-dpi Cocoa backend, whitout ever turning it off. Leaving it 'on' on non-high-dpi displays should not change anything. Task-number: QTBUG-31000 Change-Id: I3d0c77f7b36f3c22dacd04a50fcc5a7d88af32c0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Make toplevel transparent windows work on Mac OS XGunnar Sletta2013-02-231-0/+4
| | | | | | | | | | | | | | This patch includes a few different fixes to make transparent toplevels work on cocoa. - When setting alpha on the toplevel, it also needs setOpaque:NO - The OpenGL context needs a separate flag for this to work. - Make sure setOpaque fighting between setMask, setFormat and setOpacity ends up correctly Task-number: QTBUG-28214 Change-Id: Ic3a2d71193bb653e181c98787b4ebda002424092 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Enforce OpenGL context creation under CocoaGiuseppe D'Angelo2013-02-231-2/+10
| | | | | | | | We don't support other context types, so fail in those cases. Also, return OpenGL as the rendereable type of our surface. Change-Id: I3d5632eb8555d73ed14837b662c7450589a8681f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Properly release pixel format and context in QCocoaGLContext.Zeno Albisser2012-12-011-0/+7
| | | | | Change-Id: Idd13924dccc8d7798f463484eeb3c3074f7b51f1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Basic high-dpi "retina" support for Qt 5.Morten Johan Sørvig2012-12-011-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Bring Qt 5 on par with Qt 4, prepare for more comprehensive support later on. Introduce device independent pixels (dips), device pixels, and devicePixelRatio. Add high-dpi support to QPainter, QGLWidget, the cocoa platform plugin, mac and fusion styles. Dips are similar to CSS pixels, Apple points and Android density-independent pixels. Device pixels are pixels in the backing store/physical pixels on screen. devicePixelRatio is the ratio between them, which is 1.0 on standard displays and 2.0 on "retina" displays. New API: QImage::devicePixelRatio() and setDevicePixelRatio() QPixmap::devicePixelRatio() and setDevicePixelRatio() QWindow::devicePixelRatio() QScreen::devicePixelRatio() QGuiApplicaiton::devicePixelRatio() Change-Id: If98c3ca9bfdf0e1bdbcf7574cd5b912c9ff63856 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Cocoa: update OpenGL viewport when nsview movesRichard Moe Gustavsen2012-11-281-2/+1
| | | | | | | | | | | | | | | | | | NSOpenGLContext expexts an -update call whenever the physical position of the view it draws to changes on screen. Since we don't get geometry callbacks for such views when the parent view moves, we need to register a special notification for that case, and tell Qt that we need to repaint the QWindow that the view is backing. This case does not hit very often, but is evident in MDI applications where the subwindows are OpenGL backed QGraphicsView widgets. Dragging the subwindows around produces garbage inside the windows. Change-Id: I1b162470b03cca6ed722c6c54080459f2c5e91d9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Cocoa GL context: do not crash when closing windowsLaszlo Agocs2012-09-201-2/+2
| | | | | | | | | Running hellowindow and closing its windows one by one would result in crashes without the additional checks for the presence of the underlying native window. Change-Id: Id32bdfda9a77936380b2e9a95fb56ceb52028d9d Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Verify the surfaceType before activating the GL contextHolger Hans Peter Freyther2012-06-051-0/+2
| | | | | | | | | | | | Verify that the surfaceType() of the QPlatformContext is of type OpenGLSurface before making the context active. Make it possible to get the QSurface from a QPlatformSurface, make QPlatformWindow use that to access the QWindow. Remove the setSurfaceType call from the eglfs plugin as this hiding a problem. Change-Id: I08906da052e066bb1f1f042030643c6389ab17d7 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
* Implement isSharing() and isValid() methods for QCocoaGLContextTeemu Katajisto2012-02-251-3/+18
| | | | | | | | | | | | | | Shared resources may have been used when initializing NSOpenGLContext but QCocoaGLContext did not implement isSharing(). This caused default implementation to return false always and therefore shared resource test case failed. Implemented also another missing method, isValid(). Task-number: QTBUG-23061 Change-Id: Ia912450035b584ea90a02a7d88d6ae531c3cbadf Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Make cocoa opengl backend threadsafe.Gunnar Sletta2011-11-251-0/+1
| | | | | | | | | | The current implementation on Mac OS X called update() inside the cocoa plugin from the GUI thread, which breaks when trying to use the GL context from another thread and the window gets resized. We now only call it from makeCurrent() Change-Id: I025aad3a3b140e85e729816bf3b68827337cc80d Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Respect the QSurfaceFormat when constructing a QOpenGLContext on MacGunnar Sletta2011-09-271-3/+3
| | | | | | | Change-Id: I1a17d2e7e060d9931d84afeb0fd42bc3b1f44e5d Reviewed-on: http://codereview.qt-project.org/5527 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Fix missing/incorrect license headersJason McDonald2011-09-151-0/+41
| | | | | | | Change-Id: I9db33c63c951f288f7a106c3008771699662d104 Reviewed-on: http://codereview.qt-project.org/4852 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cocoa: Make the hellowindow opengl example work.Morten Sorvig2011-08-301-1/+3
| | | | | | | | | | | | | | | You're not supposed to use NSOpenGLView and NSOpenGLContext at the same time - it's one or the other. Qmlscene worked because it was hitting the raster path that doesn't have a NSOpenGLView. Remove the NSOpenGLView path and m_windowSurfaceView. Change-Id: I10358851a94cd1780a312af09bbb7cf5db8f984f Reviewed-on: http://codereview.qt.nokia.com/3862 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Copy core GL functionality to QtGui with QGL -> QOpenGL naming.Samuel Rødal2011-08-291-1/+1
| | | | | | Change-Id: Ibc989afa4a30dd184d41d1a1cd89f97196e48855 Reviewed-on: http://codereview.qt.nokia.com/3710 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Enable multisampling and swap interval by default on cocoaGunnar Sletta2011-08-181-0/+4
| | | | | | | Change-Id: If3d1939e6196f5aa6654645d20dab7ad251046fa Reviewed-on: http://codereview.qt.nokia.com/3138 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Remove autorelease warnings from qmlscene.Morten Sorvig2011-08-181-0/+3
| | | | | | | | | | | The SG Canvas render thread was creating a QCocoaGLContext without an autorelease pool in place. Change-Id: I08882f42efdf905107497e8be21f2a2d20c3c4cf Reviewed-on: http://codereview.qt.nokia.com/2911 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>