Win: Account for windows which are WindowTransparentForInput

Task-number: QTBUG-57864
Change-Id: I8793aaa3719fbcf97f95ae462135cbf6b5823097
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Andy Shaw 2017-01-02 08:10:57 +01:00
parent 2ed9a52ebf
commit af5c8d04fb
2 changed files with 14 additions and 18 deletions

View File

@ -990,11 +990,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::MouseWheelEvent:
case QtWindows::MouseEvent:
case QtWindows::LeaveEvent:
{
QWindow *window = platformWindow->window();
while (window->flags() & Qt::WindowTransparentForInput)
window = window->parent();
if (!window)
return false;
#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
return d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#endif
}
case QtWindows::TouchEvent:
#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);

View File

@ -313,7 +313,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// events, "click-through") can be considered as the window under mouse.
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
while (currentWindowUnderMouse && currentWindowUnderMouse->flags() & Qt::WindowTransparentForInput)
currentWindowUnderMouse = currentWindowUnderMouse->parent();
// QTBUG-44332: When Qt is running at low integrity level and
// a Qt Window is parented on a Window of a higher integrity process
// using QWindow::fromWinId() (for example, Qt running in a browser plugin)
@ -432,22 +433,10 @@ static bool isValidWheelReceiver(QWindow *candidate)
static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta,
Qt::Orientation orientation, Qt::KeyboardModifiers mods)
{
// Redirect wheel event to one of the following, in order of preference:
// 1) The window under mouse
// 2) The window receiving the event
// If a window is blocked by modality, it can't get the event.
QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE);
bool handleEvent = true;
if (!isValidWheelReceiver(receiver)) {
receiver = window;
if (!isValidWheelReceiver(receiver))
handleEvent = false;
}
if (handleEvent) {
QWindowSystemInterface::handleWheelEvent(receiver,
QWindowsGeometryHint::mapFromGlobal(receiver, globalPos),
if (isValidWheelReceiver(window)) {
QWindowSystemInterface::handleWheelEvent(window,
QWindowsGeometryHint::mapFromGlobal(window, globalPos),
globalPos, delta, orientation, mods);
}
}