summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface_p.h
Commit message (Collapse)AuthorAgeFilesLines
* add cross-platform tablet->mouse event synth; enable on AndroidShawn Rutledge2016-04-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's urgent to fix the issue that on Android, it became impossible to interact with any widget or MouseArea which handles only mouse events but not tablet events, using the stylus, because stylus events are sent only as QTabletEvents. Before 5.6 (change 01d78ba86a631386a4d47b7c12d2a359da28f517) they were sent as touch events, and mouse events were synthesized from those. Whereas on other platforms, every QTabletEvent is followed by a synthesized QMouseEvent. This fix proceeds in the direction that event synthesis should be done in cross-platform code so that platform plugins don't have to repeat it, following the same pattern as for touch->mouse synthesis. Just as in that case, the application can disable it, and the platform plugin can also report that it's unnecessary for Qt to do the synthesis because the platform already does. So QTBUG-51618 is fixed, but QTBUG-47007 requires us to remove the tablet->mouse synthesis from all platform plugins, because the plugin does not know whether the tablet event was accepted or not, so it does not have enough information to decide whether to synthesize a mouse event. Synthesis has been unconditional until now, which contradicts what the documentation says: the mouse event should be sent only if the tablet event is NOT accepted. We can now gradually make this promise come true. [ChangeLog][QtCore][Tablet support] A synthetic mouse event will no longer be sent after every QTabletEvent, only after those which are not accepted (as documented). Task-number: QTBUG-47007 Task-number: QTBUG-51618 Change-Id: I99404e0c2b39bbca4377be6fd48e0c6b20338466 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-111-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define and undef in src/corelib/tools/qsimd_p.h. This change is also squashed with "Fall back to c++11 standard compiler flag for host builds" which is done by Peter Seiderer. Conflicts: mkspecs/features/default_post.prf src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch src/3rdparty/sqlite/sqlite3.c src/corelib/tools/qsimd_p.h src/gui/kernel/qevent.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/bearer/blackberry/blackberry.pro src/plugins/platforms/cocoa/qcocoasystemsettings.mm src/plugins/platformthemes/gtk2/gtk2.pro src/plugins/styles/bb10style/bb10style.pro src/sql/drivers/sqlite2/qsql_sqlite2.cpp tools/configure/configureapp.cpp Task-number: QTBUG-51644 Done-with: Peter Seiderer <ps.report@gmx.net> Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
| * QWheelEvent: make NoScrollPhase opt-inShawn Rutledge2016-03-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for QTBUG-50199 involves adding an undocumented enum value which can be returned from QWheelEvent::phase(). This will be quite unexpected for applications that use it, which work fine with 5.6.0 and then start receiving this new phase value in 5.6.1. So it should not happen by default. Set the env variable QT_ENABLE_MOUSE_WHEEL_TRACKING to enable this functionality. In 5.7 it will be default behavior. But in 5.6 the default behavior is as it was before: if you use a conventional mouse wheel, the phase stays at ScrollUpdate continuously. [ChangeLog][QtCore] QWheelEvent::phase() returns 0 rather than Qt::ScrollUpdate when the wheel event comes from an actual non-emulated mouse wheel and the environment variable QT_ENABLE_MOUSE_WHEEL_TRACKING is set. In Qt 5.6, this is required to enable the fix for QTBUG-50199. Change-Id: Ieb2152ff767df24c42730d201235d1225aaec832 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Add QWheelEvent::inverted()Morten Johan Sørvig2016-03-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some consumers of wheel events need to know if the scrolling direction is inverted in order to provide consistent behavior. For example, the scrolling direction of a horizontal slider should not change when the user toggles the "natural scrolling" setting on OS X. In this case the inverted bit will change state and the slider can compensate. This change adds a bit to QWheelEvent and sets it on OS X. Task-number: QTBUG-35972 Change-Id: I221435dea45d436d570b113bd0e24ee6f6832211 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-291-1/+1
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qprocess/tst_qprocess.cpp Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
| * Track target widget when wheel events are receivedGabriel de Dietrich2016-02-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This issue is reproducible on OS X when using a Magic Mouse or a combination of Magic Trackpad and regular mouse. In these cases it's possible to start a scrolling gesture on one widget and move the mouse cursor over another widget. Although we send the wheel event phase information, we never made any use of it. This means that a widget would start scrolling even though it never received a ScrollBegin event. In this patch, we make sure the scrolling cycle is respected and that once a widget starts scrolling, it'll be recieving all the wheel events until a ScrollEnd event reaches the application. For those input devices not supporting a proper phase cycle, we introduce a new (undocumented) phase value, NoScrollPhase. If the wheel event phase is NoScrollPhase, then we ignore the current scroll widget and proceed as usual. This value is the default for wheel events. It's up to the platform plugin to set the proper phase value according to the data received from the OS. Finally, we fix a few of QWheelEvent constructors to properly initialize the phase and source properties. Task-number: QTBUG-50199 Change-Id: I3773729a9c757e2d2fcc5100dcd79f0ed26cb808 Reviewed-by: Shawn Rutledge <shawn.rutledge@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>
* Implement threaded synchronous WS eventsMorten Johan Sørvig2015-08-271-0/+1
| | | | | | | | | | | | | | Make handleWindowSystemEvent() support being called from secondary threads in synchronousWindowSystemEvent mode. This is implemented by posting the event to the Gui event queue (which will wake the Qt Gui thread), and then calling flushWindowSystemEvents which will block the calling thread until the event has been processed. Change-Id: I7e8e68c1e0290c17105563268e316b0f8205b3ce Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Make flushWindowSystemEvents return ev. acceptedMorten Johan Sørvig2015-08-271-0/+2
| | | | | | | | | | | | | flushWindowSystemEvents() now returns whether the most recent event added to the queue was accepted by Qt or not. Use QAtomicInt to store the accepted state in order to avoid a data race on it between the Gui thread and the event poster thread. Change-Id: I6c111fdaecda5c514307ca0749a54075fe8e872f Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Propagate event accepted state to platform pluginsMorten Johan Sørvig2015-08-131-2/+3
| | | | | | | | | | | | | | | | Add en "eventAccepted" field to WindowSystemEvent, where the event subclasses can record the event acceptance status. Make handleWindowSystemEvent() return the accepted status. This works for synchronous event processing only. If the event is placed on the QPA event queue then there is no way to return the accepted state immediately. In the latter case handleWindowSystemEvent() always returns "true". Change-Id: I081aecc54f43588d42d3aaeec7f8458f06937601 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Introduce cross platform high-dpi scalingMorten Johan Sørvig2015-07-301-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a coordinate scaling layer to QtGui, which supports 'devicePixelRatio' type high-dpi on all platforms, in production and also for development and testing purposes. High-DPI scaling is opt-in, by setting environment variables: QT_SCALE_FACTOR - sets a global scale factor QT_AUTO_SCREEN_SCALE_FACTOR - sets per-screen scale factors, where the scale factors are provided by the platform plugin. This QtGui scaling can be used instead of or in addition to scaling done by the window system. This distinction is not visible to applications [when they use Qt API], which will see a change in the value returned by the devicePixelRatio() accessors as usual. Introduce a new (private to Qt) coordinate system: native pixels. The coordinate system stack now looks like: device-independent pixels (app, upper parts of Qt) native pixels (lower parts of Qt Gui, platform plugins) device pixels (backing stores and OpenGL) Add private QHighDpi namespace with scaling functions that convert between device-independent pixels and native pixels: T toNativePixels(T, QWindow *); T fromNativePixels(T, QWindow *); Add scaling calls the QWindow (and friends) cross-platform implementation, around the calls to QPlatformWindow functions. QPlatformWindow now uses native coordinates - platform code remains largely unchanged since native coordinates are window system coordinates. QWindow now uses (possibly) scaled coordinates. This means that platform plugins no longer can rely on QWindow::geometry() and related functions. QPlatformWindow::windowGeometry() and other convenience functions have been added for use when the platform plugin needs to convert scaled geometry to native geometry. Add Qt::AA_NoHighDpiScaling, which can be use to disable any scaling in QtGui, effectively ignoring the environment variables. (Note that this does not disable any scaling done by the window system.) Contributions from Friedemann and Paul. Task-number: QTBUG-46615 Change-Id: I673bbd69c130e73b13cce83be11bfb28f580bf60 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add a way to filter window system eventsGiulio Camuffo2015-05-121-0/+13
| | | | | | | | | | | | | This change introduces the class QWindowSystemEventHandler which can be used to hook into QWindowSystemInterfacePrivate to filter and dispatch window system events. One use case is to intercept key events from the underlying system in QtCompositor and feed them into the xkbcommon state, and to modify the events based on the resulting state. Change-Id: I829eb7d960420135990fb0f6db54c14eea3e8e48 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix synchronousWindowsSystemEvents spelling.Morten Johan Sørvig2015-04-241-1/+1
| | | | | | | | | | "WindowsSystem" -> "WindowSystem". Strictly a QPA API break; there are no users of the function in QtBase. Change-Id: If2151b57587c68a7b5cbf261c54634aa930f2792 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* 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>
* Add QWheelEvent::sourceShawn Rutledge2015-01-131-2/+3
| | | | | | | | | | | | This is analogous to 0a92295ca829a62125c9f122fd3daec991993855 which added QMouseEvent::source. For now, we say that a wheel event is synthetic when it comes from a trackpad or other device that provides scrolling by some means other than an actual wheel. Change-Id: I0452ca2080b551b18b9c2f6e42db925d14ae339e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-271-1/+3
|\ | | | | | | | | | | | | Conflicts: src/gui/text/qfontdatabase.cpp Change-Id: I6ac1f55faa22b8e7b591386fb67f0333d0ea443d
| * QPA: Flush window system events with flags.Morten Johan Sørvig2014-10-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | Add a QEventLoop::ProcessEventsFlags argument to flushWindowSystemEvents(). This gives the platform plugins more control over which events to flush. Task-number: QTBUG-39842 Change-Id: Id9c01948b22e297b22503d38ec4e726f9f880fd5 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Jonathan Liu <net147@gmail.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-28/+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-9/+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>
* | Introduce flags to QWindowSystemInterface::WindowSystemEvent.Friedemann Kleint2014-09-041-4/+16
|/ | | | | | | | Replace boolean member variables by flags. Task-number: QTBUG-38768 Change-Id: If1302d9cc555d20df44147c9fa0f193a471fc95c Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* add buttons to QTabletEventShawn Rutledge2014-07-281-6/+6
| | | | | | | | | | | | | Until now, it has been necessary for tablet-oriented applications which care about multi-button styli to reject each tablet event and wait for the mouse event in order to know which buttons are pressed. This patch adds the new API and also the X11/xcb implementation. [ChangeLog][QtCore][Tablet support] Added buttons to QTabletEvent Task-number: QTBUG-39458 Change-Id: If2c9ec1ceacc1700a82686c5fc6f568f9111055a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* OS X: Add support for ApplicationState capabilitySamuel Gaist2014-04-241-2/+3
| | | | | | | | | | | | | | | | Currently a click on e.g. the dock icon is not propagated to the application so if for example the main widget is hidden, it can't be brought back. Also neither applicationDidBecomeActive nor applicationDidResignActive do anything. This patch fixes it [ChangeLog][QPA][OS X] Add support for ApplicationState capability. Application can now detect when an application states has changed as well when the dock icon has been clicked. Task-number: QTBUG-10899 Change-Id: I53d3e6eed4adc62b343e7aa3e3d8068d3248e7df Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-201-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qstring.cpp src/gui/image/image.pri src/gui/image/qimage.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/qeglfshooks_stub.cpp tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp Change-Id: I3b9ba029c8f2263b011f204fdf68c3231c6d4ce5
| * Make qtbase compile with QT_NO_GESTURESTasuku Suzuki2014-01-101-0/+4
| | | | | | | | | | Change-Id: I90f173265e177ff37ce80da3983080651856259d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-261-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * EglFS: make sure resize events are deliveredPaul Olav Tvete2013-11-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that resize events are delivered when the platform plugin overrides the geometry set in setGeometry(). This fixes a race condition where a widget was resized to its sizeHint() while the window was maximized, and the content was shown scaled on the screen. The problem is that the widget gets the wrong size from QWidget::setWindowState() (which calls adjustSize() in order to support normalGeometry). This size is used to resize the backingStore. When the QWindow is resized, it calls QEglFSWindow::setGeometry() which corrects the size to screen()->availableGeometry(), and triggers a GeometryChangeEvent since the size was corrected. This ends up in QGuiApplicationPrivate::processGeometryChangeEvent() which will not send a resize event, since the size has not changed (it is always availableGeometry()). Therefore the widget is never resized, and the backingStore remains the wrong size. Task-number: QTBUG-34421 Change-Id: Iee49c53cc529de36010db2695d838d8c2284edd4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-241-0/+16
|\| | | | | | | Change-Id: Ie56539b2e0be611a363b5f15ae5412a78d6945a2
| * Implement native gestures on OS X.Morten Johan Sørvig2013-10-171-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add QWindowSystemInterface::GestureEvent and QNativeGestureEvent to QtGui. These events are copies of Qt4's QNativeGestureEvent, where it was an implementation detail of QGestureManager. Add gesture message handlers to QNSView and bring back the Mac gesture recognizers for QGestureManager. Task-number: QTBUG-28126 Change-Id: I1304e09e776fa7c44d133d54ca8b895ca2f544c5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Relay mouse event synthesization informationLaszlo Agocs2013-10-041-4/+7
|/ | | | | | | | | | | | | | | | | Make platform plugins, like the windows one, able to indicate if a mouse event is synthesized from a touch event by the OS. This will be valuable information for the Quick2 event handlers. No new member variables are added to QMouseEvent. Instead, the enum value is encoded in the caps member, there are plenty of bits available in it. This introduces Qt::MouseEventSource and QMouseEvent::source() as public APIs. Change-Id: If087a0bafb33a6cd7891bd07b84871358f6aba69 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Replace QWheelEvent::Phase with revised Qt::ScrollPhaseJ-P Nurmi2013-08-151-2/+2
| | | | | Change-Id: I4d8e7d48497d0d96a297191976c0d99feb67b538 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Implement support for global whatsthis on WindowsSimon Hausmann2013-08-131-0/+1
| | | | | | | Task-Number: QTBUG-32835 Change-Id: Ifee10d815ce0037c96eda574ab9e1af67ff6bd78 Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* Introduce QWheelEvent::Phase (Begin, Changed, Ended)J-P Nurmi2013-08-081-2/+3
| | | | | | | | | | | | | | Some platforms (read: OS X) send wheel events without delta to indicate that scrolling is about to start or has ended. Currently, Qt simply ignores wheel events that have no delta. This change introduces a new QWheelEvent attribute that specifies the phase, and makes it possible to receive the special wheel events in started/ended phases. These events are required for implementing correctly behaving transient scrollbars. Change-Id: Ib8ce0d9ce9be63b2ad60aa7b0aaa1f12ef6cad09 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Q_DISABLE_COPY doesn't need a ; at the endAlbert Astals Cid2013-06-101-1/+1
| | | | | | | | | Fixes warnings when -Wpedantic is enabled Change-Id: I8fcfbfa9bb3a5ab61c85f8cb74660f6f7e459fc0 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Alejandro Exojo Piqueras <suy@badopi.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Make QWindow update its screen when moved to a different oneGabriel de Dietrich2013-05-231-1/+12
| | | | | | | | Also implements the Cocoa backend for that. Change-Id: I32977e12a04e1cf48b12333442482746c69ce133 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix ignoring close events on OSXJosh Faust2013-04-261-2/+4
| | | | | | | | | | | | | QNSWindowDelegate was not handling windowShouldClose, which is how you can tell Cocoa that your window should not close if the close button is pressed. This change moves the close handling from windowWillClose to windowShouldClose, and adds an optional "accepted" pointer to QWindowSystemInterface::handleCloseEvent so that QNSWindowDelegate can return a true/false value for whether the window should actually close Task-number: QTBUG-28965 Change-Id: I67c6296ad42cbeeb71413e05411467d4e558adb4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Implement XEmbed protocolAlberto Mardegan2013-03-061-2/+3
| | | | | | | | | | | | | | | | | | | Add a static QWindow::fromWinId(WId id) constructor which can be used to create a QWindow object representing windows created by other processes. Then, QWindow::setParent() can be used to embed a window into a foreign window socket and QWindow::setTransientParent() to stick the current window on top of a foreign window. The changes in the QtWidgets module ensure that the focus chain (TAB navigation) correctly works when a QtWidgets-based window is embedded into another application. As far as the platform implementation is concerned, this commit only implements the embedding functionality in the XCB plugin. So, this is roughly equivalent to the Qt4 QX11EmbedWidget functionality. Change-Id: Iff8f7b9ee974d33fb30f36056f7838b433a413c7 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix crash in flushWindowSystemEvents() in QGuiApplication-cleanup.Friedemann Kleint2013-03-051-2/+3
| | | | | | | | Check for existence of QGuiApplication, discard events if it is 0. Change-Id: I04b27679033fb13ef2fa38e39757d89465cba94b Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Allow flushing window system events from other threadEskil Abrahamsen Blomfeldt2013-02-281-1/+13
| | | | | | | | | | | For platform plugins such as the Android plugin, we need to make sure an event is delivered and handled before continuing execution (e.g. when doing an expose event to report that the EGL surface has been destroyed when the app goes into the background.) Change-Id: Ibd381baafa93f111dbc887d4cf9d9ca37429b186 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* QPA: fix memory leak in qwindowsysteminterface.hRichard Moe Gustavsen2013-02-241-1/+1
| | | | | | | | Just removing the event from QList will not delete it... Change-Id: I3c4bb69a2afaada7ad4d5695eba0b3f29e9463ec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QPA: Add interface for setting the application state explicitlyRichard Moe Gustavsen2013-02-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation for this patch is twofold: 1: we need a way (for iOS/Android) to tell the current window to remove focus from the focus object when the user hides the input panel. Otherwise, if the focus object is e.g a line edit, the cursor will continue to blink inside it, which is wrong. As it stands, telling the active window to deactivate (by calling QWindowSystemInterface::handleWindowActivated(0)), will cause the whole application to deactivate if no windows are active, which is not what we want. 2: Qt currently understands just two application states, Activated and Deactivated. On mobile platforms we can have other states as well, like "suspended" on iOS. So controlling the application state should not depend on window activation, but instead be controlled through a separate API by the platform plugin. This patch will add the following function: QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState newState) that lets us control the application state from the plugin. This also means that we factor out application state handling from window activation, which also gives us a way to remove focus from a window while keeping the application active. To not break existing desktop platforms that relies on application activation being tied to window activation, we need to make this API opt-in by using a platform integration capability hint. This is not optimal, but found necessary after investigating several other solutions. Which states (other that active/inactive) it makes sense to add to Qt::ApplicationState will be a topic for later patches. Change-Id: Ic6fdd3b66867abb67da43eba04ec86f06d82ff94 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Add QWindowSystemInterface::handleFileOpen(const QUrl&)José Dapena Paz2013-02-081-2/+5
| | | | | | | | | | | | In some cases, the call to handleFileOpen may receive a non local URL. With previous API, there was no way to pass it to other layers. With this change, any platform plugin creating this event can directly pass a URL. Change-Id: Ibd7299ad6c09527e1db979840bd67726882efb9b Reviewed-by: Jose Dapena Paz <jdapena@igalia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-3/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.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>
* Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons()Jon Severinsson2013-01-041-3/+2
| | | | | | | | | | | | | | | | | Previous commit b2363a935c8dac fixed keyboardModifiers() after QPA event processing, but broke QTestLib, which expects spontaneous input events sent to qApp->notify() to update keyboardModifiers() and mouseButtons(). The commit also did not fix mouseButtons() after QPA event processing, and missed keyboardModifiers() after QPA Tablet event processing. This commit fixes all these shortcommings in b2363a935c8dac. Includes test case by David Faure <faure@kde.org> Task-Number: QTBUG-26887 Change-Id: I8518b06c4ce86ea7b35120e3353a45ea2a81d356 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Handle QEventLoop::ExcludeUserInputEvents in QWindowSystemInterface.Friedemann Kleint2012-11-211-24/+34
| | | | | | | | | | | Add a flag indicating user input events to the event type and leave those events in the queue if QEventLoop::ExcludeUserInputEvents is set. Task-number: QTBUG-27595 Change-Id: Ib41b826ef3be19253cd582d9894dd7c87953711f Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Add a QEnterEvent containing the mouse position.Friedemann Kleint2012-11-101-2/+4
| | | | | | | | | | | | | Enter handling requires knowledge of the mouse position. Extend the enter handling of QWindowSystemInterface to receive the position (implemented for Windows, XCB and Mac), passing it on to QEnterEvent. Dispatch QEnterEvent from widgets code. Change-Id: I49c07d2b1f46310c877017dd55d4cd7d636bdbce Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Added private header warnings in src/gui/kernelSamuel Rødal2012-11-091-0/+11
| | | | | Change-Id: If3ad9d1e18543639f9e6abb8899b72772bc70c83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Add ContextMenu event to QWindowSystemInterfaceMiikka Heikkinen2012-10-251-1/+17
| | | | | | | | | | | | | Context menu key wasn't working, as QPA had no handling for it. Added ContextMenu event to QWindowSystemInterface and proper handling to QGuiApplication and QWidgetWindow. Also provide Windows implementation. Task-number: QTBUG-27648 Change-Id: I7ce71ec4b5cdcc7be758e67f9faf6d863f7b19be Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix excess enter/leave event generation for native widgetsMiikka Heikkinen2012-10-191-2/+23
| | | | | | | | | | | | | | | | | | | | | | Native widgets have a native window each, so QPA plugin sends enter and leave events for associated QWindow whenever mouse cursor moves from one widget to another. QWidgetWindow had no context to interpret these events as moves from one widget to another, since they were sent separately. This resulted in leaves and enters for each widget in parent chain, when only the bottom child should have gotten them. Fixed by peeking into window system message queue when handling leave in QWidgetWindow and retrieving the entered window from queued enter event. Also provided a convenience function that QPA plugin can use to ensure both leave and enter events are in the event queue when moving from one QWindow to another. Task-number: QTBUG-27550 Change-Id: I74fec0ac90f6848495c2392c5f7e41624ad8aea2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>