Windows QPA: Simplify session manager checking code
Introduce convenience function sessionManagerInteractionBlocked() that is also present when session manager is disabled and reduce #ifdef-ery accordingly. Change-Id: Ifa211a3bf19901db669743a16acde6e6dc455f75 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
0133b59246
commit
1c919da99a
@ -121,12 +121,20 @@ static inline bool useRTL_Extensions()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
#if QT_CONFIG(sessionmanager)
|
||||||
static inline QWindowsSessionManager *platformSessionManager() {
|
static inline QWindowsSessionManager *platformSessionManager()
|
||||||
|
{
|
||||||
QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||||
QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
|
QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
|
||||||
return static_cast<QWindowsSessionManager *>(managerPrivate->platformSessionManager);
|
return static_cast<QWindowsSessionManager *>(managerPrivate->platformSessionManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool sessionManagerInteractionBlocked()
|
||||||
|
{
|
||||||
|
return platformSessionManager()->isInteractionBlocked();
|
||||||
|
}
|
||||||
|
#else // QT_CONFIG(sessionmanager)
|
||||||
|
static inline bool sessionManagerInteractionBlocked() { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int windowDpiAwareness(HWND hwnd)
|
static inline int windowDpiAwareness(HWND hwnd)
|
||||||
@ -896,11 +904,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
|
|
||||||
switch (et) {
|
switch (et) {
|
||||||
case QtWindows::GestureEvent:
|
case QtWindows::GestureEvent:
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#endif
|
|
||||||
case QtWindows::InputMethodOpenCandidateWindowEvent:
|
case QtWindows::InputMethodOpenCandidateWindowEvent:
|
||||||
case QtWindows::InputMethodCloseCandidateWindowEvent:
|
case QtWindows::InputMethodCloseCandidateWindowEvent:
|
||||||
// TODO: Release/regrab mouse if a popup has mouse grab.
|
// TODO: Release/regrab mouse if a popup has mouse grab.
|
||||||
@ -989,11 +993,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
case QtWindows::InputMethodKeyEvent:
|
case QtWindows::InputMethodKeyEvent:
|
||||||
case QtWindows::InputMethodKeyDownEvent:
|
case QtWindows::InputMethodKeyDownEvent:
|
||||||
case QtWindows::AppCommandEvent:
|
case QtWindows::AppCommandEvent:
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
|
|
||||||
#endif
|
|
||||||
case QtWindows::MoveEvent:
|
case QtWindows::MoveEvent:
|
||||||
platformWindow->handleMoved();
|
platformWindow->handleMoved();
|
||||||
return true;
|
return true;
|
||||||
@ -1013,18 +1013,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
return platformWindow->handleWmPaint(hwnd, message, wParam, lParam);
|
return platformWindow->handleWmPaint(hwnd, message, wParam, lParam);
|
||||||
case QtWindows::NonClientMouseEvent:
|
case QtWindows::NonClientMouseEvent:
|
||||||
if (platformWindow->frameStrutEventsEnabled())
|
if (platformWindow->frameStrutEventsEnabled())
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case QtWindows::ScrollEvent:
|
case QtWindows::ScrollEvent:
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
|
|
||||||
#endif
|
|
||||||
case QtWindows::MouseWheelEvent:
|
case QtWindows::MouseWheelEvent:
|
||||||
case QtWindows::MouseEvent:
|
case QtWindows::MouseEvent:
|
||||||
case QtWindows::LeaveEvent:
|
case QtWindows::LeaveEvent:
|
||||||
@ -1034,18 +1026,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
window = window->parent();
|
window = window->parent();
|
||||||
if (!window)
|
if (!window)
|
||||||
return false;
|
return false;
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
case QtWindows::TouchEvent:
|
case QtWindows::TouchEvent:
|
||||||
#if !defined(QT_NO_SESSIONMANAGER)
|
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
|
||||||
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#else
|
|
||||||
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
|
|
||||||
#endif
|
|
||||||
case QtWindows::FocusInEvent: // see QWindowsWindow::requestActivateWindow().
|
case QtWindows::FocusInEvent: // see QWindowsWindow::requestActivateWindow().
|
||||||
case QtWindows::FocusOutEvent:
|
case QtWindows::FocusOutEvent:
|
||||||
handleFocusEvent(et, platformWindow);
|
handleFocusEvent(et, platformWindow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user