summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* xcb: replace tiny helper function with an inline codeGatis Paeglis2018-08-171-8/+3
| | | | | | | | Having these 2 lines in a function does not add much value and requires scrolling that could be avoided. Change-Id: Ife814be6478521cd64b0048d1b6ee447afea55de Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: cleanup QXcbConnection::handleXcbEvent()Gatis Paeglis2018-08-161-5/+4
| | | | | | | | | | | | | | | - 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: remove a redundant call to xcb_change_window_attributes()Gatis Paeglis2018-08-161-2/+0
| | | | | | | | | Few lines above we use the same attributes to create the window. If attributes don't change, there is not need to call xcb_change_window_attributes() Change-Id: I1335b8be866bdd9911d7911c87f09091bf77e955 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Use functors in QXcbConnection::checkEvent()Gatis Paeglis2018-08-161-70/+28
| | | | | | | | | | | | | | | | | ... 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>
* drop usages of Q_COMPILER_CLASS_ENUMGatis Paeglis2018-08-141-4/+0
| | | | | | | It is not relevant anymore. C++11 is a hard requirement for a while already. Change-Id: Idb8fbdcd13398cc85fba583f40c2b5c4dc7c4943 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-11/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+29
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 build when xinput2 is not availableFriedemann Kleint2018-07-251-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | Fix the #ifdefs. Amends 3bc0f1724ae49c2fd7e6d7bcb650350d20d12246. Task-number: QTBUG-68501 Task-number: QTBUG-51385 Task-number: QTBUG-32476 Change-Id: Icc6421fe2e91a3b29bcec8cb1a8a91cb71ae3172 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| * xcb: fix various bugs with _NET_WM_MOVERESIZEGatis Paeglis2018-07-231-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-0/+2
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| * XCB/Xlib: make sure we don't get problems for sys headers using registerThiago Macieira2018-07-111-0/+2
| | | | | | | | | | | | | | | | | | Found while compiling on FreeBSD 11.2 (clang 6 update has the warning): /usr/local/include/X11/Xlibint.h:675:7: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] Change-Id: I117816bf0f5e469b8d34fffd153e6482ccaed69f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | QSystemTrayIcon/X11: Move platform-specific calls to the xcb pluginAlexander Volkov2018-07-101-31/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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: Fix artifacts on the tray background with lock screensAlexander Volkov2018-07-101-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the current method of painting the tray icon with 24 bpp visuals we grab the window's background once on the first show and then use it in all paint operations. This leads to a wrong background if an application shows the system tray icon when the lock screen is active. We can avoid this by painting with XRender when it's available. This change introduces QXcbSystemTrayBackingStore and moves the selection of a suitable painting method from QSystemTrayIconSys into it. In addition the visual for the window is selected according to the system tray specification and the platform window for the tray icon is created without needless OpenGL and Vulkan support. Task-number: QTBUG-55540 Change-Id: Ib3ca42bc02dcbdd4ccfe5d6e23f870ef22f0d25a Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: Set WM_CLIENT_MACHINE propertyAlexander Volkov2018-07-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-021-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * Do not update scroll coordinates on ignorable enter eventsAllan Sandfeld Jensen2018-06-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This greatly reduces how often we reset the scroll evaluators, especially with non-focused windows in KWin which sends an enter for every wheel events in that case. The update of the evaluators also has race conditions with the normal events, and thus reducing them fixes odd scrolling behavior with rapid firing mouse wheels. Task-number: QTBUG-42415 Task-number: QTBUG-68734 Change-Id: I1c14ca3352bf9c6e57e47ad3aaee1712fe6ba30b Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: move XSync extensions initialization to QXcbConnectionGatis Paeglis2018-06-281-8/+6
| | | | | | | | | | | | | | | | ... 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: rely on WM_SIZE_HINTS gravity to handle x,y positioningGatis Paeglis2018-06-261-43/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original code was added by b316c3ac5e4acac75505bfd77677cecc181599a (in 2012). This patch changes two things: 1) We now rely on WM to position a window based on the set gravity. It should not be necessary to calculate coordinates manually as was done in windowToWmGeometry(). We don't even know the decoration size before the window is mapped. 2) We now update gravity whenever needed instead of hardcoding based on what Qt APIs (setGeometry vs setFramePosition) where used to set the initial window position. The patch from b316c3a says: "Determine gravity from initial position. Do not change later as it will cause the window to move uncontrollably" Since it did not elaborate on the situation, we can only assume that it was caused by another bug in Qt at the time or perhaps a broken WM. From [1]: "Applications are free to change their win_gravity setting at any time. If an Application changes its win_gravity then the Window Manager should adjust the reference point, so that the client window will not move as the result." Tested on Ubuntu/Unity, KDE/KWin, Gnome-shell/Mutter, Lubuntu/OpenBox. Works as expected everywhere expect Unity. Unity seems to ignore XCB_GRAVITY_STATIC and treats it as XCB_GRAVITY_NORTH_WEST, which means that setGeometry/setFramePosition produce the same placement on this WM (the behavior was the same also before this patch). P.S. Also renamed xRect -> rect, which was a leftover from ae5f2a66720a4bb22c120bd7d1564652cac00367 With this change we can un-blacklist QWidget save/restore geometry auto tests. [1] https://specifications.freedesktop.org/wm-spec/latest/ar01s09.html Task-number: QTBUG-66708 Change-Id: I381eef5d34dddb04de16a897ce5540b9c430b216 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: add static overload for setting window nameGatis Paeglis2018-06-221-29/+27
| | | | | | | | | | Change-Id: Ib581a582059e196567514f40b1964696ceaf3a88 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | xcb: account for misbehaving Unity DnD ManagerGatis Paeglis2018-06-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... which may cause dnd data to be lost. As soon as Unity sees that dnd operation has started (it monitors for changes on XdndSelection) it creates an invisible window named XdndCollectionWindowImp that fill entire screen and starts to act as DnD target. Once it has fetched the mime data it moves XdndCollectionWindowImp away without sending any DnD termination events. XdndCollectionWindowImp does not respect the XDnD protocol. Only when its gone we can start a normal dnd operation - looking for real DnD target. We ask windows if they are XdndAware on the initial mouse press and subsequent mouse move events. This patch sets a cursor to Qt::ForbiddenCursor while DnD is interfered by XdndCollectionWindowImp. A user will see the real DnD action (reflected by cursor) only after the next mouse move when XdndCollectionWindowImp has stopped interfering. We also setCanDrop(false) while DnD target is XdndCollectionWindowImp. Temporary seeing ForbiddenCursor is better than losing DnD data. Dropping in this state means that drop will simply be ignored. It is unclear what Unity developers expected DnD source window to do when user releases mouse while XdndCollectionWindowImp is stealing the data. Looking at Unity code, it appears that they were hoping to be quick enough that it would never happen. Task-number: QTBUG-49464 Change-Id: I10880073f6d843572be44fe9a3c4f78194466299 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+4
| | | | | | | | | | | | | | | | | | 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>
* | Move default implementation of update requests to QPlatformWindowTor Arne Vestbø2018-05-071-2/+2
| | | | | | | | | | Change-Id: I4cbb8d2023068288e298ab21f5cd8bc258825c77 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-151-22/+0
|\| | | | | | | Change-Id: I8c353b4c53e90434453c76691eac39a894d23b49
| * xcb: fix bitmap cursor loading performance regressionGatis Paeglis2018-04-141-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... introduced by 422838685c31d9b57133a8711bfd5db92095d96d. Instead of completely droping caching for bitmap cursors we can do the same what is done in libXcursor - have a fixed size cache, with oldest entries eventually being replaced with new bitmaps. This fixes the original issue, where the hash was growing indefinitely until running out of file descriptors and won't have the performance penalty as in 422838685c31d9b57133a8711bfd5db92095d96d. Task-number: QTBUG-66897 Change-Id: I14f80b46f97fd0e2c920e17a31ffbc0441cd9d22 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | xcb: Use XCB instead of Xlib for XInputAlexander Volkov2018-03-221-28/+28
|/ | | | | | | | | | | | | | | | | | | | | | | - 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>
* xcb: Fix FP1616 to int conversionAlexander Volkov2018-03-091-1/+1
| | | | | | | | | | Divide the whole FP1616 value by 0x10000 instead of dividing the integer part by 0x10000 and the fractional part by 0xFFFF. It also makes fixed1616ToInt() consistent with fixed1616ToReal(), see 7d3f353a5bd573dc0e72f7f55c70212a6b3837fa. Change-Id: Id76025028c926872b002ef0a1ca8a8bdc2de3e1e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix crash when reading window titles with XCBSimon Hausmann2018-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is a regression introduced with commit cb142954c54b7a6e391950d9209b5cea9252092b that changed the code from using QString:fromUtf8(name, propertyLength) to QString::fromUtf8(name), assuming that the property name is a zero-terminated string. That however is not correct. ASAN trace: ==4039==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400001e0b4 at pc 0x7f3383c7d66e bp 0x7ffdc8e3d9b0 sp 0x7ffdc8e3d158 READ of size 5 at 0x60400001e0b4 thread T0 #0 0x7f3383c7d66d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x7f337602f32a in QString::fromUtf8(char const*, int) ../../../../include/QtCore/../../src/corelib/tools/qstring.h:569 #2 0x7f337602f32a in QXcbWindow::windowTitle(QXcbConnection const*, unsigned int) /home/simon/dev/qt-5.11/qtbase/src/plugins/platforms/xcb/qxcbwindow.cpp:2861 [...] 0x60400001e0b4 is located 0 bytes to the right of 36-byte region [0x60400001e090,0x60400001e0b4) allocated by thread T1 (QXcbEventReader) here: #0 0x7f3383d0ab50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7f337b397e2b (/usr/lib/x86_64-linux-gnu/libxcb.so.1+0xde2b) Change-Id: Ia5024602d3aacb924b5dcd3956672da2a8f10feb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * Fix QXcbWindow::mapFrom/ToGlobal()J-P Nurmi2018-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | Call the base class implementations to avoid returning an unmapped values for non-embedded windows. Task-number: QTBUG-55251 Change-Id: Ib05fd530498dd4d72d3d4ef37caf4e2f0ebcd2e4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/dev' into 5.11Liang Qi2018-02-101-0/+13
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvarlengtharray.qdoc src/corelib/tools/qvector.qdoc Resolved documentation changes in favor of 017569f702b6dd0, which keeps the move overloads along with its const-ref sibling. Change-Id: I0835b0b3211a418e5e50defc4cf315f0964fab79
| * | XCB: Implement native window dump for diaglibFriedemann Kleint2018-01-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Extract a helper function to determine the window title from QXcbConnection and add an invokable function to the native interface that dumps the window tree similar to existing functionality on Windows. Change-Id: I5544d69ea2b801eb16d3b5b8d64021b3e567b0d8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | QPlatformWindow: add startSystemMove()Alexander Volkov2018-02-041-9/+23
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | It can be used by custom widgets or for example by the Breeze style from KDE, which allows to drag windows by some widgets. It's important on X11 because _NET_WM_MOVERESIZE requests induced by touch sequences require support from Qt. Task-number: QTBUG-58044 Change-Id: I31c37534555a9050cf361cad85bdef13c2808572 Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: If089d5010d15c33b3c1f13912d4386207456c1a9
| * | XCB: Replace qDebug with qCDebugOrgad Shaneh2018-01-151-1/+1
| | | | | | | | | | | | | | | Change-Id: I984c3e3288aa4d0b7185ea88ae0c4cf4627a2da3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | xcb: fix and optimize QXcbConnection::xi2SetMouseGrabEnabledGatis Paeglis2018-01-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What was broken: - m_xiGrab on successful ungrab (XIUngrabDevice) was never set to 'false'. Which means that we would unnecessarily call XIAllowTouchEvents, even when we are not grabbing (this did not have any apparent side effects). What was non optimal: - Redundant XIQueryDevice calls. XIQueryDevice with XIAllMasterDevices flag already returns all required devices. Calling XIQueryDevice for every id again does not make sense. - Querying for master pointer info on every grab is unnecessary. Simply cache ids of master devices whenever hierarchy changes. What remains to be investigated some time later (or never): The original and the re-factored code grabs all master pointer devices. Not sure if that is the expected behavior on MPX (Multi-pointer X) systems. Could there be two context menus, each dismissed separately? MPX concept was introduced in XI2.0, but testing shows that this setup is not very well supported even on modern desktop environments. Tested on Ubuntu 16.04, where multiple pointers is enough for crashing a terminal. Also AFAIK there isn't any bug reports about broken MPX support in Qt. Change-Id: I53f99c6efd44abc43a0985e15cff8aae7ebba8f1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | xcb: share code for QRegion -> xcb_rectangle_t[] conversionMarc Mutz2017-12-061-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... between QXcbWindow and QxcbShmImage. Replaces one QRegion::rects() call (to be deprecated), fixes potential overflows that QXcbShmImage did not handle, but QXcbWindow did, and saves ~1KiB of text size. Change-Id: I55d37021164feefe0cb3e60bd6d22b1976a6467b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | xcb: Speed-up image scrollingBłażej Szczygieł2017-11-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent image scrolling on client-side whenever possible - do it on server-side. When using shared memory use server-side pixmap for scrolled contents. Put new image which will be scrolled to the server-side pixmap and do scroll on it. Then do a server-side copy of a scrolled area from pixmap to he window. Also put non-scrolled image directly to the window. When not using shared memory also don't do redundand client-side image scrolling. When using OpenGL compositing first copy scrolled image area from/to server-side pixmap. Task-number: QTBUG-64414 Change-Id: Ibf5f8cfb40cd4fb3e4a75a1b92eecb625f4fd74f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devAllan Sandfeld Jensen2017-10-241-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/windows/qwindowsmousehandler.cpp src/plugins/platforms/xcb/qxcbimage.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/manual/qtabletevent/regular_widgets/main.cpp Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io> Done-with: Mårten Nordheim<marten.nordheim@qt.io> Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-231-1/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/direct2d/direct2d.pro src/plugins/platforms/ios/qiosclipboard.mm src/plugins/platforms/windows/windows.pro Change-Id: Idffa03b3990bd642784f528821c5446b2e1008ef
| | * xcb: Convert synthetic mouse enter event position to native pixelsBłażej Szczygieł2017-10-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mouse position is converted from native pixels later, so we must provide native pixels for "QWindowSystemInterface::handleEnterEvent". Amends 7091be1b7999d93fe2126042161dcd1d8fd20026 Task-number: QTBUG-63865 Change-Id: I813c171f2fc1d321af702ac30eb5f2e4232e97c4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | qpa: enhance mouse event with type and button dataGatis Paeglis2017-10-101-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate QWSI APIs that accepts mouse event without mouse button/ type data. In the early days of Qt5 it was decided to centralize mouse button/type handling in QGuiApplication (because of limitation of some now unknown platform). This has proven to be problematic as mouse handling details differ across platforms (e.g on X11 we do not receive mouse release event when closing popup windows or ordinary windows that are closed from the mouse press event). Instead of hacking around platform specific behaviors in Qt Gui, we should move this task back to platform plugins (similar to how this was done in Qt4 with native APIs sending mouse details directly to QApplication). There are even cases where it simply is not possible to deduce (from QGuiApplication) which button caused the event (e.g. when more than one button is involved and some event goes missing). Besisdes, throwing away information which is already available at QPA level (for free) and trying to deduce it again at Qt Gui level seems impractical, fagile (as probably noticed by people fixing all the unexpected issues) and adds unnecessary complexity. Note: Removing the deprecated QWSI APIs from offscreen plugin depends on fixing autotests that rely on QOffscreenCursor::setPos() logic. For the convenience of testing use QT_QPA_DISABLE_ENHANCED_MOUSE to restore to the old code path where QGuiApplication does the mouse state deducing. Other platforms have similar issues. I do not have all supported platform available on my desk, so other platform maintainers will need to take care of porting those platforms to the new APIs. And mainly, I don't want to deal with all the hacks that other platforms have added to workaround this broken mouse logic. In Qt6 we need to remove deprecated code path from QGuiApplication. This patch: - Extends QWindowSystemInterfacePrivate::MouseEvent ctor with QEvent::Type and Qt::MouseButton. We use this extra data when processing mouse events in QGuiApplication. This actually is similar to KeyEvent, where we do pass the type (press or release) to QtGui. - Refactors QGuiApplicationPrivate::processMouseEvent and qtestlib to use the new APIs. Task-number: QTBUG-59277 Task-number: QTBUG-62329 Task-number: QTBUG-63467 Change-Id: If94fd46a7cccfea8264dcb1368804c73334558b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | xcb: tidy up QXcbWindow::handleClientMessageEventGatis Paeglis2017-10-101-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Store "event->data.data32[0]" in a variable with a meaningful name. This improves code readility. - Use categorized logging. - Wrap lines where it makes sense (Qt Coding Style discorages more than 100 chars per line). Change-Id: I163abab8380b459fd349227f22dc417a444aefa7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | xcb: Unify visual to QImage::Format logicAllan Sandfeld Jensen2017-10-071-94/+9
| | | | | | | | | | | | | | | | | | | | | | | | Make a common function to replace the two existing ones that convert from XCB visuals to QImage format. Change-Id: I2ae08ef4df96df950910a45e71c9d9cd98375b2e Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | | Handle endian mismatch between X11 client and serverAllan Sandfeld Jensen2017-10-021-6/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the server and client has different endian we need to swizzle the image pixels, we can do that by swizzling the masks and try to match the new configuration. This is a rather rare setup so we don't try to match every combination. This patch fixes the colors when running Qt in a bigendian QEMU chroot. Change-Id: Ie83f9607563cba137b2e1a63e996a05d43ff603e Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-14/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | xcb: use XInput2 for mouse starting from 2.0 not 2.2Gatis Paeglis2017-08-091-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 53d289ec4c0f512a3475da4bbf1f940cd6838ac fixed the issue of not getting touch events when grabbing via the plain xcb functions. And due to wanting to support a setup where mouse events are delivered via core events it was chosen to use mouse via XI2 only when really necessary. Thus starting only from 2.2, the version from which the mouse+touch grabbing becomes the issue (XI2 introduced touch support from 2.2). The same patch states that using QT_XCB_NO_XI2_MOUSE restores to the old behavior (grabbing via core) with broken touch grabbing. Broken only with 2.2+, not 2.0 and 2.1 since those versions of protocol do not know about touch. All of this implies the following: 1) The user code that already depends on QT_XCB_NO_XI2_MOUSE, won't see any behavioural difference if we will use XInput starting from 2.0 for mouse. Mouse grabbing will continue to be done via core (xcb_grab_pointer) as mentioned above and thus touch grabbing will continue to be broken with 2.2+. 2) The code that has never cared how we get the native events (core vs xinput2), won't see any behavioural difference. In this case grabbing will always be done via XI2 (XIGrabDevice) grab when XI2.0+ is available. Since there is no difference in the outcome, we migth as well use XI2 for mouse from 2.0, not 2.2. Extension events are always better choice than core. Besides the broken touch grabbing issue with QT_XCB_NO_XI2_MOUSE, there are other issues with that code path, for details see internal documentation of xi2SelectDeviceEventsCompatibility(), where the conclusion is: *** If your code relies on QT_XCB_NO_XI2_MOUSE, then your code needs fixing. *** This patch also cleans up how we select XInput2 events, by separating the QT_XCB_NO_XI2_MOUSE code path. This has two benefits - improved code readability and will make the deprecation of QT_XCB_NO_XI2_MOUSE easier. The patch removes some sparse comments as the behavior is now documented in one place, see xi2SelectDeviceEventsCompatibility(). [ChangeLog][Platform Specific Changes][Linux] The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be removed in Qt 6. If your application relies on behavior set by QT_XCB_NO_XI2_MOUSE, it should be updated accordingly. [ChangeLog][Platform Specific Changes][Linux] Pointer event delivery on X11 is now done starting from XInput version 2.0 (when available) instead of 2.2. XInput support can be disabled by setting QT_XCB_NO_XI2=1 environment variable. Note that using QT_XCB_NO_XI2 would also disable tablet and touch support. Change-Id: I661b36d6710b9f6ec71fecc8287ba479432bff4c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | xcb: don't allow isAtLeastXI2{1,2} in builds without Xinput2Gatis Paeglis2017-07-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. thus making it purely into a _runtime_ check of XInput 2 version. If Qt was build with -no-xinput2, it does not make sense to compile in code that always returns "false". Simply exclude code that is not relevant for -no-xinput2 builds with XCB_USE_XINPUT2 ifdefs. In addition, this improves readability of the code. Now, trying to use ::isAtLeastXI21() in a -no-xinput2 build will result in the following build error: error: ‘class QXcbConnection’ has no member named ‘isAtLeastXI21’ Change-Id: If242510d43d71829b327edc1f76322f3a0db0e08 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>