macOS: Make alpha-based click-trough work again
Commit 3ea04c7d
made it so that we always set the
ignoresMouseEvent property on the NSWindow, based
on the WindowTransparentForInput flag.
However, this overwrites the magical secret initial
state where click-trough is determined based on window
content transparency - setting the property to false
makes the window capture all events.
Restore 5.6 behavior by not modifying ignoresMouseEvent
if we can. Toggling WindowTransparentForInput on and
off again is still broken.
Task-number: QTBUG-54830
Change-Id: I5f44ce14d9a7dc1713f9efb1ef929e2969838d90
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
37f3ed96eb
commit
c35fc43595
@ -1088,8 +1088,18 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||
setWindowZoomButton(flags);
|
||||
}
|
||||
|
||||
if (m_nsWindow)
|
||||
m_nsWindow.ignoresMouseEvents = flags & Qt::WindowTransparentForInput;
|
||||
// Make window ignore mouse events if WindowTransparentForInput is set.
|
||||
// Note that ignoresMouseEvents has a special initial state where events
|
||||
// are ignored (passed through) based on window transparency, and that
|
||||
// setting the property to false does not return us to that state. Instead,
|
||||
// this makes the window capture all mouse events. Take care to only
|
||||
// set the property if needed. FIXME: recreate window if needed or find
|
||||
// some other way to implement WindowTransparentForInput.
|
||||
if (m_nsWindow) {
|
||||
bool ignoreMouse = flags & Qt::WindowTransparentForInput;
|
||||
if (m_nsWindow.ignoresMouseEvents != ignoreMouse)
|
||||
m_nsWindow.ignoresMouseEvents = ignoreMouse;
|
||||
}
|
||||
|
||||
m_windowFlags = flags;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user