summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_winrt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Optimize QEventDispatcherWinRT::runOnMainThread()Marc Mutz2019-09-051-11/+12
| | | | | | | | | | | | | | | | - use std::make_shared instead of QSharedPointer - two memory allocations saved - co-locate semaphore and HRESULT object in a single State object - one more memory allocation saved - pass the shared_ptr<State> by value into the runnable - two more memory allocations saved Not only is the new code much faster, it's also much more readable. Also use QSemaphoreReleaser, just in case the delegate should throw. Change-Id: Ib99b9da86984d440d10b72e3071aa88099e24a1f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* WinRT: Add Windows UI Automation supportAndre de la Rocha2018-04-171-0/+22
| | | | | | | | | | | | | Adds support to accessibility tools and programmatic UI control to the WinRT platform through Windows UI Automation, using the AutomationPeer API. [ChangeLog][winrt][feature] Added support to Windows UI Automation to the WinRT QPA, allowing Qt-based UWP applications to operate with accessibility and programmatic UI control tools. Change-Id: If0a8edbebc7c16c4896d749f2d7e11809b4b37b3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* winrt: Check for removed timers after sending eventsOliver Wolff2016-11-301-4/+7
| | | | | | | | | | | | | | | | After all the check makes sense here. If a timer was removed as a result of sendEvent and it was not at the end of the list the list is not shrunk but the timer info's id is just set to INVALID_TIMER_ID. Additionally the timer's object should be fetched before we unlock the locker as timerIdToObject is changed in removeTimer and we might access a nullptr if the timer has been removed. Reverts c83ba01f7bc542368973f3f24dfb59c6052dd78a Task-number: QTBUG-56756 Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-10/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-10/+23
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| | * winrt: remove superfluous codeMaurice Kalinowski2016-11-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not need to check for an invalid timer id, as this can only happen if the above check is already true. Hence, this was doing the same check twice. Task-number: QTBUG-56756 Change-Id: Icca9b26c32ce88eab76dd02c6c10b24af07bfad7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| | * winrt: Do not copy into a referenceMaurice Kalinowski2016-11-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The intention has probably been to reset a reference, which is not required. Task-number: QTBUG-56756 Change-Id: I1ef44b6c9b8365ac5c8d48234137e518558e9398 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| | * winrt: Fix potential memory corruptionMaurice Kalinowski2016-11-081-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timerInfo list might get accessed concurrently and cause references to become dangling. Hence, we need to protect usages with a mutex. According to tests/benchmark there is no impact on performance. Task-number: QTBUG-56756 Change-Id: I4bdffccff70d2dca99f4a39defad438afe571ada Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | winrt: Fix launch as background taskMaurice Kalinowski2016-07-061-27/+86
|/ / | | | | | | | | | | | | | | | | | | | | | | In case a background task wants to use Qt, winmain is not invoked. Neither can we create the same objects like winmain do (as in creating a application view). Instead runOnXamlThread uses the thread pool enabling the event loop to run successfully. Task-number: QTBUG-54396 Change-Id: Ia3ba23ed0fd6cd7d2ed8d43675e88073b9aec8b5 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-251-2/+29
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test configure src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java src/corelib/global/qglobal.cpp src/widgets/kernel/qapplication.cpp src/widgets/styles/qwindowsvistastyle.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp Change-Id: I067083f34e5290aa5f7565e40c30a069cc37b83a
| * winrt: Try to acquire CoreDispatcher from multiple sourcesMaurice Kalinowski2016-04-131-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the system launches the application via different activation mode (eg. app registered for sharing) no main window will be created. Hence accessing the core window will return null and event dispatcher initialization will fail. In that case iterate through all available views and try to get access to their dispatcher to be able to invoke code on the xaml thread. Task-number: QTBUG-49276 Change-Id: I8c78baa27747a0465ff7a1b2ead6c9e03f0e05a8 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-5/+5
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * winrt: process all triggered timers in processEventsOliver Wolff2016-03-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | If only one timer is processed in there it is possible that a reoccuring timer which has a very low timeout blocks all the other timers from being triggered. This high frequency timer might be the only one to be triggered in every processEvents call. Task-number: QTBUG-51888 Change-Id: I8a0026d1e8519171ab60d1b47c494a15d30328b3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@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>
* | QtCore: eradicate all Q_FOREACH loops [kernel]Marc Mutz2016-01-121-2/+3
|/ | | | | | | | Saves just 168b in text size on optimized GCC 4.9 Linux AMD64 builds, but most for loops are in non-Linux code. Change-Id: I4f20a65c2e4953011308ff831c9e8fa37a25274b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* winrt: Avoid blocking for the first processEvents runMaurice Kalinowski2015-12-141-2/+11
| | | | | | | | | | When calling WaitForMultipleObjectsEx, do not use a timeout for the initial call. This saves around 10% of blocking invocations in the QEventLoop autotests. Change-Id: Ib24436ed11de1865e31f9ff0ddf6ce1bc5562f42 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com> Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* winrt: Don't wait for runOnXamlThread to finish for timers.Samuel Nevala2015-11-041-12/+14
| | | | | | | | | Fixes possible deadlock that occurs when synchronous WS event handling (introduced in ee767c8) is used across threads. Task-Id: QTBUG-49051 Change-Id: Iae973c2d4f4619b9eeb6e9393330b166ec608d27 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* WinRT: Fixed possible integer overflow in timer registration codeOliver Wolff2015-09-021-1/+2
| | | | | | Task-number: QTBUG-48012 Change-Id: If1b80e59c13230bc0a62c6fa3d45b6e2272b9e28 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* winrt: Refactor platform plugin for XAML supportAndrew Knight2015-08-131-50/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By using XAML as the platform compositor, many benefits are possible: - Better input context handling for tablets - Better multiple window support (including non-fullscreen windows) - Support for transparent windows and window opacity - Integration with native platform controls - Simpler orientation handling on Windows Phone with built-in transitions This patch applies only the minimal parts to make XAML mode work just as the raw D3D mode. It does this by: - Moving all OpenGL parts into QWinRTEGLContext. This will allow us to have non-OpenGL windows later (e.g. Direct2D raster surfaces). - Moving more window-specific parts into QWinRTWindow. Each window creates a SwapChainPanel which can then be used for ANGLE (or Direct2D) content. - Moving non screen-specific parts into QWinRTIntegration. - Having QWinRTScreen create the base XAML element Canvas. - Running certain calls on the UI thread where necessary. The following code parts were removed: - The UIAutomationCore code in QWinRTInputContext, as this is incompatible with XAML automation. - The D3D Trim and device blacklist, as these have been fixed in ANGLE. - Core dispatcher processing in QEventDispatcherWinRT. Now there is only one native event dispatcher; it is always running and never needs to be pumped. Future commits should address: - Maintaining the window stack list and visibility using the XAML Canvas. - Allowing for windows (e.g. popups) to be sized and positioned instead of fullscreen. - Using the XAML automation API to improve the platform input context. [ChangeLog][QPA][winrt] Windows Store apps are now composited inside a XAML container, allowing for tighter integration with the native UI layer. Change-Id: I285c6dea657c5dab2fda2b1bd8e8e5dd15882c72 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* winrt: don't return invalidated timers in ↵Oliver Wolff2015-06-231-1/+1
| | | | | | | QEventDispatcherWinRT::registeredTimers Change-Id: I0dbad7a78080cd8c18893fea8294cf540a5e9e5e Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* Use qthread_win.cpp for WinRT as wellOliver Wolff2015-06-231-11/+10
| | | | | | | | | | Since of Windows (Phone) 8.1 most of the desktop's thread functionality is also available, so we might be able to share the code and get rid of the extra implementation for WinRT. Task-number: QTBUG-43837 Change-Id: I0ce907cd94899834527f88c70e1e395bafdb14b3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* winrt: Fixed timer handling in case where additional user events occurOliver Wolff2015-05-261-3/+6
| | | | | | | | | | | | | When timers are used in connection with widgets, it is possible that additional events occur (e.g. deferred deletions). If these happen, the event dispatcher also has to handle timers after handling these events as timer events might not be handled at all otherwise. So instead of returning early, we check whether timer events happened and might return afterwards. Task-number: QTBUG-46299 Change-Id: I3ef0fb23b3ae9a1e13e42497bcfb0976cf4e1b91 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* WinRT/Winphone: Fix warnings in qtbaseOliver Wolff2015-05-181-1/+2
| | | | | | Change-Id: I41725bcfeee0124b259e96f1e3a261e30f14350a Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* Rework WinRT timer handlingOliver Wolff2015-04-201-143/+184
| | | | | | | | | | | | | | The former way of timer handling caused heap corruptions as the timer callbacks tried to access the event dispatcher after it was freed. So instead of accessing the timers inside the callbacks we use native events to signal their expiration and also to cancel them. Task-number: QTBUG-44973 Change-Id: Ib9348651c0545cc4393f0396601f9a5bb183c996 Reviewed-by: Andrew Knight <qt@panimo.net>
* 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>
* 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>
* Improve checking for event/socket notifiers and timersJonathan Liu2014-09-231-3/+9
| | | | | | | | | | | | | | | | Starting/stopping timers from another thread may result in errors that may not appear until hours, days or weeks after if a release build of Qt is used with the GLib/UNIX event dispatchers. Such errors may manifest as warnings such as "QObject::killTimer(): Error: timer id 7 is not valid for object 0x2a51b488 (), timer has not been killed" and application crashes (e.g. crashes in malloc, realloc and malloc_consolidate). Initial-patch-by: Eike Ziller <eike.ziller@digia.com> Task-number: QTBUG-40636 Change-Id: I2de50d50eb1fc7467fcebb9c73b74d2f85137933 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* winrt: Fix deadlock in thread dispatcher accessAndrew Knight2014-08-131-6/+8
| | | | | | | | | | | An event dispatcher fetching the core dispatcher can deadlock when looking up the window. Simplify this by only looking up the view, and treating the event dispatcher as one which will never obtain the core dispatcher. This fixes a deadlock which occurs when starting network delegates. Change-Id: Ic27f4ab6f168eb95f3de70d78d64f035c331a7f5 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* winrt: Fix core dispatcher lookupAndrew Knight2014-08-111-19/+33
| | | | | | | | | The core dispatcher lookup should be performed from the constructor in all cases but the first (WinMain) thread, and only rechecked if the thread changes. Change-Id: I05f0c15b3e199994aa5d740b2092b42fb8d2f596 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* winrt: Handle dispatcher thread changeAndrew Knight2014-08-071-18/+21
| | | | | | | | | | If the calling thread changes when processing events, the dispatcher will no longer have thread access and event processing will fail. This can e.g. prevent new threads from being created. To remedy this, the dispatcher object is re-fetched if the thread is changed. Change-Id: I519cff521f9b84211db3f28a7a28b532de44a6a4 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* winrt: Refactor timer callbacksAndrew Knight2014-06-251-135/+115
| | | | | | | | | | | | | | With the previous solution, a thread pool timer callback fired in the same thread as the dispatcher. Now that timers can be called from the base thread pool, callbacks can come from alternate threads and so the associated event dispatcher must be tracked. This change refactors how timer info objects are created and tracked so that they can be properly created/destroyed/queued inside the timer callbacks. All QTimer tests pass. Change-Id: I18a5573df2a8fa32d1982c61e665d5df664b6db0 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* WinRT: Prevent GUI dispatcher lookup from non-GUI threadAndrew Knight2014-03-251-0/+6
| | | | | | | | | | | When we create an event dispatcher outside of the main thread, we shouldn't be looking up the core event dispatcher as it will fail. This ends up printing a scary warning for all e.g. Qt Quick apps when in reality nothing bad actually happened. Task-number: QTBUG-35327 Change-Id: I2060f0a9d4baffc42ca727e8d4e1ef7c13f6a2df Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* WinRT: Exit process event loop if WaitForMoreEvents is not setOliver Wolff2014-02-151-0/+2
| | | | | Change-Id: Ic74a75a56ba3f014b108e96d7a79a8623e6fa1d1 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* WinRT: move most of GUI event dispatcher logic into coreAndrew Knight2014-02-121-8/+61
| | | | | | | | | | The native event dispatcher is responsible for delivering callbacks to non-GUI handlers, such as network socket listeners. So, the non-GUI logic is moved into the core dispatcher so that the event loop works better for apps (and test cases) which use QCoreApplication. Change-Id: Ic5f7d939cf164198fd39aa5880e265ae560b39b4 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Fix WinRT timer dispatchAndrew Knight2014-01-301-17/+17
| | | | | | | | This fixes the event dispatcher lookup on timer callbacks, which was incorrectly using only the gui event dispatcher to look up timers. Change-Id: Ia01a07f6505afd0adfc0641e9c60199f258138a1 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* WinRT: Clean up core event dispatcherAndrew Knight2014-01-071-79/+87
| | | | | | | | | | | | | | | | - Move private classes in the .cpp file (they aren't needed outside) - Conform to Qt style, such as includes and braces - Use ComPtr where appropriate - Use foreach where appropriate - Remove non-functional wake/interrupt leftovers - Remove redundant timer list - Make the timer callback a static method, so it won't crash if it gets called on shutdown Task-number: QTBUG-35945 Change-Id: I5426fba2735e908a04ea60287f9936f5abde6644 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* use apartment threading for CoInitializeExMaurice Kalinowski2013-11-051-1/+1
| | | | | | | | otherwise we are risking a lock by freeing resources from other threads when calling CoUnitialized() Change-Id: I1fe09d7d3b1674a00b44ababfc90da79580278b3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* add WinRT event dispatcherOliver Wolff2013-09-261-0/+394
Change-Id: I40b3f896b89b99e271e1a5ca625a5193f4a7f59e Done-with: Kamil Trzcinski Reviewed-by: Lars Knoll <lars.knoll@digia.com>