summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformscreen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: eradicate Q_FOREACH loops [needing qAsConst()]Marc Mutz2016-04-251-3/+3
| | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: I9158c507f9249a7322b11c982bfcab1e6ed4a38a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Android: eradicate Q_FOREACH loops [already const]Marc Mutz2016-04-251-4/+4
| | | | | | | | | ... (or trivially marked const) local variables, parameters, or data members with trivial loop bodies, by replacing them with C++11 range-for loops. Change-Id: I25e9e2148abd7676305ebd18754dc647f217e48b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Say hello to Android ServicesBogDan Vatra2016-02-171-0/+2
| | | | | | | | | | | | | | This changeset enables running a QCoreApplication from within an Android Service. The Android Application running can now have a QtActivity or a QtService, but having both in the same process is not supported. This patch was based on Cory Slep's patch [ChangeLog][Android] Qt can now be used to easily create Android Services. Task-number: QTBUG-37221 Change-Id: I0fd693daaa85b991940ffe9cc41c483022677199 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.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>
* Android: Activate Qt::Popup windowsBogDan Vatra2016-01-061-2/+6
| | | | | | | | | | On Android, back button will send a CloseEvent to the focused window. This change will activate (focus) the Popup windows when they'll become visible. Task-number: QTBUG-46419 Change-Id: I6787435b24502bbf9a78662a0c6fd159d4ee2e8d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Android: Add opt-in high-dpi supportMorten Johan Sørvig2015-10-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt-in by setting android.app.auto_screen_scale_factor to true in AndroidManifest.xml. This will enable devicePixelRatio scaling in QtGui using a scale factor provided by Android DisplayMetrics. Note that the Android style is not currently supported: it already accounts for different display densities which results in incorrect visual sizes when enabling devicePixelRatio scaling. Implementation: Bring DisplayMetrics::density through to setDisplayMetrics in androidjnimain.cpp, similar to what is done for "scaledDensity". Override QPlatformScreen::pixelDensity(), which forwards the scale factor to QtGui. [The difference between "density" and "scaledDensity" is that the former is a physical display density factor which corresponds closely to devicePixelRatio in Qt, while the latter also includes the Android global font scale factor.] Scale the global font pixel size in qandroidplatformtheme.cpp to keep the visual font size constant. Based on an initial patch from Daiwei Li <daiweili@suitabletech.com> Task-number: QTBUG-46615 Change-Id: Ia51f99bf6dda485a57413949246c7b32cb47e8dd Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Always release surfaces when application is suspended or hidden.Saytgalin Alexander2015-04-041-1/+1
| | | | | | | | | | | It is needed to recreate surfaces and to redraw when application is resumed because on some devices when the application is suspended Android destroys the surfaces. Change-Id: I8934e94af038b4ecf116d93aea223ad040b0bff1 Task-number: QTBUG-45019 Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Sergey Galin <s.galin@2gis.ru>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Android: Fix crash in QCompleter testEskil Abrahamsen Blomfeldt2015-01-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | The call to QPlatformWindow::setVisible() will trigger flushing of the window system events. Depending on the events, this could lead to the window being hidden. Since platformScreen()->addWindow() and removeWindow() was done *after* this flush, you could get the remove for a window before it had been added, whereas the logic in these functions were written under the assumption that there is exactly one remove per add, and that add always precedes the remove. This has only been seen when running the QCompleter test so far. This patch reorders the statements to make sure the events are flushed after the window stack has been updated. In addition, it adds asserts for the assumptions in the addWindow/removeWindow code to catch bugs there earlier. Change-Id: Ic67b03afbf7acbcb78be86bffa4c26360dc5832f Task-number: QTBUG-43836 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| * Fixes for surface creation/destructionBogDan Vatra2015-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - After reset a surface we must call makeCurrent before we are usign swapBuffers. - No need to set the surface in QPA when surfaceCreated are called in QtSurface.java, some time the OpenGL surface is not fully initialized at this stage. Is better to wait for surfaceChanged which is always fired at least once. - DO NOT reset m_surfaceId to 1 when there is no surface. The problem is that if we have one surface and when we distory it we don't (need to) wait for its surfaceChanged/surfaceDestroyed notifications, and if we create another one quicly it will have the same id (1). Task-number: QTBUG-39712 Change-Id: I2aa31e5b59d81ef3b03624d4636a4381eea6d543 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-101-5/+10
|\| | | | | | | | | | | | | | | Conflicts: doc/global/template/style/online.css mkspecs/android-g++/qmake.conf Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
| * Fix QOpenGLWidget/QQuickWidget GUI freezePaul Olav Tvete2014-12-051-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A window with a renderToTexture child uses the OpenGL path, but when we open a popup or dialog, that uses the raster compositor, which opens a separate surface. This patch fixes two issues when combining GL rendering with the raster compositor: 1. GL-rendered widgets were counted as part of the raster-rendered region, meaning that we did not punch a hole in the raster surface. 2. We did not destroy the surface when no longer needed. Task-number: QTBUG-41467 Change-Id: I2a2a0e860cce065b330df1c864d51fd02103aa1b Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com> Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-201-0/+4
|\| | | | | | | Change-Id: If7e51514ed6832750e3ad967e4d322ccf920d2bb
| * Android: deadlock avoidancePaul Olav Tvete2014-10-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds deadlock protection to all places where we lock one thread while waiting for the other to do something. If we detect that the other thread is going to block, we abort the operation. This could cause unexpected problems, such as painting errors, text input errors, or even crashes, but the alternative is a guaranteed deadlock. Task-number: QTBUG-41369 Change-Id: I2627a955cfafc4bce54eb9d0d38e19b768b06956 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-22/+13
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * qpa: Make screen geometry updates (full and available geometry) atomicTor Arne Vestbø2014-09-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating the geometry and available geometry in two steps means that QScreen will be in an inconsistent state when emitting the geometry change signal, as the available geometry has not been updated yet. Piggy-backing changes to the availableGeometry based on the virtual geometry changing does not make sense, so we now tie geometry and availableGeometry (and their size variants) to their own separate geometryChanged and availableGeometryChanged signals. Change-Id: Iee0ced642cbb91c470cb54bc507d2c0512482c13 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Android: use qEnvironmentVariableIntValue()Marc Mutz2014-09-121-1/+1
|/ | | | | | | | It doesn't allocate memory, so cannot throw and is a lot faster than qgetenv(). Change-Id: I6d79852613228658f9093a272edf9b434e60286c Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Support QOpenGLWidget and QQuickWidget on AndroidLaszlo Agocs2014-08-251-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | It gets somewhat complicated due to the fact that a RasterGLSurface window (i.e. any widget window since 5.3) may behave either like an OpenGLSurface or a RasterSurface, and the expected behavior may change on each backingstore sync. This does not fit designs where the platform window implementation is separated and there is different behavior for raster and GL windows. Therefore QAndroidPlatformOpenGLWindow is now made capable of behaving like the raster one, based on a flag communicated from the widget stack via QWindowPrivate (since the plugin knows nothing about widgets). This means that widget windows that do not have renderToTexture children (QOpenGLWidget, QQuickWidget) will go through the raster path, while the ones that have will behave like an OpenGL window with the actual rendering happening in QPlatformBackingStore::composeAndFlush(). The surface type is RasterGLSurface in both cases nonetheless. Task-number: QTBUG-37907 Change-Id: I6f9261fc0fd993afcda7f30d379c5410069033d3 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Make the expose region local on all platformsLaszlo Agocs2014-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | QExposeEvent::region() reports a region in a random coordinate system. The behavior is undocumented and the platform plugins do different things. xcb, offscreen and ios are correct. These set the region in local coordinates, which is the most logical interpretation of the expose region. windows is almost correct, except for one occurrence. cocoa and others need changes: passing in geometry() as the exposed region is always wrong. The patch documents the expected behavior both for QExposeEvent and internally in QWindowSystemInterface. The problematic plugins are fixed to use local coordinates. Task-number: QTBUG-40470 Change-Id: I6ded3154d14254fa71d4292d8e1b5e6cf696c81a Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Android: Release all windows when the application is suspended.BogDan Vatra2014-07-311-16/+33
| | | | | | | | | | | | | | When an application is suspended on Android all its Gl surfaces are destroyed and can't be used to render anymore, so we should release them in order to give back to the system the memory used by them. [ChangeLog] [Android] Release all windows when the application is suspended. Task-number: QTBUG-29069 Change-Id: I038aaa2006da1f3188fccba943ec4ffb3e551cf0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-011-10/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-x86-qcc/qplatformdefs.h src/corelib/global/qglobal.h src/network/socket/qnativesocketengine_winrt.cpp src/plugins/platforms/android/androidjniaccessibility.cpp src/plugins/platforms/windows/qwindowswindow.cpp Manually adjusted: mkspecs/qnx-armle-v7-qcc/qplatformdefs.h to include 9ce697f2d54be6d94381c72af28dda79cbc027d4 Thanks goes to Sergio for the qnx mkspecs adjustments. Change-Id: I53b1fd6bc5bc884e5ee2c2b84975f58171a1cb8e
| * Android: REG: Fix crash.BogDan Vatra2014-06-151-3/+5
| | | | | | | | | | | | | | Test if the window has a handle before using it. Change-Id: I728a129722f8ecd021998d483530a8d1687e5fe3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
| * Android: Report something sensible for screen geometryEskil Abrahamsen Blomfeldt2014-06-131-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't get the actual screen geometry on Android, but in Qt 5.3.0 we would always return the screen geometry minus the size of the status bar. After the available geometry was initialized to 0x0 instead of this arbitrary value, some applications that depended on this as a constant value would break if they collected the information before the window surface had been initialized and they forgot to listen to QScreen::geometryChanged(). To reduce the risk of regressions, this patch makes sure we return the same thing as before for the screen geometry and that this is not linked directly to the available screen geometry. Task-number: QTBUG-39464 Change-Id: Ie63337b3b10d2eb5130e4fece6c5b144e8230164 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵J-P Nurmi2014-06-071-0/+15
|\| | | | | | | refs/staging/dev
| * Android: Fix flashing on startup/shutdownEskil Abrahamsen Blomfeldt2014-06-041-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were several issues on startup of the application which were caused by the fact that we would get the wrong available screen geometry on startup, set this as the initial surface size and then expose native windows with this size. This would cause first a flicker of white on the early expose and the window contents to jump around as the window was resized to the actual available space on screen. The fix for this is to postpone the first expose until we have actually got a proper screen size from the main layout. We use width,height = 0 as an indicator that the available geometry is not yet known, and we skip posting any expose events before this is set by the layout. In addition, since we removed the surface before we shut down the application, it was by a white rectangle before the shutdown transition happens, and this white rectangle will be animated instead of application contents. To rectify this, we make sure the last surface in the stack remains in the layout until it is either replaced by a different surface or until the application has shut down. This way, the shutdown animation will work on this surface instead. [ChangeLog][Android] Fixed regression where there would be flickering on startup and shutdown of the application. Task-number: QTBUG-38960 Change-Id: Ia1579ca8c522d8beeab066f78070ad49009d0238 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Android: Rename image method to toImage.BogDan Vatra2014-06-051-1/+1
|/ | | | | | | | | | toImage is a virtual method declared in QPlatformBackingStore and is useful when you need to access the image buffer from outside the QPA plugin. (e.g. you can use QPlatformBackingStore::toImage().save("bs.png") to save it). Change-Id: I7cc70ed295070707ed0ef3ce208129f174f68cfb Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Don't create screen surface if there are no raster windows.BogDan Vatra2014-03-271-2/+11
| | | | | | Change-Id: Idaf5df814bb087707654d7ad7046ba8799f99c0a Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Make full use of QT_ANDROID_RASTER_IMAGE_DEPTH env variable.BogDan Vatra2014-02-221-1/+1
| | | | | | | | If raster only apps set QT_ANDROID_RASTER_IMAGE_DEPTH to 16 (RGB16), we should create also RGB16 native surface. Change-Id: I82692ff34b0e604e627d1d86a437272e3700daf8 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Start the chronometer.BogDan Vatra2014-02-211-0/+1
| | | | | Change-Id: Ia165ce4a79b108ddb0d74a7d8fccd4f48fe14442 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix paint artifacts.BogDan Vatra2014-02-211-30/+26
| | | | | | | | Android is using double buffering, so, we need to repaint the bounding rect of the repaint region, otherwise black holes will appear. Change-Id: I21f36a6f5f1a6c64b605c0fef3af10dfdc5ec6e2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Force surface repaint after is (re)created.BogDan Vatra2014-02-071-0/+1
| | | | | | | | | Every time when a surface is (re)created we must paint something in it otherwise it will appear black. Task-number: QTBUG-36594 Change-Id: Ib4baaef189f59a83a251cf89db30b0a3aec16d92 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Disable the rendering profilingBogDan Vatra2014-01-311-2/+5
| | | | | Change-Id: Ia2d6216104c66a4b2e7bfb36418c13eaa51f55e9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Don't add/remove/lower/raise children windows to the TLW stack.BogDan Vatra2014-01-311-0/+12
| | | | | Change-Id: I4fe6b05fe2a7d6de7c8ecaf9934fd8e285b2c64e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix repaint of transparent images.BogDan Vatra2014-01-311-60/+44
| | | | | | | Remove the native bitmap and paint directly on the surface instead. Change-Id: Ie7010d97aa934a170c079de549903fc3391df4d9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Support multiple native surfaces on Android.BogDan Vatra2014-01-171-0/+352
Support for multiple native surfaces is needed by applications that need to mix raster windows with GL windows. Rework the raster and opengl implementation, get rid of eglfs and fbconvenience dependencies. Create a single android platform plugin. [ChangeLog][Android] Rework the raster and opengl implementation. [ChangeLog][Android] Create a single android platform plugin. Task-number: QTBUG-34650 Change-Id: I9b1ab51554823329dda8cfbf8fef27c38f917c7b Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>