Go to file
Richard Moe Gustavsen 78b6050d60 cocoa: be more careful about rejecting frame strut events
The m_buttons property is meant to hold the currently pressed mouse
buttons done on the contents part of a QNSView. But m_buttons can
sometimes get out of sync with AppKit (NSEvent.pressedMouseButtons).
One way this is shown to happen is if you do a mouse press on a native
child widget (that is backed by it's own QNSView), and then convert the
widget to a top-level window before the release. In that case, the
underlying QNSView will be reparented from one NSWindow to another,
which will result in the old NSWindow getting the mouseUp call instead
of the new window. The result is that we don't update m_buttons for
the reparented QNSView, which will instead be left as "pressed".

As a result of m_buttons being stuck in a faulty state, we also refuse
to send out QEvent::NonClientAreaMouseMove events to the top-level
widget. This because QNSView thinks that it's already in a dragging
state that started on the content part of the view (and not on the
strut). As a result, it can sometimes be impossible to dock a
QDockWidget back into a QMainWindow, since we basically don't send
out any frame-drag events to Qt for the new dock window.

We can reason that if you start a mouse press on the frame strut, you
cannot at the same time have an active mouse press on the view contents.
This patch will therefore remove the buttons that we know was pressed
on the frame strut from m_buttons. This will at least (be one way to)
clear the faulty pressed state, and will let us send mouse
press/drag/release (and after that, move) frame strut events to Qt.

Pick-to: 6.1 5.15
Task-number: QTBUG-70137
Change-Id: If51e1fe57d2531b659d39de85658893dae6391e3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-12 12:49:45 +00:00
.github/workflows Github Actions: many minor updates 2021-01-22 18:48:54 +01:00
bin CMake: Allow usage of QtStandaloneTestTemplateProject as package component 2021-04-23 13:31:04 +02:00
cmake Fix typo in FindWrapAtomic.cmake 2021-05-12 14:49:45 +02:00
coin Add instructions for Windows 10 on Arm config 2021-05-05 16:28:27 +03:00
config.tests Check whether CMake was built with zstd support 2021-04-16 16:49:28 +02:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Rewrite the fetchmore example 2021-04-23 12:43:28 +00:00
examples Style sheet example: Fix doc url for Qt 6 2021-05-08 01:35:44 +02:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec CMake: Make qt-internal-configure-tests relocatable 2021-04-26 23:11:28 +02:00
mkspecs Move qtwaylandscanner to libexec 2021-05-11 16:39:07 +00:00
qmake qmake: Clear caches before exiting 2021-05-06 23:49:20 +02:00
src cocoa: be more careful about rejecting frame strut events 2021-05-12 12:49:45 +00:00
tests QProperty: Cleanup QPropertyAlias leftovers 2021-05-11 22:22:08 +02:00
util pro2cmake: Add support for standalone CMake test configuration 2021-04-27 17:23:07 +02:00
.cmake.conf Bump version 2021-02-18 07:20:21 +02:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore .gitignore: Qt Creator files cleanup 2020-09-25 07:50:15 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.prev_configure.cmake CMake: Regenerate configure.cmake files 2021-04-27 21:33:48 +02:00
.prev_qt_cmdline.cmake CMake: Regenerate configure.cmake files 2020-09-28 15:48:17 +02:00
.qmake.conf Bump version 2021-02-18 07:20:21 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt CMake: Generate better Xcode iOS projects 2021-04-19 20:30:45 +02:00
config_help.txt Allow to load -developer-build without configurations into an IDE 2021-05-07 21:06:58 +02:00
configure Remove the -qmake and -cmake configure arguments 2021-03-11 16:39:50 +01:00
configure.bat Remove superfluous variable assignments from configure.bat 2021-03-11 16:39:54 +01:00
configure.cmake Fix wrong note "Using pthreads" and only show it for WASM 2021-04-29 23:09:06 +08:00
configure.json Fix wrong note "Using pthreads" and only show it for WASM 2021-04-29 23:09:06 +08:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
INSTALL INSTALL: Remove outdated reference to Windows CE 2019-02-13 13:01:57 +00:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPLv3 Remove LICENSE.GPLv3, LICENSE.LGPLv21, LGPL_EXCEPTION.txt 2018-04-16 11:02:14 +00:00
LICENSE.QT-LICENSE-AGREEMENT Update enterprise license agreement v4.2.1 2019-12-18 13:07:19 +02:00
qt_cmdline.cmake CMake: Build minimal subset of tests in desktop static builds 2021-04-06 09:15:37 +01:00
sync.profile Generate QUtf8StringView header file from qutf8stringview.h 2020-11-07 08:35:11 +00:00