summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
Commit message (Collapse)AuthorAgeFilesLines
* processEvents(WaitForMoreEvents) should return after delivering eventsBradley T. Hughes2012-02-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | The Cocoa event dispatcher sends timer, socket, and posted events correctly, but they are not NSEvents, and as such, they do not cause [NSApp nextEventMatchingMask] to return. When calling processEvents() with WaitForMoreEvents, but the EventLoopExec flag isn't set, we want to interrupt the WaitForMoreEvents. As a result, We should not call wakeUp() at the top of processEvents(), otherwise we end up shortcutting other event sources. We also do not need to call QCoreApplication::sendPostedEvents() directly either in processEvents(), it's the postedEventsSource job to do that. The interruptLater mechanism is always run when calling processEvents() directly (not via exec()), which causes problems when testing processEvents(). Don't use interruptLater unless the modal sessions change (which is indicated by the cached session pointer being reset to zero). Change-Id: Iec2b49a4f306b2702c979522f12a28d0b5fbd0b4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@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>
* Change QCocoaEventDispatcher timer handling to use QTimerInfoListBradley T. Hughes2012-01-091-17/+7
| | | | | | | | | | | | | | | | This gives us support for the various Qt::TimerTypes. We only use one CFRunLoopTimer to drive all of the Qt timers. We update the time-to-fire for this timer as we add/remove/fire Qt timers. The documentation for the CFRunLoopTimerSetNextFireDate() function says that this is a valid use case, and is more performant than constantly adding and removing CFRunLoopTimers. The documentation recommends using a large interval for this use case (the docs say "several decades", but we use 1 year). Change-Id: Ie7fd7a845f4254699a5b6a5720e7626f2c5e787f Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
* QCocoaEventDispatcherPrivate members should not be staticBradley T. Hughes2012-01-051-22/+20
| | | | | | | | | | | | | | | Keep the Cocoa event dispatcher's private data as normal members of QCocoaEventDispatcherPrivate. This removes the global initializers for the macTimerHash and cocoaModalSessionStask as well. To keep timers working, we pass a pointer to the timer's MacTimerInfo struct to the callback, instead of just the timer id. The MacTimerInfo needs to keep a pointer back to the QCocoaEventDispatcherPrivate to get access to the private's members. Change-Id: Ic3a61e5e1d1d82030735de73cf0b0c70a13c21a4 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@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 QCocoaEventDispatcher inherit from QAbstractEventDispatcherBradley T. Hughes2012-01-031-3/+5
| | | | | | | | | | | ... instead of QEventDispatcherUNIX. The Cocoa dispatcher does not use any of the facilities of the UNIX dispatcher, and it reimplements every virtual method already (with the exception of flush(), which just needs an empty implementation). Change-Id: I24aefd169888946afac7800192a0f96770787718 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Add Qt::TimerType argument to QAbstractEventDispatcher::registerTimer()Bradley T. Hughes2012-01-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate the old registerTimer() functions. The new pure- virtual registerTimer() breaks source-compatibility. Subclasses cannot be instantiated anymore, since the pure virtual function signature has changed. QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a struct with timerId, interval, and timerType members. This is a source incompatibility that should only affect subclasses of QAbstractEventDispatcher, which will need to pass 3 arguments to the TimerInfo constructor instead of 2. If the subclass used QPair<int,int> instead of the TimerInfo typedef, the QPair<int,int> declarations will need to be replaced with TimerInfo. Call the new registerTimer() function with the type from QObject::startTimer(). Change all subclasses of QAbstractEventDispatcher to reimplement the new virtual function. The type argument is unused at the momemnt, except to ensure that registeredTimers() returns the type each timer was registered with. Implementations for the various dispatchers will be done in separate commits. Author: Thiago Macieira <thiago.macieira@nokia.com> Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cocoa: QMenu refactor.Morten Sorvig2011-09-071-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Refactor window system event dispatching.Morten Sorvig2011-06-231-3/+3
| | | | | | | | | | Add QWindowSystemInterface::sendWindowSystemEvents, which contains the canonical "empty and send queued window system events" implementation. Make the Cocoa, QPA, and GLIB dispatchers use the new implementation. Cocoa now no longer inherits from QPA.
* CompileMorten Sorvig2011-06-221-1/+1
|
* Add lighthouse event dispatcher API.Morten Sorvig2011-06-221-0/+231
Platform plugin creation is now moved forward in order to have a platform plugin instance at event dispatcher creation time. Plugins are now responsible for implementing PlatformIntegration::createEventDispatcher and returning an QAbstractEventDispatcher subclass.