summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* xcb: Fix logic for minimized stateJiDe Zhang2020-03-031-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix geometry handling for native child windowsFriedemann Kleint2020-02-281-1/+3
| | | | | | | | | | | | Don't move the native child window position for native child windows. Initial-patch-by: Błażej Szczygieł <spaz16@wp.pl> Task-number: QTBUG-82312 Fixes: QTBUG-79166 Change-Id: I117ef08da13c8e90ff60cf034126c9efdc17b836 Reviewed-by: Błażej Szczygieł <mumei6102@gmail.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* xcb: Propagate size hints when window changes its scaling factorBłażej Szczygieł2020-01-081-0/+5
| | | | | | | | | | 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>
* QPoint/F: add transposed()Marc Mutz2019-08-071-1/+1
| | | | | | | | | | | | For symmetry with QSize and QRect and because there were some users in Qt. Port those users. [ChangeLog][QtCore][QPoint/QPointF] Added transposed(). Change-Id: If4f23dbcf7d67983a6b1885e0d1d538115b49e2b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-101-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/time/qdatetime.cpp src/widgets/widgets/qcombobox.h Change-Id: Ib84352e8fe34aed2986a1c94e7346a46a71c803b
| * xcb: reduce focus-in delayGatis Paeglis2019-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch amends fe63900dc9891dd355ca1f10d6c7e5fd1516f5d5 The previous value of 400ms was a random and seemingly harmless choice. It turns out that 400ms is a bit too long and interferes with x11 async behavior tweaks in the VirtualBox source code. The original aim of specifying a concrete delay was to fix the nondeterministic behavior of the pre-existing code and to avoid flickering on KWin caused by waiting too little. This patch changes 400ms -> 100ms, which seems to work better in practice. Fixes: QTBUG-76742 Change-Id: Ia8168216819ac41d0124622c9472a98a1877262f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Widen out parameter "result" of the native event filters for Qt 6Friedemann Kleint2019-03-221-0/+4
|/ | | | | | | | | LRESULT on Windows 64 is a 64bit type, adapt filter functions of QAbstractNativeEventFilter and QAbstractEventDispatcher accordingly. Fixes: QTBUG-72968 Change-Id: Ie53193e355f0b8e9bd59fa377f43e2b4664a2ded Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: rework focus-in peeker so we can drop PeekFunc APIGatis Paeglis2019-01-041-29/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API for registering temporary peek function was added ~7 years ago by 78264f333eb7c262380714ed6517562266f11a03. It was never been used for anything else. The solution from 78264f333 also did not work very well on KDE desktop, quoting Martin Flöser: "In case the keyboard gets grabbed by another process and immediately ungrabbed the active Qt application window receives a FocusOut and a FocusIn event. FocusOut on the grab of keyboard, FocusIn on the ungrab. Qt registers a peek function for checking the FocusIn event, but the timespan is too short: the new event is not yet queued. This causes a QEvent::WindowDeactivate being emitted, followed directly by a QEvent::WindowActivate. This has quite some side effects, for example rendering flickering in the GUI (switching to inactive/active in short time frame), hooks on WindowDeactivate being run, etc. Real world examples for such short keyboard grabs are global shortcut listener applications like kglobalaccel5. It has e.g. a passive key grab on the mute key, which is then turned into an active grab when the key is grabbed. Kglobalaccel5 immediately ungrabs the keyboard and flushes the connection if it gets a key event, but it of course causes the sequence of FocusOut and FocusIn events in the active Qt window." Reworked the code to use QTimer instead, which is more elegant solution, because it does not rely on race-conditions, but uses a concreate time to wait instead. Also the need to write focusInPeeker() caused us to duplicate event handlers that were present already elsewhere. Change-Id: I647e52fb2634fdf55a640e19b13265c356f96c95 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: remove old work-around for building with util-wmGatis Paeglis2018-11-301-54/+29
| | | | | | | | | | | | | | | | | | Commits that added this code: 7ce8491280990350162933a0716d1b014f65aeb6 and f005dee1b3692a09e47782dcff9b5b07aa659b51 I guess this was a work-around, before we started bundling XCB libs a year later in 21bd66e1ea06e466754ab06ee2c5f8b737bb4bd7 0.3.8 was released in 2011-04-26 and we are bundling 0.3.9, so it is safe to remove the include work-around as well. Change-Id: I5794f40d86e10ebdad984aa4b61311979aaadcf3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: fix issue with dialogs hidden by other windowsGatis Paeglis2018-11-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a regression from Qt4, due to not setting the window group leader in WM_HINTS property. Qt4 did set this property. It was not obvious that something was missing because of the similarly named WM_CLIENT_LEADER property, which we do set. Testing revealed that setting WM_CLIENT_LEADER is sufficient on some DEs, e.g. KDE, Unity, but did not have the desired effect on e.g Gnome and XFCE. EWMH/ICCCM specs are known to be ambiguous, WM_CLIENT_LEADER is only mentioned in the section on the session management, so it is not surprising that there is this inconsistency between various WMs. This patch merely restores a lost WM hint. This solves the reported issues on major desktops. If we support calling show() on a dialog before its parent has been shown is still an open question, which should be handled in QTBUG-72040. Task-number: QTBUG-56829 Fixes: QTBUG-46626 Fixes: QTBUG-70756 Task-number: QTBUG-72040 Change-Id: Id2c575850e5f4f5af3e57963c577d33572e30b6e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.12.0' into 5.12Liang Qi2018-11-051-0/+2
|\ | | | | | | Change-Id: I12f26470e01a8582d0f02f51e20d5b742bd95d6f
| * Fix out of bounds memory access when setting motif window hint propertiesSimon Hausmann2018-10-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b4bd5f9df3e69da707513ba544537c80a8564fb4 removed two members from the mwm hints structure but told xcb_change_property that the structure has still five members when it had been reduced to three. This lead to xcb_change_property accessing memory out of bounds. As identified by Gatis, the safest option to avoid the access is to add the two members again. Other window managers may be expecting their presence in the window property. Change-Id: Id4f0c9536cd317c35f2c6ebd1ac9ccc6f72de6a5 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* | xcb: cleanup _NET_WM_STATE handlingGatis Paeglis2018-11-011-87/+95
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: cleanup _MOTIF_WM_HINTS handlingGatis Paeglis2018-10-171-116/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: cleanup WM_HINTS handlingGatis Paeglis2018-10-151-23/+13
| | | | | | | | | | | | | | | - The only place where window flag Qt::WindowDoesNotAcceptFocus changes is inside QXcbWindow::setWindowFlags and from there we call updateDoesNotAcceptFocus(). The current code was redundantly calling xcb_wm_hints_set_input in various places. - Similar as above: call xcb_wm_hints_set_normal/iconic only where it can change. This hint depends on window state, so update it only from setWindowState(). Removed unnecessary call to setTransparentForMouseEvents(), which is already called few lines above from setWindowFlags(). Change-Id: I8da919b135a4dfda0c8c1dad51d85d3e706153ab Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: lock-free event processingGatis Paeglis2018-10-141-19/+16
| | | | | | | | | | | | | | | | | For details how this works refer to the documentation in the patch. The follow-up patches will switch to calling processXcbEvents() on every event loop iteration. With the existing code that would mean frequent locking of shared data (event queue). Acquiring a lock is fast, but lock contention isn't. To avoid potential problems, reimplement xcb event processing to be lock-free. Besides theoretical performance benefits, this definitally improves code readability in qxcbconnection.cpp. Thanks to Mikhail Svetkin for questioning the design of the existing code. Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io> Change-Id: I935f2b6ca802580f5c80205aef7b2f9afc172d26 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: Extract QXcbWindow::isTrayIconWindow()Alexander Volkov2018-09-291-1/+1
| | | | | | | | 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: Initialize OpenGL integration only when requiredAlexander Volkov2018-09-291-2/+5
| | | | | | | | | | | In some cases OpenGL integration may be unnecessary, e.g. an application may set Qt::AA_ForceRasterWidgets attribute and don't use OpenGL in any other way. In addition OpenGL initialization can take noticeable time on some configurations. So do it on demand only. Change-Id: If88953f8d5c826bc96fd49eb397b5e1ad693546d Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* 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>