summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.h
Commit message (Collapse)AuthorAgeFilesLines
* Add QWindow::startSystemMove and startSystemResizeJohan Klokkhammer Helsing2020-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be used to create custom client side window decorations. Refactors the xcb implementation to use edges instead of corners and we now use the last mouse position for `root_x` and `root_y` in the `_NET_WM_MOVERESIZE` event. Touch has also been changed, so just pick a point that's currently being pressed. The workaround for QTBUG-69716 has now been moved to QSizeGrip, as the comment in the bug report says that it should ideally be fixed at the widget level. On Windows, we no longer abort when GetSystemMenu returns false. I assume this code was added to check whether the window didn't have any decorations and not resize in that case. However, since the point of this patch is to let windows without native decorations resize/move, it makes most sense to remove the check. Adds a manual test, which calls QWindow::startSystemMove and startSystemResize on touch and mouse events. [ChangeLog][QtGui] Added API for starting interactive window resize and move operations handled by the system. Fixes: QTBUG-73011 Change-Id: I7e47a0b2cff182af71d3d479d6e3746f08ea30aa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-4/+4
| | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 3rdparty: remove xcb libs and bump minimal required version to 1.11Gatis Paeglis2019-08-271-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With libxcb 1.11 as minimal required version we can: (a) (Maybe) Enable threaded GL for MESA, see QTBUG-67277. (b) Avoid performance issues described in QTBUG-46017. Bundled xcb libs don't contain the more modern SHM fd passing APIs. The official binaries use "-qt-xcb", therefore we were shipping with the performance fix #ifdef-ed out. (c) Make xcb-xkb a mandatory dependency avoiding issues described in QTBUG-30911. Issues that appear when Qt was configure with "-no-xkb -xcb-xlib", but X server has the XKB extension. (d) Drop all, but xcb-xinput sources from src/3rdparty/xcb/, for which we need "xcb-xinput >= 1.12". This way we can reduce maintenance work. The xcb libraries were origianlly bundled because of lack of availability on supported distributions. This is not the case anymore: CI for Qt 5.13 has: Ubuntu 18.04 - libxcb 1.13 RHEL 7.4 - libxcb 1.13 openSUSE 15.0 - libxcb 1.13 CI for Qt 5.12 has: Ubuntu 16.04 - libxcb 1.11 RHEL 7.4 - libxcb 1.13 openSUSE 42.3 - libxcb 1.11 RHEL 6.x - not relevant because it was dropped from supported platforms. Why 1.11 (released on Aug, 2014), but not 1.13 (released on March 2018)? Based on what we have in CI for 5.13 and 5.14 we could update to 1.13, but it means that Qt would require a very recent version of 3rd party dependency. [ChangeLog][Configure][X11] The minimal required version of libxcb now is 1.11. [ChangeLog][Third-Party Code][X11] Removed all bundled XCB libs, with the exception of xcb-xinput, which is not available on systems with libxcb 1.11. [ChangeLog][Configure][X11] Removed -qt-xcb, -system-xcb, -xkb, -xcb-xinput switches. [ChangeLog][Platform Specific Changes][X11] XKB and XInput2 now are mandatory dependencies for XCB plugin. XCB-XKB is a part of libxcb 1.11 releases. XCB-XInput is not part of libxcb 1.11 releases, but Qt builders can use -bundled-xcb-xinput switch. Fixes: QTBUG-73862 Fixes: QTBUG-73888 Task-number: QTBUG-67277 Task-number: QTBUG-30939 Change-Id: I4c2bd2a0e667220d32fd1fbfa1419c844f17fcce Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-161-2/+4
|\ | | | | | | Change-Id: Ief0a0b754c104d5348fee9ee15e967bd37c526f8
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-151-2/+4
| |\ | | | | | | | | | Change-Id: I2bf3b4ceb79364330eae4cbf3cdee9a82d1be46d
| | * XCB: Fix clipboard breaking when timer wraps after 50 daysLukáš Turek2019-03-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xcb_timestamp_t is a 32-bit unsigned value in miliseconds, so it wraps after 49.7 days. When it happens, QXcbConnection::m_time stops updating and copy & paste in an application would not work until the application is restarted. This patch detects the timer wrap and allows m_time to wrap too. The fix was verified in KDE desktop with applications running for 51 days. Fixes: QTBUG-65145 Change-Id: I328c4179c1b1f71914adda6f9a0ca3991a7e808e Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | | More nullptr usage in headersKevin Funk2019-03-141-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | xcb: respect big-request encoding in max request sizeGatis Paeglis2019-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From big-request specification: "This extension defines a mechanism for extending the length field beyond 16 bits. If the normal 16-bit length field of the protocol request is zero, then an additional 32-bit field containing the actual length (in 4-byte units) is inserted into the request, immediately following the 16-bit length field." Meaning that the request requires 4 additional bytes. This patch provides a convenience API for calculating maximum request data size. Besides fixing QTBUG-73044, it was also discovered that calculations for xcb_image_put (in QXcbBackingStoreImage::flushPixmap) were wrong. The code assumed that xcb_get_maximum_request_length() returns bytes, but what it actually returns is length which is measured in four-byte units. This means that we were sending 4x less bytes than allowed by the protocol. Furthermore, use the actual 'stride' (bytes per line) value when calculating rows_per_put. The new stride value was introduced by 760b2929a3b268e2edf14a561329bdb78fbdc26e, but was not updated in rows_per_put calculations. Fixes: QTBUG-73044 Done-with: JiDe Zhang <zccrs@live.com> Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io> Change-Id: I06beb6082da3e8bc78225a87603914e796fe5878 Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | xcb: rework focus-in peeker so we can drop PeekFunc APIGatis Paeglis2019-01-041-5/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API for registering temporary peek function was added ~7 years ago by 78264f333eb7c262380714ed6517562266f11a03. It was never been used for anything else. The solution from 78264f333 also did not work very well on KDE desktop, quoting Martin Flöser: "In case the keyboard gets grabbed by another process and immediately ungrabbed the active Qt application window receives a FocusOut and a FocusIn event. FocusOut on the grab of keyboard, FocusIn on the ungrab. Qt registers a peek function for checking the FocusIn event, but the timespan is too short: the new event is not yet queued. This causes a QEvent::WindowDeactivate being emitted, followed directly by a QEvent::WindowActivate. This has quite some side effects, for example rendering flickering in the GUI (switching to inactive/active in short time frame), hooks on WindowDeactivate being run, etc. Real world examples for such short keyboard grabs are global shortcut listener applications like kglobalaccel5. It has e.g. a passive key grab on the mute key, which is then turned into an active grab when the key is grabbed. Kglobalaccel5 immediately ungrabs the keyboard and flushes the connection if it gets a key event, but it of course causes the sequence of FocusOut and FocusIn events in the active Qt window." Reworked the code to use QTimer instead, which is more elegant solution, because it does not rely on race-conditions, but uses a concreate time to wait instead. Also the need to write focusInPeeker() caused us to duplicate event handlers that were present already elsewhere. Change-Id: I647e52fb2634fdf55a640e19b13265c356f96c95 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: move clipboard code out of QXcbConnection::processXcbEventsGatis Paeglis2018-10-311-0/+1
| | | | | | | | | | ... to QXcbConnection::handleXcbEvent(), which is where it belongs. This patch amends bc6f5b3ff61f4b1dea14084349702f2895feda66 (Sep, 2013). And some other design cleanups. Change-Id: Iefa0793c58de16a59d2294f38311e1e8dfa3035b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: fix unresponsive mouse clicks after VT switchGatis Paeglis2018-10-251-1/+1
| | | | | | | | | | | | | | This patch amends d67214302f269242ae3d8d2b962fd91ec42c979e. The issue was caused by mistakenly interchanging m_hasXRender <-> m_hasXRandr. Also renamed selectXRandrEvents() -> xrandrSelectEvents() to be more consistent with xi2Select*() API. And moved the xrandrSelectEvents() to QXcbConnection ctor for the same reason. Fixes: QTBUG-71305 Change-Id: I26f9bac3ae1f997f53134eb97f3569fb6d3c13fe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: qxcbconnection_screensGatis Paeglis2018-10-171-10/+9
| | | | | | | | | | Moved all screen handling method implementations into qxcbconnection_screens, the same way we are doing with xinput2 code in qxcbconnection_xi.cpp. The goal was to reduce the size of qxcbconnection.h/cpp. Change-Id: I9bad55ca4b0874171b7313d923b13c66034c3b3e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: qxcbconnection_basicGatis Paeglis2018-10-171-320/+9
| | | | | | | | | | | | A basic base class that creates a connection and initializes extensions. The goal was to reduce the size of qxcbconnection.h/cpp. Made QXcbAtom into a class that handles atom initialization and exposes the relevant APIs. Before this patch, all of that logic was inside of qxcbconnection.h/cpp. Change-Id: Ia893c3b31e2343dfbe62fe2aa6bfd0017abf46ea Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: respect QEventLoop::ExcludeUserInputEvents in native event handlersGatis Paeglis2018-10-161-1/+3
| | | | | | | | | | | | | | | | | This was a regression from Qt 4. Before this patch, we supported filtering events only at QWindowSystemInterface level, but to properly support filtering in QAbstractEventDispatcher::filterNativeEvent, we have to filter the events earlier. Now it is possible to enable/disable this feature for platforms that support native event filtering. The mapping of which events are user input events were taken from QWindowSystemInterfacePrivate::EventType. Task-number: QTBUG-69687 Change-Id: I9a5fb9f999451c47abcdc83fdcc129b5eeb55447 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: call processXcbEvents() on every event loop iterationGatis Paeglis2018-10-151-2/+1
| | | | | | | | | | | | | | | | | | It is necessary for QTBUG-69687. The original code processes the xcb event queue only when new events have arrived, but if we want to do an event filtering that buffers some events and processes them later based on set/unset flags (e.g. QEventLoop::ExcludeUserInputEvents), we need to call processXcbEvents() on every event loop iteration, not only when new events have arrived from X server. The required functionality is implemented by having custom event dispatchers, instead of using the generic ones from QtGenericUnixDispatcher:: createUnixEventDispatcher() / eventdispatcher_support-private. This also enables for further customizations, as might be necessary by QTBUG-70095. Task-number: QTBUG-69687 Change-Id: I1f8b2400d26cccf17279d57bb4b678e40c615f33 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: lock-free event processingGatis Paeglis2018-10-141-76/+9
| | | | | | | | | | | | | | | | | For details how this works refer to the documentation in the patch. The follow-up patches will switch to calling processXcbEvents() on every event loop iteration. With the existing code that would mean frequent locking of shared data (event queue). Acquiring a lock is fast, but lock contention isn't. To avoid potential problems, reimplement xcb event processing to be lock-free. Besides theoretical performance benefits, this definitally improves code readability in qxcbconnection.cpp. Thanks to Mikhail Svetkin for questioning the design of the existing code. Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io> Change-Id: I935f2b6ca802580f5c80205aef7b2f9afc172d26 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "XCB: Do not create instance of QPlatformIntegration for invalid ↵Gatis Paeglis2018-10-141-12/+5
| | | | | | | | | | | | | | | displays" This reverts commit 67cc8fea106c35c7ca75bf476667d07b3bbf3257. I forgot about this patch and now it makes rebasing the local changes too time-consuming. Besides, 67cc8fea10 broke a build for -no-xcb-xlib. I will restore this patch, with adaptations to the new QXcb*Connection hierarchy. Task-number: QTBUG-68859 Change-Id: I938f32b5da22ce18f95d761f9b34e77fff923e24 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: remove runtime check for xcb_poll_for_queued_eventGatis Paeglis2018-10-121-5/+0
| | | | | | | | | | | | | | | xcb_poll_for_queued_event() was introduced in libxcb 1.8. The minimal required libxcb version was bumped up to 1.9 in 1f5d791708d5d256a76872f254251dac66e82cdb. Before this version bump we needed the runtime check to support older versions of libxcb. Updated connections in the event reader to use the new signal and slot syntax. Removed threadedEventHandling() method because now it is always 'true'. Change-Id: I0bce61fd478a871d35e676239ee5280c4f40be8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: Initialize OpenGL integration only when requiredAlexander Volkov2018-09-291-2/+3
| | | | | | | | | | | In some cases OpenGL integration may be unnecessary, e.g. an application may set Qt::AA_ForceRasterWidgets attribute and don't use OpenGL in any other way. In addition OpenGL initialization can take noticeable time on some configurations. So do it on demand only. Change-Id: If88953f8d5c826bc96fd49eb397b5e1ad693546d Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-141-0/+2
|\ | | | | | | Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
| * Fix XCB on endian mismatched client and server with SHM offAllan Sandfeld Jensen2018-09-121-0/+2
| | | | | | | | | | | | | | If SHM is disabled, that code path already does its own bswaping. Change-Id: I6c17f6c5c5502c8f89098d38d931b6b8f50b2640 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge dev into 5.12Oswald Buddenhagen2018-08-211-9/+15
|\ \ | | | | | | | | | Change-Id: I63f632b595f66d2fc93e9aa713500e3799e3df2a
| * | xcb: avoid unnecessary InternAtom requestsGatis Paeglis2018-08-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QXcbConnection::internAtom() creates the atom if it does not exist. The lifetime of an atom is not tied to the interning client. Atoms remain defined until server reset (lost connection, restart). So create the atom once via QXcbConnection::initializeAllAtoms(), and later fetch the atom value from local array, instead of repeating InternAtom requests. Change-Id: I3cae21895febad6e5daf8c32e72612202baaad64 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| * | xcb: cleanup QXcbConnection::handleXcbEvent()Gatis Paeglis2018-08-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - the usage of 'handled' variable was a mess. - remove "generic" from API names. The naming was probably influenced too much from underlying C API (xcb_generic_event_t): - handleGenericEvent() -> handleNativeEvent() to be consistent with QWindow::nativeEvent(). - dropped unnecessary 'long *result' from signature. It is useful only on MS Windows. - genericEventFilterType() -> nativeEventType(), it *is* an event type, not a filter type. - XCB_CLIENT_MESSAGE was not passed to QWindow::nativeEvent(), which is done via HANDLE_PLATFORM_WINDOW_EVENT. - minor: added some 'auto's where it makes sense and improved some variable names. Change-Id: Id1c9896054e2dbd9a79bacd88394149c8cf2cdea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | xcb: rewrite auto-repeat key detection logicGatis Paeglis2018-08-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's unclear what the original code was doing. It relied on 'm_release' which could never be 'false' (ref. QTBUG-69679). It was subtracting event times and comparing with arbitrary '10'. On X11 auto-repeat keys can be detected by checking time and keycode of the current release event and the next event in the queue. If an event is an auto-repeat, then next event in the queue will be a key press with matching time and keycode. Verified that auto-repeat was unreliable in Qt 4 as well. With this patch auto-repeat works as expected. Added support for Xlib's XPeekEvent in our XCB implementation QXcbConnection::checkEvent(): "The XPeekEvent() function returns the first event from the event queue, but it does not remove the event from the queue." Sneaking in one variable renaming: "string" -> "text", to match the QKeyEvent::text(). Task-number: QTBUG-57335 Task-number: QTBUG-69679 Change-Id: I0a23f138287f57eaaecf1a009bd939e7e0e23269 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | xcb: Use functors in QXcbConnection::checkEvent()Gatis Paeglis2018-08-161-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... to check for buffered events. This makes the code less verbose and easier to read. Changed the filter signature to pass an event type in addition to the actual event, for the convenience of API user. And do not pass worthless nullptr-s to the filter. The only reason why KeyChecker from qxcbkeyboard.cpp was not converted to lambda expression is that the code looks suspicious - KeyChecker::m_release default value is 'true' and I don't see where it would ever be assigned 'false' (ref. QTBUG-69679) and the code is known to be buggy (ref. QTBUG-57335). Those issues are out-of-scope for this patch. Change-Id: If2fdd60fbb93eb983f3c9ad616aaf04834fede9f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* | | XCB: Do not create instance of QPlatformIntegration for invalid displaysFriedemann Kleint2018-08-201-5/+12
|/ / | | | | | | | | | | | | | | | | Extract a static factory for QXcbConnection objects and pass potential connection errors to qxcbmain.cpp, which will then return 0. Task-number: QTBUG-68859 Change-Id: I9c0faf82462a78a576360c19bef251ad1d034d84 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| * xcb: partly revert 3bc0f1724ae49c2fd7e6d7bcb650350d20d12246Gatis Paeglis2018-08-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After trying to fix (work around) system resize/move issues in various ways from within the platform plugin, it has been concluded that it is a bug at widget layer and should be fixed there instead: QTBUG-69716. This patch reverts parts of 3bc0f1724a and disables system move / resize on XCB plugin. Meaning, QSizeGrip will use its own implementation for resizing a window. Task-number: QTBUG-68501 Task-number: QTBUG-69628 Change-Id: Ib4744a93fb3e3c20f690a8f43713103856cb7d1a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge branch '5.11' into devEdward Welbourne2018-07-311-0/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| * xcb: fix various bugs with _NET_WM_MOVERESIZEGatis Paeglis2018-07-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) After a37785ec7638e7485112b87dd7e767881fecc114 it become apparent that we don't get mouse release event from X server when system move/resize ends (because WM is grabbing the pointer). The old code (before a37785ec) would wrongly deduce mouse move as mouse release, which is why the issue was not seen before. The solution is to subscribe to slave device events. 2) This patch also amends 2488f34ecfd68702b5508c50cca3fb8e967ac8ea as that patch was solving the issue only for 1/3 of the supported DEs. It worked with KWin, but not with Unity and Gnome. Its worth noting that it also worked with two other WMs that I tested - openbox and awesomewm. The way forward is to detect when system move/resize was started as a result of touch event and let the QSizeGrip do the move/resize instead of WMs that are known to have bugs. With this patch we also need to adjust the event compression algorithm to not treat all XI_TouchUpdate events equally. For XI_Motion we don't care if the event that we process comes from a master or a slave device, so we can process them as equal. Task-number: QTBUG-68501 Task-number: QTBUG-51385 Task-number: QTBUG-32476 Change-Id: Iab4e79a289d7bc0fe26f7ae2cff7c562f51a3334 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QSystemTrayIcon/X11: Move platform-specific calls to the xcb pluginAlexander Volkov2018-07-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Detect the tray icon window in the platform plugin by the object name. This way we don't need QXcbWindowFunctions::requestSystemTrayWindowDockIdentifier(). - Get rid of unused calls QXcbIntegrationFunctions::xEmbedSystemTrayVisualHasAlphaChannel() and QXcbWindowFunctions::setParentRelativeBackPixmap(). - Mark the tray icon window as embedded to be able to get the correct result from QWindow::mapToGlobal(). It allows to drop QXcbWindowFunctions::systemTrayWindowGlobalGeometry(). This change allows to remove the intermediate level between the QSystemTrayIconSys widget and the xcb plugin. The code looks clearer. Change-Id: I7d067131287a6dec162b36f0bddc8cb518aaa38c Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: Set WM_CLIENT_MACHINE propertyAlexander Volkov2018-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be useful to detect that a window belongs to an application running on a remote host. E.g. a window manager may display the name of the remote host in the window title. Or it can detect whether a client can be killed. This property is set by Xlib's function XSetWMProperties(), which is called by GTK and Qt 4, so it's also good to do for consistency. Change-Id: I0693156635cb2696b2fbe7006cbecb25d2680513 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: Refactor align of xcb eventsMikhail Svetkin2018-07-051-9/+2
| | | | | | | | | | | | | | | | | | Use C++11 alignas instead of a union to pad the xcb_*_event. It allows using the struct directly without accessing a union member. Change-Id: I221a6708ef7af844bd6b71a57dcbab75e1319c72 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* | xcb: move XSync extensions initialization to QXcbConnectionGatis Paeglis2018-06-281-0/+3
| | | | | | | | | | | | | | | | ... where we do initialization of all other extensions. Having this code in QXcbVirtualDesktop does not make sense. Change-Id: I3bf3034b4a24e06aa5792e7d49133f46c5728b07 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | xcb: qxcbdrag.cpp cleanupsGatis Paeglis2018-06-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - moved finding of XdndAware target logic in its own function to reduce size of QXcbDrag::move(). - switched to use categorized logging with more consistent logging messages - added more comments to avoid constatly looking at the specification for the meanings of Xdnd* actions and who sends/receives the action. - removed dead code (findXdndAwareParent), which should have been removed in 269fdbdd2bedda5f5eacb751224d3a3fc3eed5bc when reimplementing this logic in XCB. - removed needless reseting of state variables in various places as this is handled in QXcbDrag::init() on DnD start. - renamed variable in QXcbDrag::dndEnable(): xdnd_widget -> window - and other minor cleanups Change-Id: Ib667f80ceb4c07b7409a90c041044c98665877f3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
| * Make sure we can build with -no-feature-draganddropJoerg Bornemann2018-05-291-2/+2
| | | | | | | | | | | | | | | | | | We move QInternalMimeData to a separate file, because this class is used, even if draganddrop is disabled. From now on, include qinternalmimedata_p.h instead of qdnd_p.h for QInternalMimeData. Change-Id: I594e08e2e90d574dc445119091686b4b69e4731b Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | qpa: improve API to support DnDs from other processesGatis Paeglis2018-05-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... instead of using a hack of directly accessing QGuiApplication members. The current QPA API was bad for two reasons: 1) It expects platform plugin authors to know about internals of Qt Gui, particularly that QGuiApplication uses QGuiApplication::{mouseButtons,keyboardModifiers} to construct QDragMoveEvent and QDropEvent events. Which results in the second reason why this is bad. 2) Platform plugins should not directly access member variables of QGuiApplication, just to make sure that QDragMoveEvent and QDropEvent events contain correct state. Platform plugins should instead use QWindowSystemInterface to communicate with Qt Gui (which is also the solution here). The solution is to extend QWindowSystemInterface::handle{Drag,Drop} to require mouse/keyboard state. We already do this for some of the other methods, so it is nothing extraordinary. This type of interface is also _required_ to support drag-n-drops from other processes. We can't use QGuiApplication::{mouseButtons,keyboardModifiers} when the drag originates from another process, instead we need to query mouse/keyboard state from the system. This patch fixes drag-n-drops from others processes on XCB platform plugin. Task-number: QTBUG-57168 Change-Id: I3f8b0d2f76e9a32ae157622fef801829d629921d Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-151-1/+9
|\| | | | | | | Change-Id: I8c353b4c53e90434453c76691eac39a894d23b49
| * xcb: prevent crash with pixmap cursors on XRender-less X serversGatis Paeglis2018-04-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using xcb_render_* APIs without checking if the server even supports this extension. Attempting to use an extension which is not present will always result in a crash. This patch adds the required guards and refactors how we detect presence of XRender extension. Also instead of falling back to some odd-looking bitmapped version just leave the current cursor unchanged. That is how we did it in Qt4 AFAICT. Task-number: QTBUG-66935 Change-Id: I4f27f1d65a77563ec34f3e0e94492c9236d7f9a6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | xcb: minor cleanups around QT_CONFIG(xcb_xlib)Gatis Paeglis2018-04-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove unused createVisualInfoForDefaultVisualId() function. This amends dff3c0f14f3c3a7288c456028d5bec23bee5406a. - Inline QXcbConnection::xlib_display(). - Don't nest QT_CONFIG(xcb_native_painting) in QT_CONFIG(xcb_xlib). configure.json already checks for the dependencies, we don't need to do that again in *.h/*.cpp. Change-Id: If39912e67ce9baa31faf091bebe120bac5cf6876 Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: Use XCB instead of Xlib for XInputAlexander Volkov2018-03-221-27/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace xinput2 feature by xcb-xinput, which doesn't depend on xcb-xlib - Remove xi2PrepareXIGenericDeviceEvent() that was used to fix incompatibilty between XCB and libXi structs - Drop XCB_USE_XINPUT21 and XCB_USE_XINPUT22 defines that were needed with libXi Although xcb-xinput was released in version 1.13 of libxcb, it was quite stable in version 1.12, and the parts that we use did not change between versions, so require system xcb-xinput 1.12. [ChangeLog][X11] The xcb plugin was ported to use libxcb-xinput instead of libXi for XInput2 support. The -xinput2 configure option was replaced by -xcb-xinput. Task-number: QTBUG-39624 Change-Id: I37475b09b2bd7057763345c3f33d8c7751a4e831 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-231-0/+1
|\| | | | | | | Change-Id: I01dfc41e18333ac55954296cef8f01475adab27e
| * xcb: remove fragile and unnecessary missing-latin-keymap workaroundGatis Paeglis2018-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... which was trying to fix a rarely occurring situation where system settings from a desktop environment does not set any latin keymap on X. This is a DE bug and it has a simple workaround (details in the patch). Ubuntu has fixed this issue sometime between 12.10 -> 14.04. Gnome 3 always appends 'us' layout, even if you have only e.g. 'gr' listed in keyboard layouts (can be checked via setxkbmap -query). In KDE, the global system shorcuts seem to stop working as soon as latin keymap is not the first in the list, which means that KDE users won't be affected as they will likely always have a latin keymap present in the list. This patch removes parts of 2b666d9576210aa98700e219dba6b1bd4f93d793, the parts that in the commit message I was referring to by this quote: "lookupLatinKeysym() also handles the cases that did not work in Qt4 with XLookupString". Since finding a latin key is not working by XLookupString() in this rare case, then it would not work pretty much across the whole desktop. And users would be more interested at finding a solution that works across the desktop. We should not workaround this issue. Desktops that are doing it wrong should learn about this and not repeat the same mistakes on Wayland systems, where XKB keymap is assembled by compositor and passed to clients. Clients should work with the provided keymap as is. The missing-latin-keymap workaround is considered fragile for several reasons - it might not work with legacy or enterprise X server key codes and it relies on global _XKB_RULES_NAMES (there might be several connected keyboards). And theoretical limitation: client might be running in a restricted environment where we don't have access to keymaps on the file system. Change-Id: Ib445b2ea46174248cfa0e5da0eb642cd2a5cf2f6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-161-0/+6
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
| * xcb: Fix access to shm for X server running from another userAlexander Volkov2018-02-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use ShmCreateSegment call, that was added in MIT-SHM 1.2, to create shared memory segments on the server side. It returns a POSIX shared memory object that is used to mmap memory. It's in effect a file descriptor that is passed through the X server socket and thus avoids permission checks. On the other hand this scheme is more secure, because the file descriptor, and thus the shared memory, are accessible only by the X server and the application. Task-number: QTBUG-46017 Change-Id: I202eead9d01aee2ab5b65f4f74f4c13da7cb2239 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| * xcb: Enhance SHM management codeAlexander Volkov2018-02-151-0/+4
| | | | | | | | | | | | | | | | | | | | - extract the creation of a shared memory segment into a separate function - do extra checks for errors - check that MIT-SHM extension is present once in QXcbConnection Change-Id: I956bdf76b879ec5c95a7ed219a59ae722dc5afba Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-111-4/+4
|\| | | | | | | Change-Id: Ia443f6eb1c854c99c68127a376b78c1986675a9d