summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.h
Commit message (Collapse)AuthorAgeFilesLines
* XCB: Suppress leave event, when mouse leaves with button pressedAxel Spoerl9 days1-0/+1
| | | | | | | | Fixes: QTBUG-124003 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I232f731b4b5f9e332b1297e5fdae2cadbdf2db1a Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Błażej Szczygieł <mumei6102@gmail.com>
* QXcbWindow: protect access to m_mapped with a QMutexAxel Spoerl2023-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QXcbWindow::requestActivateWindow() is called from the main thread, while handleMapNotifyEvent() is called from the XCB event thread. In a data race, handleMapNotifyEvent sets m_mapped to true, before requestActivateWindow() checks if it is false and sets m_deferredActivation to true. If that happens, a window activation is skipped until the next window systems event is processed. This is harmless in a normal application environment, where each mouse move causes window systems events to be processed. In an autotest environment, it causes flakiness, because an expected window activation may or may not happen. As a workaround, QApplicationPrivate::setActiveWindow() is frequently called after QWidget::activateWindow() or QWindow::requestActivate(), to set the active window on application level. In essence, this is setting expected outcome of a skipped deferred activation by force. This patch protects access to m_mapped and m_deferredActivation with a QMutex in both methods. That prevents the data race and ensures all deferred activations processed. Calling QApplicationPrivate::setActiveWindow() after activation on window/widget level becomes redundant. Task-number: QTBUG-119287 Pick-to: 6.6 6.5 Change-Id: I2eee69292afe0ef6381880a10d4e8483c2c7cbfa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: update WM_TRANSIENT_FOR on transientParent native window recreationLiang Qi2023-11-161-0/+5
| | | | | | | | | It follows f9e4402ffeef791e66b7b2f2cc332000df7f5cd4. Fixes: QTBUG-105395 Pick-to: 6.6 6.5 Change-Id: I399c448517b7dbdc28ba33f75ae43102836a8998 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: make QXcbWindow inherit QObjectLiang Qi2023-11-161-1/+3
| | | | | | Pick-to: 6.6 6.5 Change-Id: I418305f1e66bdf90b8bda724976916e320012961 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: Reflect geometry of foreign window on creationTor Arne Vestbø2023-09-121-2/+1
| | | | | | Pick-to: 6.6 Change-Id: I305b256696a32454f64c12c5a8901b65506fc520 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Plugins: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-05-041-1/+1
| | | | | | | Task-number: QTBUG-98434 Change-Id: If64c294033c114ae46dfc327c40da7f3c7a598f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* xcb: recreate xcb window under some conditionsLiang Qi2022-04-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Some netWmState needs to be set during unmap/hide(), which is too difficult to follow, and causes m_mapped status out of sync very easily sometimes, which we had tried in e946e6895a8517a887ac246905e0769edd766fcc . Destroy the xcb window and recreate new could make the thing much easier. This practice is also used in other platforms, such as cocoa plugin. In Qt 4, the platform window was destoryed and re-created in this situation on all platforms, which was not ported into Qt5. See also the code between setWinId(0) and createWinId() in QWidgetPrivate::setParent_sys() in qwidget_x11.cpp/qwidget_win.cpp/ qwidget_mac.mm. Fixes: QTBUG-69515 Fixes: QTBUG-73485 Fixes: QTBUG-81341 Pick-to: 6.3 6.2 5.15 Change-Id: If55c57a198bc785719b61b8748dabd8281c9639d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert "xcb: implement missing bits from ICCCM 4.1.4 WM_STATE handling"Liang Qi2022-04-191-16/+0
| | | | | | | | | | | | | | | | | | This reverts commit e946e6895a8517a887ac246905e0769edd766fcc. It clears the duplicate show() and hide() too aggressive in handleDeferredTasks() and can cause visible states out of sync between qt and system(x11) when user switches visible on and off very frequently. This change also reverts 28138aa80a14279a72af2818f5bbbaa670283964. Fixes: QTBUG-101347 Fixes: QTBUG-99810 Task-number: QTBUG-69515 Pick-to: 6.2 6.3 5.15 Change-Id: I419c324634be8ee6884e02032bb53a42738305ac Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: Implement support for touchpad gesturesPovilas Kanapickas2021-11-151-0/+4
| | | | | | | | | | | | | | | | | | | | They map to the data exposed by libinput exactly the same way as touchpad gestures on Wayland. The implementation is functionally the same and follows the same patterns to preserve similar behavior across X11 and Wayland. For example, we use the last known pointer position as the position for gestures, even though on X11 this data is available as part of events. The new implementation is only enabled if the used xcb supports the required APIs. [ChangeLog][Platform Specific Changes][X11] Touchpads can now detect multi-finger gestures and send RotateNativeGesture, ZoomNativeGesture and PanNativeGesture events, since XInput 2.4 and X Server 21.1. Change-Id: If404dcf8385210deadeb7e7c6d29171e9abc9e50 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: implement missing bits from ICCCM 4.1.4 WM_STATE handlingGatis Paeglis2021-08-101-0/+16
| | | | | | | | | | | | | | | | | | | | ICCCM 4.1.4 says: Clients that want to re-use a client window (e.g. by mapping it again) after withdrawing it must wait for the withdrawal to be complete before proceeding. The preferred method for doing this is for clients to wait for a windown manager to update or remove the WM_STATE property. This patch implements the required logic. Qt 4 had something similar. Without this patch we are calling various setter functions on a native window while it is in an undefined state. Fixes: QTBUG-69515 Pick-to: 6.2 5.15 Done-with: Liang Qi <liang.qi@qt.io> Change-Id: I377a66ad3d5e43f14465d0ea670b2f43f96ed7d3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Rename the new platform APIs from QPlatformInterface to QNativeInterfaceTor Arne Vestbø2020-10-071-1/+1
| | | | | | | | | | | | 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: Reduce number of created colormapsAlexander Volkov2020-09-161-1/+0
| | | | | | | | | | 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>
* Add QXcbWindow platform interfaceTor Arne Vestbø2020-07-201-13/+8
| | | | | | Task-number: QTBUG-84220 Change-Id: I8bb4288f1ac06d77fb4f43ae091fa1712f694eeb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-061-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Make QtPlatformHeaders a private moduleTor Arne Vestbø2020-07-061-1/+1
| | | | | | | | | | | The APIs will be reintroduced as part of the new platform interface API where appropriate. Clients that still depend on the platform headers can include it via QT += platformheaders-private. Change-Id: Ifbd836d833d19f3cf48cd4f933d7fe754c06d2d9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-03-111-1/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/plugin/qlibrary.cpp src/corelib/plugin/qlibrary_unix.cpp src/corelib/plugin/qpluginloader.cpp Change-Id: I866feaaa2a4936ee5389679724c8471a5b4b583d
| * xcb: Fix logic for minimized stateJiDe Zhang2020-03-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When _NET_WM_STATE_HIDDEN is not contains in the _NET_WM_STATE window property, the window should not be considered to be minimized According to https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html _NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate that a window would not be visible on the screen if its desktop/viewport were active and its coordinates were within the screen bounds. The canonical example is that minimized windows should be in the _NET_WM_STATE_HIDDEN state. Pagers and similar applications should use _NET_WM_STATE_HIDDEN instead of WM_STATE to decide whether to display a window in miniature representations of the windows on a desktop. For mutter/GNOME Shell, without _NET_WM_STATE_HIDDEN, window manager will not reply XCB_ICCCM_WM_STATE_ICONIC settings in WM_CHANGE_STATE client message. Task-number: QTBUG-76147 Task-number: QTBUG-76354 Task-number: QTBUG-68864 Done-With: Liang Qi <liang.qi@qt.io> Change-Id: Ic9d26d963979b7f0ef4d1cf322c54ef8c40fa004 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Add QWindow::startSystemMove and startSystemResizeJohan Klokkhammer Helsing2020-01-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-091-0/+2
|\| | | | | | | Change-Id: I9b4816b4aa6f0c51a446742db58b9d0dcf69aa09
| * xcb: Propagate size hints when window changes its scaling factorBłażej Szczygieł2020-01-081-0/+2
| | | | | | | | | | | | | | | | | | | | Properly scale size hints to the new scaling factor. Fixes: QTBUG-80476 Change-Id: I1081c9b01560f7e434f0f1de0199ef3d3cae787c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | 3rdparty: remove xcb libs and bump minimal required version to 1.11Gatis Paeglis2019-08-271-2/+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.12' into devLiang Qi2019-06-251-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/android/qandroidinputcontext.cpp src/widgets/styles/qstylesheetstyle.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
| * Track swap interval in QXcbWindowErik Kurzinger2019-06-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per GLX_EXT_swap_control, the GLX swap interval is specified on a per-drawable basis. However, QGLXContext only tracks it per-context using the m_swapInterval member. If a new drawable is made current to a context, it is still necessary to call glXSwapIntervalEXT to change the swap interval, even if it has been previously called for the same context with a different drawable. However, currently, QGLXContext::makeCurrent doesn't do this if its m_swapInterval field matches the new swap interval. This change removes m_swapInterval from QGLXContext, instead tracking it in QXcbWindow. This still avoids unnecessary calls to glXSwapIntervalEXT, while ensuring the swap interval is always set for new window drawables. Change-Id: Idc34101476c6af618059f6f3d8925dee743994a3 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | More nullptr usage in headersKevin Funk2019-03-141-1/+1
|/ | | | | | | | | | | 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: cleanup _NET_WM_STATE handlingGatis Paeglis2018-11-011-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use function name overloading for all of _NET_WM_STATE setters for a mapped window, instead of few similar sounding functions, where all do the same thing. For an unmapped window rename updateNetWmStateBeforeMap() -> setNetWmStateOnUnmappedWindow(). Merge setNetWmStates(NetWmStates) into setNetWmStateOnUnmappedWindow() and add a comment explaining why it does what it does, as it was not obvious. Internally there are 2 variants: a) When a window is already mapped, to change the window state we send XCB_CLIENT_MESSAGE(_NET_WM_STATE) messages to the root window as per EWMH spec. The Window Manager MUST keep this property updated to reflect the current state of the window. If this variant of the overload is called while a window is not mapped yet, it does nothing. WM would ignore this message anyway. The state change is not lost, it will be set later and that is where the second variant comes in. b) On an unmapped window we can set _NET_WM_STATE by using setNetWmStateOnUnmappedWindow(). This function will read QWindow properties and set all of them via one xcb_change_property(_NET_WM_STATE) call. We do this inside QXcbWindow::show(), where we know that QWindow state properties won't change anymore until it gets mapped. Once it is mapped, we use the other variant. This patch doesn't change any functionality, just makes the code easier to follow. Change-Id: I4f4703a35de083fcfd398112eabd0a5aec358e51 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* xcb: remove leftover functionGatis Paeglis2018-10-311-1/+0
| | | | | | | It was forgotten in 4050ee6ac7da0e5e7414c699c3cd4e26193c653d Change-Id: Icace56161b8ae372dba105f82da0d1c1b69542c1 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: cleanup _MOTIF_WM_HINTS handlingGatis Paeglis2018-10-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing code was difficult to follow, it contained some code duplication, inconsistencies and legacy code (mwm/dtwm support). Most of this code was copied over from Qt 4 as is, with some unexplainable (accidental?) modifications. Most of Motif code was never ported over to Qt5. In addition to the properties and protocols described in ICCCM, Motif uses properties and protocols of its own. In Qt4 we had an implementation of Motif DnD protocol. This was never ported over and mentions of this support was removed on Oct 2012, 4c41cb48d0356a28190c300fd4cc5e03f824b870. Nobody has complained for all these years, so it is safe to remove the remaining leftovers. Motif style support also was removed around the same time 4c41cb48d0356a28190c300fd4cc5e03f824b870. Keeping only those Motif hints that do not have any replacement in modern window manager specifications - decorations hints. MWM_INPUT_*MODEL* in modern specs was replaced by _NET_WM_STATE_MODAL The existing code was setting _MOTIF_WM_HINTS from 2 places - from QWindow setter (::setWindowFlags) and again before mapping the window (::show). We don't need the logic from updateMotifWmHintsBeforeMap(). That function read the current value of _MOTIF_WM_HINTS and merged in few additional hints, hints that are not relevant based on all the reasons from above. Change-Id: I9cb10bcad9bfac8762e3909895c2e9de613e622c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Extract QXcbWindow::isTrayIconWindow()Alexander Volkov2018-09-291-1/+4
| | | | | | | | Introduce this static function to detect tray icon windows. The old non-static method was unused, so drop it. Change-Id: Ia97b8a857bd1807ecd56340efbc9b145844d593e Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: cleanup QXcbConnection::handleXcbEvent()Gatis Paeglis2018-08-161-1/+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: Use functors in QXcbConnection::checkEvent()Gatis Paeglis2018-08-161-2/+0
| | | | | | | | | | | | | | | | | ... 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>
* Merge branch '5.11' into devEdward Welbourne2018-07-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: move XSync extensions initialization to QXcbConnectionGatis Paeglis2018-06-281-1/+0
| | | | | | | | | | | | | | | | ... 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-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | Change-Id: Ib581a582059e196567514f40b1964696ceaf3a88 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Move default implementation of update requests to QPlatformWindowTor Arne Vestbø2018-05-071-1/+1
| | | | | | | | | | 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-3/+0
|\| | | | | | | Change-Id: I8c353b4c53e90434453c76691eac39a894d23b49
| * xcb: fix bitmap cursor loading performance regressionGatis Paeglis2018-04-141-3/+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-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | - 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/dev' into 5.11Liang Qi2018-02-101-0/+2
|\ | | | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | 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-1/+3
|/ | | | | | | | | | | | | | 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>
* xcb: share code for QRegion -> xcb_rectangle_t[] conversionMarc Mutz2017-12-061-0/+2
| | | | | | | | | | ... 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>
* qpa: enhance mouse event with type and button dataGatis Paeglis2017-10-101-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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: Unify visual to QImage::Format logicAllan Sandfeld Jensen2017-10-071-1/+1
| | | | | | | | 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-0/+1
| | | | | | | | | | | | 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>
* xcb: use XInput2 for mouse starting from 2.0 not 2.2Gatis Paeglis2017-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>