summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilation with experimental x11 paint engine featureEskil Abrahamsen Blomfeldt2021-03-261-5/+7
| | | | | | | | | | | | | | | | | Adding support for vertical subpixel positions in d79a9b1a4f694a227ce62ccab9b44685a9755916 changed some private APIs which were used from the xcb-native-painting feature. This fixes this (it does not implement vertical subpixels but simply sets the vertical subpixel position to 0). It also adds a missing "override" which triggered the warnings-are-errors when compiling for me. Fixes: QTBUG-92011 Change-Id: If214a0d19a41e623ca9ef8e6215bc145f9846ae9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 70251867a50f9f606a7ceaf2338375a67e413b83) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xcb: use QXcbScrollingDevice for a touchpadShawn Rutledge2021-03-242-10/+26
| | | | | | | | | | | | | | When using XQuartz on macOS, the virtual pointer device is detected as a touchpad, not a mouse; but QXcbConnection::xi2HandleScrollEvent() expects the device to be an instance of QXcbScrollingDevice for storage of some state. A touchpad that has the scrolling capability must be that type, not a plain QPointingDevice. Fixes: QTBUG-91402 Change-Id: I1b82766d4a3f87f656e56c0d8904def26fb0979a Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit f85e70c569f4aa979004889d20de8acec9a790bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-243-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit fe29159aad0e03ca5eebabf910c90f279b222d03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xcb: unset old states and set new ones for windowLiang Qi2021-02-151-16/+33
| | | | | | | | | | This partly reverts a02959bb5b43a3f9d881e5213ceedf535202b6a1. Fixes: QTBUG-87078 Change-Id: I69e18ad3c0a8d142b2e1f5ab87990addc97d9df1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit f61b140482d9578c07410a5979379e44e05352e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add qHypot() to qmath.h, exposing and extending std::hypot()Edward Welbourne2021-01-271-3/+3
| | | | | | | | | | | | | | | | | | | | We have plenty of places where we add some squares and take a square root; this may be done more accurately and faster by hypot(). Introduce QHypotHelper to handle hypot with more than 3 parameters, and with 3 when the C++17 version is missing (which it never should be). Include an overload taking arbitrarily many valus and ensure that we can use qHypot() with qfloat16. Illustrate with some example uses, add some tests. [ChangeLog][QtCore][QMath] Header <QMath> now provides qHypot(), an implementation of std::hypot() taking arbitrarily many numeric values, including support for qfloat16, while avoiding the overflow and underflow problems that arise when naively taking the square root of a sum of squares. Change-Id: Ia4e3913fe83fc27d17d8e7f1a52f03ad445c1fed Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QPlatformScreen::colorSpace()Allan Sandfeld Jensen2021-01-254-0/+39
| | | | | | | | Added for macOS and X11 screens Task-number: QTBUG-90535 Change-Id: Ifafe7a07ee2abc3c42cd12785db2d7329878375b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Build fixes for GCC 11Ville Voutilainen2021-01-191-1/+1
| | | | | | | Task-number: QTBUG-89977 Change-Id: Ic1b7ddbffb8a0a00f8c621d09a868f1d94a52c21 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove .prev_CMakeLists.txt filesJoerg Bornemann2021-01-122-183/+0
| | | | | | | | | | Those serve no purpose anymore, now that the .pro files are gone. Task-number: QTBUG-88742 Change-Id: I39943327b8c9871785b58e9973e4e7602371793e Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-079-235/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* xcb: document QXcbEventQueue::PeekOption enumGatis Paeglis2021-01-012-8/+23
| | | | | | | | And renamed PeekRemove* to PeekConsumed to document better that nodes are not removed when peeking. Change-Id: I7349f57fcfc3287d1a1309a31ee7f481f8d18755 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Handle XCB_INPUT_DEVICE_TYPE_MASTER_POINTER properlyPaul Olav Tvete2020-12-252-4/+9
| | | | | | | | Make sure we use the new QXcbScrollingDevice class for the "core pointer" as well. Change-Id: I97575e8125cbb2aa280662aa675e61021c21ea59 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adjust the format of code blocks in handleScreenChange functionLu Zhen2020-12-251-1/+1
| | | | | Change-Id: I5da777e2196c005d6d5402c254a9452c3a888036 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix out-of-bounds writePaul Olav Tvete2020-12-233-24/+33
| | | | | | | | | | | | | Change ac210c73e4 introduced the requirement that all input devices with Scroll capability must have a QXcbScrollingDevicePrivate as their d_ptr. However, this was not enforced, and would fail for the "Virtual core pointer". To fix this, always use qobject_cast to verify that the device is of the correct type. Change-Id: I4a6b1d4d79308eb04e9f52dda00294fffe377bdf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: fix thread synchronization in QXcbEventQueue::waitForNewEvents() againIgor Kushnir2020-12-183-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch amends a41701904e880f58e19b352ade1931d6cd1a7112 If peeking into the event queue looking for a clipboard event fails, QXcbClipboard::waitForClipboardEvent() calls queue->peek for the second time to "process other clipboard events, since someone is probably requesting data from us". QXcbEventQueue::peek() in turn calls QXcbEventQueue::flushBufferedEvents(). This second flushing can acquire a waited-for clipboard event. The issue was that the code in waitForNewEvents() ignored this possibility and assumed that there were no clipboard events before or at its current m_flushedTail. If there were no more events on the X11 connection after tailBeforeFlush, the waitForNewEvents() in waitForClipboardEvent() blocked execution for 5 seconds and eventually timed out. The fix is to remember QXcbEventQueue::m_flushedTail just after looking for and not finding a clipboard event in the queue. And then wait for more events via QWaitCondition in waitForNewEvents() only if there were no more events after the remembered m_flushedTail. Fixes: QTBUG-75319 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I4919c5b9b9227b3a8a29a11e7094f97960b3a121 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* CMake: Fix 'static' conditionsJoerg Bornemann2020-12-171-1/+2
| | | | | | | | | The pro2cmake script doesn't handle static scopes correctly, and the generated "CONDITION static" must read "CONDITION NOT QT_BUILD_SHARED_LIBS". Change-Id: Ic5a5763e9fd5f5d04fb4c12227cbe85fac17b826 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* xcb: report wheel events from the correct device instanceShawn Rutledge2020-12-156-91/+235
| | | | | | | | | | | | | | | | | Until now, all wheel events came from one "core pointer". It's useful in Qt Quick to tell the devices apart, because some support smooth scrolling and some don't. Also remove the QHash storing legacy ScrollingDevice structs, and use a subclass of QPointingDevicePrivate instead. Task-number: QTBUG-46412 Task-number: QTBUG-72167 Task-number: QTBUG-69433 Change-Id: Ie6a3d8dd494f981e8706b9a66a1021dfb51baec4 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: Fix available geometry after rotationAlexander Volkov2020-12-132-5/+10
| | | | | | | | | | | | | | QXcbVirtualDesktop::m_workArea is not updated after screen rotation if _NET_WORKAREA is not updated, e.g. when a window manager is not running. Use width of -1 for m_workArea to indicate that _NET_WORKAREA is not set and thus there is no need to find its intersection with screens' geometries. Pick-to: 5.15 6.0 Change-Id: Ic1f3ec23576ed8407a76cc2b9f84a145c67b1d4b Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix highdpi conversion of QTabletEvent coordinates on xcbShawn Rutledge2020-12-081-4/+2
| | | | | | | | | | | | | | | Amends 1535fc9fb9ddbfce1680979c0634b4fdf8d75fca : when high-dpi scaling is enabled, there was an offset from the cursor position to the event position, because QWindow::mapFromGlobal() works in device-independent pixels, but we are using actual screen pixels here. Pick-to: 6.0 Pick-to: 5.15 Pick-to: 5.12 Task-number: QTBUG-77826 Change-Id: Ic8743b9e5c4041065f530ed1d9d6c49337b0207a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Let QXcbConnection::getTimestamp properly exit when X server quitsSheng Mao2020-11-301-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | QXcbConnection::getTimestamp uses dummy events to get timestamp from X server. However, in some cases, X server shuts down while client tries to get timestamp. In this case, QXcbConnection::getTimestamp keeps getting null event and thus falls into indefinite loop. This fix checks if xcb connection is still valid and use a special xcb_timestamp_t value, CurrentTime (0L), as returned value. CurrentTime should not be generated by X server and if getTimestamp returns this value, it means an "exception" case is triggered. This fix is introduced because in kwin_x11 (KDE project), X server can exit on logout. kwin_x11 should handle disconnection from X server. But the indefinite loop prevents kwin_x11 to process disconnection event and therefore kwin_x11 cannot quit properly. Fixes: QTBUG-88435 Pick-to: 5.12 5.15 6.0 Change-Id: Iaf7ef3f8a35fa8389d22a608e3c49041bf90e1b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-302-2/+2
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* xcb: Avoid use-after-free in QXcbConnection::initializeScreens()Alexander Volkov2020-11-181-2/+4
| | | | | | | | | | | Extend the scope of the resources variable to avoid its destruction while it's still in use. Fixes: QTBUG-88512 Pick-to: 5.15 5.12 Change-Id: I3298aabc871ff455bd1203ec276e7600d3e151ef Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QFileInfo: mark constructors as explicitGiuseppe D'Angelo2020-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | These look like leftovers (API flaws). Construction of QFileInfo from QString (or similar) should be not implicit, as QFileInfo construction is expensive (might hit the file system), and this may have users overlook APIs (for instance build a QFileInfo out of QDirIterator::next(), instead of using ::fileInfo(); using QDir::entryList instead of entryInfoList; etc.). Leave an opt-out mechanism to ease porting. Fix a handful of usages around qtbase, with at least a couple of them likely to be actual "sloppy" code. [ChangeLog][Potentially Source-Incompatible Changes][QFileInfo] Most QFileInfo constructors are now explicit. The QT_IMPLICIT_QFILEINFO_CONSTRUCTION macro is provided to keep old code working. Change-Id: Ic580e6316e67edbc840aa0c60d98c7aaabaf1af6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove Qt4Compatible paintingAllan Sandfeld Jensen2020-11-121-7/+1
| | | | | Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: ensure that available glx version is greater than requested one or ↵Aleksei Nikiforov2020-11-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | equal to it Otherwise xcb plugin may report that it's supported and later it'd be unable to create opengl context when requested due to too low xcb protocol version available, and thus some important xcb functions missing. Without such change when Qt application is running under x2go it exits with fatal error due to mismatch in requested and supported glx protocol versions. Qt requests glx protocol version 1.4, while x2go currently reports that it support glx protocol but only version 1.2, but Qt uses functions such as glXChooseFBConfig and glXGetVisualFromFBConfig which are available only starting with glx protocol version 1.3 according to glx documentation. With this change, when Qt application is running under x2go, xcb plugin reports that it's not supported and egl plugin is used instead. And egl plugin successfully allows to work with opengl, and thus Qt application is running normally. Pick-to: 5.15 Change-Id: I5c0fb10bd328da68054bfca8e8efde1144789566 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* CMake: Regenerate qtbase projects to use correct CONFIG_MODULE_NAMEsAlexandru Croitor2020-10-302-0/+2
| | | | | | | | Also sneak in testlib's misisng QMAKE_MODULE_CONFIG values. Task-number: QTBUG-88025 Change-Id: I76a37b8d8dbf7f294f91e32a5edbc52f5c83555b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate qtbase projectsAlexandru Croitor2020-10-302-1/+2
| | | | | | | | | | In preparation for some further regeneration. Also modify pro2cmake to add forgotten mapping for the Qt::EglFsKmsGbmSupportPrivate module. Change-Id: I92425c566c2b275b40eec8c652496290754ac385 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move QPolygonClipper to XCB native paintingAllan Sandfeld Jensen2020-10-294-1/+319
| | | | | | | It is the only code using it. Change-Id: I30060a63b6621ea94ae487ec93cd857117e12a46 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* CMake: Check for system_xcb_xinput featureAlexandru Croitor2020-10-231-1/+1
| | | | | | | | | | | | | | When compiling the xcb qpa plugin we should check the value of the 'system_xcb_xinput' feature to decide whether to use the system library or the bundled one, instead of checking for the existence of the XCB::INPUT target. This fixes -DINPUT_bundled_xcb_xinput=yes aka -xcb-native-painting to influence what gets built into our release Linux packages. Task-number: QTBUG-86053 Change-Id: I78c5eaacb7b6bd6e46afea49189e6111e198fb27 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* name our glib event sources to ease debuggingAndreas Buhr2020-10-221-2/+3
| | | | | | | | | | | glib event sources can have a name, but it is not required. Internal to glib, it is common to give them a name, see for example https://git.io/JTZ8g . This patch gives a name to each glib event source created in qtbase. Task-number: QTBUG-84291 Change-Id: I4f04526dcec082242312e3a66da2adf37a22e626 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-074-12/+12
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename the new platform APIs from QPlatformInterface to QNativeInterfaceTor Arne Vestbø2020-10-077-9/+9
| | | | | | | | | | | | We were already using the 'native' nomenclature when referring to these kinds of APIs, e.g. when talking about native handles, or the existing QPlatformNativeInterface on a QPA level. Using 'native' for the user facing APIs also distinguishes them from the 'platform' backend layer in QPA and elsewhere. Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: Avoid BadMatch error when creating non-OpenGL windowAlexander Volkov2020-09-251-13/+3
| | | | | | | | | | | The Xorg Server requires colormap when creating a window if the window's parent either has a different visual or has no colormap. To simplify logic and avoid extra requests, create a new window with colormap unconditionally. Pick-to: 5.15 Change-Id: I21a53f9146ae0a03b38bb3a07c8a478043a2eb89 Reviewed-by: Liang Qi <liang.qi@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-233-27/+27
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate projectsAlexandru Croitor2020-09-222-1/+1
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Cleanup API of QMimeDataLars Knoll2020-09-214-13/+13
| | | | | | | | | | | | | Do not use QVariant::Type anymore, instead use QMetaType For some reason, this pushed the qvariant autotest over the limit where MSVC requires the /bigobj flag, so add that one. [ChangeLog][QtCore][QMimeData] The signature of the virtual retrieveData() function has changed and now takes a QMetaType instead of a QVariant::Type. Change-Id: Ib46773bd731ee2177b1ef74d8162d744be7017ef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* xcb: Reduce number of created colormapsAlexander Volkov2020-09-164-12/+26
| | | | | | | | | | Create a colormap per visual, not per window. Pick-to: 5.15 Change-Id: I97d94618f159b4beaffd4a1afe0611233ced6676 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove dead codeVolker Hilsheimer2020-09-151-16/+0
| | | | | | | And remove another ### Qt comment, this time ### Qt 5. Change-Id: I1d5cef47ddd81b6a27f870599128c8f16846c350 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* X11: set fallback logical DPI to 96Morten Johan Sørvig2020-09-101-6/+6
| | | | | | | | | | | | | | | | | | Returning physical DPI from logicalDpi() is problematic, as explained in commit 77e04acb. The most predictable implementation is to never return physical DPI from QPlaformScreen::logicalDpi(). Other platform plugins already does this, and this change brings xcb in line with the rest of Qt. We have the QPlatformScreen::physicalSize() API which covers returning physical DPI (indirectly); Options for selecting which one to use can be implemented on top of these (see QT_USE_PHYSICAL_DPI). Change-Id: Ifc41229fa63734a2eb06b3acefd97b2ed3e57c2d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Get rid of hasPendingEvents() and flush()Lars Knoll2020-09-062-18/+0
| | | | | | | They are unused. Change-Id: I77383f2be45551401ed9c2f88285511134cc8b0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: drop Xinerama supportLiang Qi2020-09-047-48/+3
| | | | | | | | | | [ChangeLog][Important Behavior Changes][X11] Xinerama is no longer supported. Fixes: QTBUG-86082 Change-Id: Ieb57d9035e1659fc22bf8333247fc3573fb62992 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Fix memory sanitizer complaint about uninitialized valueLiang Qi2020-09-041-1/+1
| | | | | | | Fixes: QTBUG-86383 Pick-to: 5.15 Change-Id: Ib2bbe5d8e11574456fdc8b5c5fb07f5e41b538b3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* X11: restrict fallback logical DPI to 96 and higherMorten Johan Sørvig2020-08-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QXcbScreen determines logical DPI using the following priority: 1) use Xft.dpi if set 2) virtual desktop size / virtual desktop physical size (This change does not restrict or alter the value obtained from Xft.dpi in any way) The fallback option 2) has several problems: - It is a physical DPI, which does not account for viewing distance or user preference - It is a global value for the entire virtual desktop (not per-screen) - X servers usually fake the virtual desktop physical size such that the computed DPI ends up at 96; in cases where this does not happen we can end up with a surprising DPI value. We might be better off just hardcoding 96 here, to avoid picking up an incorrect physical DPI when for example connecting to a TV (as reported in QTBUG-67928). This change does not go as far as hardcoding 96, but instead restricts the (fallback) DPI value to be 96 or higher. Pick-to: 5.15 Task-number: QTBUG-67928 Change-Id: Ieea6c7a137261282b40302fb4c19273c5def10af Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: remove QT_XCB_NO_XI2_MOUSE code pathGatis Paeglis2020-08-234-134/+13
| | | | | | | | | | | | | | | This code path was deprecated in 5.12 and scheduled for removal in Qt 6. See 9184384bc9d9d71a146fff535021357258a0295e. According to the source comments from f48170b479df359f47af12b03a501d9d0c386e66, apperantly XInput2 had some issues when running on Xinerama screens and therefore there was a check for it in xi2MouseEventsDisabled(). We plan to remove Xinerama support, therefore Xinerama handling in xi2MouseEventsDisabled() is irrelevant. Task-number: QTBUG-69412 Change-Id: I384d7c46337358caecccf644acc8ffbd381dc69d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qwsi: revert parts of 00ae1e6b7bf6efa5f5e57d37844e44d521604fb6Gatis Paeglis2020-08-231-2/+0
| | | | | | | | | | | | | | We actually do not need this "mode" in qwsi API. I think while writing the patch from 00ae1e6b7b I got confused by focusing on my test application. We can't know what the native event filter will filter out, therefore it makes sense that we unconditionally do filtering at qwsi level as well for user input vs other events in QWindowSystemInterface::sendWindowSystemEvents(). Pick-to: 5.15 Pick-to: 5.12 Change-Id: Idb23152a24bf3ba3b91804427a6e78f991969c29 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: Fix flushing of native subwindows when not using shared memoryTor Arne Vestbø2020-08-221-2/+11
| | | | | | | | | | | | | | | | | | | | | When using X-forwarding we're not using shared memory for the backing store image, and end up in a code path where we first copy the updated parts of the backing store from our client side image over to the server, and then flush those parts from the server-side image to the window. The problem was that this code path didn't account for the possibility that we'd flush a sub-window at an offset, and would end up uploading the sub-window local region directly, without applying the offset. This problem was revealed when 79bf1b7e348d started being smarter about what regions we flush and to what windows when we have sub windows. Fixes: QTBUG-81723 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I1c9c8bc53c088cdc1ae8b892e17930f4a468ccad Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Properly deprecate Qt::MidButton in favor of Qt::MiddleButtonEdward Welbourne2020-08-221-2/+2
| | | | | | | | | | | | MidButton had its // ### Qt 5: remove me upgraded to Qt 6 at 5.0; but it dates back to 4.7.0 Replace the many remaining uses of MidButton with MiddleButton in the process. Pick-to: 5.15 Change-Id: Idc1b1b1816673dfdb344d703d101febc823a76ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use the factor() function for getting scale factorsMorten Johan Sørvig2020-08-191-2/+2
| | | | | | | | | Make the code less dependent on (changing) high-dpi internals. Change-Id: Ifc7cb4aab1c1c70016ca86639edf5c9630999f9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-1/+1
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* xcb: avoid a usage of invalid reply in qxcbdragLiang Qi2020-08-061-4/+5
| | | | | | | Fixes: QTBUG-83446 Pick-to: 5.15 Change-Id: I1f148c611dcab6cad951ddd934072933fef75452 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* XCB: Update logical DPI on “Xft/DPI” changeMorten Johan Sørvig2020-08-051-0/+14
| | | | | | | | | | Install XSettings property change callback on the “Xft/DPI” property. Update QxcbVirtualDesktop::m_forcedDpi and QScreen logicalDPI on change. Pick-to: 5.15 Change-Id: I578ebe9017fee58acd7a5c432cbd614fd35f2f55 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>