Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowspointerhandler.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSPOINTERHANDLER_H
5#define QWINDOWSPOINTERHANDLER_H
6
8#include <QtCore/qt_windows.h>
9
10#include <QtCore/qpointer.h>
11#include <QtCore/qscopedpointer.h>
12#include <QtCore/qsharedpointer.h>
13#include <QtCore/qhash.h>
14#include <QtGui/qevent.h>
15#include <qpa/qwindowsysteminterface.h>
16
18
19class QWindow;
20class QPointingDevice;
21
23{
25public:
27
30 bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
31 bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
32
33 const QPointingDevicePtr &touchDevice() const { return m_touchDevice; }
34 void setTouchDevice(const QPointingDevicePtr &d) { m_touchDevice = d; }
35 static QPointingDevicePtr createTouchDevice(bool mouseEmulation);
36
37 QWindow *windowUnderMouse() const { return m_windowUnderPointer.data(); }
38 void clearWindowUnderMouse() { m_windowUnderPointer = nullptr; }
39 void clearEvents();
40
42
43private:
44 bool translateTouchEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vTouchInfo, unsigned int count);
45 bool translatePenEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vPenInfo);
46 bool translateMouseWheelEvent(QWindow *window, QWindow *currentWindowUnderPointer, MSG msg, QPoint globalPos, Qt::KeyboardModifiers keyModifiers);
47 void handleCaptureRelease(QWindow *window, QWindow *currentWindowUnderPointer, HWND hwnd, QEvent::Type eventType, Qt::MouseButtons mouseButtons);
48 void handleEnterLeave(QWindow *window, QWindow *currentWindowUnderPointer, QPoint globalPos);
49
50#if QT_CONFIG(tabletevent)
52#endif
53
54 QPointingDevicePtr m_touchDevice;
55#if QT_CONFIG(tabletevent)
58#endif
59 QHash<int, QWindowSystemInterface::TouchPoint> m_lastTouchPoints;
60 QHash<DWORD, int> m_touchInputIDToTouchPointID;
61 QPointer<QWindow> m_windowUnderPointer;
62 QPointer<QWindow> m_currentWindow;
63 QWindow *m_previousCaptureWindow = nullptr;
64 bool m_needsEnterOnPointerUpdate = false;
65 QEvent::Type m_lastEventType = QEvent::None;
66 Qt::MouseButton m_lastEventButton = Qt::NoButton;
67 DWORD m_pointerType = 0;
68 static qint64 m_nextInputDeviceId; // workaround until we know how to get system device IDs
69};
70
71QT_END_NAMESPACE
72
73#endif // QWINDOWSPOINTERHANDLER_H
\inmodule QtCore\reentrant
Definition qpoint.h:29
Singleton container for all relevant information.
QSharedPointer< QWindowCreationContext > windowCreationContext() const
QWindowsScreenManager & screenManager()
QWindowsWindow * findClosestPlatformWindow(HWND) const
QWindow * findWindow(HWND) const
bool asyncExpose() const
void addWindow(HWND, QWindowsWindow *w)
static bool systemParametersInfoForScreen(unsigned action, unsigned param, void *out, const QPlatformScreen *screen=nullptr)
static bool setProcessDpiAwareness(QtWindows::DpiAwareness dpiAwareness)
HDC displayContext() const
QWindowsTabletSupport * tabletSupport() const
static bool systemParametersInfoForWindow(unsigned action, unsigned param, void *out, const QPlatformWindow *win=nullptr)
static void setTabletAbsoluteRange(int a)
QWindowsWindow * findPlatformWindowAt(HWND parent, const QPoint &screenPoint, unsigned cwex_flags) const
bool initTouch(unsigned integrationOptions)
HWND createDummyWindow(const QString &classNameIn, const wchar_t *windowName, WNDPROC wndProc=nullptr, DWORD style=WS_OVERLAPPED)
Convenience to create a non-visible, message-only dummy window for example used as clipboard watcher ...
void setAsyncExpose(bool value)
QSharedPointer< QWindowCreationContext > setWindowCreationContext(const QSharedPointer< QWindowCreationContext > &ctx)
bool windowsProc(HWND hwnd, UINT message, QtWindows::WindowsEventType et, WPARAM wParam, LPARAM lParam, LRESULT *result, QWindowsWindow **platformWindowPtr)
Main windows procedure registered for windows.
unsigned systemInfo() const
static QtWindows::DpiAwareness processDpiAwareness()
QWindowsWindow * findPlatformWindow(HWND) const
QWindow * keyGrabber() const
QWindowsWindow * findPlatformWindow(const QWindowsMenuBar *mb) const
QWindow * windowUnderMouse() const
QPlatformKeyMapper * keyMapper() const
bool useRTLExtensions() const
static bool systemParametersInfo(unsigned action, unsigned param, void *out, unsigned dpi=0)
QWindowsMimeRegistry & mimeConverter() const
static bool isSessionLocked()
int screenDepth() const
bool initPowerNotificationHandler()
HandleBaseWindowHash & windows()
static QWindowsContext * instance()
QString registerWindowClass(QString cname, WNDPROC proc, unsigned style=0, HBRUSH brush=nullptr, bool icon=false)
void setDetectAltGrModifier(bool a)
Platform cursor implementation.
static bool hasOverrideCursor()
static void enforceOverrideCursor()
Windows Input context implementation.
static void setWindowsImeEnabled(QWindowsWindow *platformWindow, bool enabled)
static QWindowsIntegration * instance()
Translates Windows keys to QWindowSystemInterface events.
bool translateKeyEvent(QWindow *widget, HWND hwnd, const MSG &msg, LRESULT *result)
To be called from the window procedure.
bool detectAltGrModifier() const
void setUseRTLExtensions(bool e)
QWindow * keyGrabber() const
Qt::KeyboardModifiers queryKeyboardModifiers() const override
bool useRTLExtensions() const
void setKeyGrabber(QWindow *w)
void setDetectAltGrModifier(bool a)
QList< QKeyCombination > possibleKeyCombinations(const QKeyEvent *e) const override
Windows native menu bar.
Manages the list of QWindowsMimeConverter instances.
QWindow * windowUnderMouse() const
static QPointingDevicePtr createTouchDevice(bool mouseEmulation)
QWindowsPointerHandler()=default
static Qt::MouseButtons queryMouseButtons()
const QPointingDevicePtr & touchDevice() const
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
void setTouchDevice(const QPointingDevicePtr &d)
Manages a list of QWindowsScreen.
Tablet support for Windows.
static QWindowsTheme * instance()
Raster or OpenGL Window.
void alertWindow(int durationMs=0)
void checkForScreenChanged(ScreenChangeMode mode=FromGeometryChange)
bool testFlag(unsigned f) const
void setFlag(unsigned f) const
void clearFlag(unsigned f) const
static void settingsChanged()
static const char * embeddedNativeParentHandleProperty
QWindowsMenuBar * menuBar() const
bool frameStrutEventsEnabled() const override
Reimplement this method to return whether frame strut events are enabled.
@ WithinSetParent
Automatic mouse capture on button press.
void handleCompositionSettingsChanged()
WindowsEventType
Enumerations for WM_XX events.
@ PointerActivateWindowEvent
@ InputMethodEndCompositionEvent
@ ShowEventOnParentRestoring
@ InputMethodCompositionEvent
@ InputMethodOpenCandidateWindowEvent
@ MouseActivateWindowEvent
@ DpiChangedAfterParentEvent
@ InputMethodStartCompositionEvent
@ CompositionSettingsChanged
@ InputMethodCloseCandidateWindowEvent
@ AccessibleObjectFromWindowRequest
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
#define WM_TOUCH
#define DPI_AWARENESS_CONTEXT_UNAWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED
static bool isTopLevel(HWND hwnd)
#define LANG_SYRIAC
static RECT rectFromNcCalcSize(UINT message, WPARAM wParam, LPARAM lParam, int n)
static bool enableNonClientDpiScaling(HWND hwnd)
static bool isInputMessage(UINT m)
static DPI_AWARENESS_CONTEXT qtDpiAwarenessToDpiAwarenessContext(QtWindows::DpiAwareness dpiAwareness)
static bool isMinimized(HWND hwnd)
static QMargins marginsFromRects(const RECT &frame, const RECT &client)
static bool useRTL_Extensions()
static bool sessionManagerInteractionBlocked()
static QWindowsInputContext * windowsInputContext()
static QtWindows::DpiAwareness dpiAwarenessContextToQtDpiAwareness(DPI_AWARENESS_CONTEXT context)
static QByteArray nativeEventType()
static bool isEmptyRect(const RECT &rect)
static bool findPlatformWindowHelper(const POINT &screenPoint, unsigned cwexFlags, const QWindowsContext *context, HWND *hwnd, QWindowsWindow **result)
Find a child window at a screen point.
WindowsNativeModifiers
@ ScrollLock
@ ExtendedKey
@ ShiftRight
@ LockAny
@ AltLeft
@ ShiftLeft
@ MetaRight
@ MetaLeft
@ MetaAny
@ AltRight
@ ControlLeft
@ ControlRight
@ CapsLock
@ NumLock
@ ShiftAny
@ ControlAny
quint32 qtKey[NumQtKeys]
static const size_t NumQtKeys
const HRESULT m_oleInitializeResult
QWindowsKeyMapper m_keyMapper
QWindowsPointerHandler m_pointerHandler
QSet< QString > m_registeredWindowClassNames
QWindowsScreenManager m_screenManager
QWindowsMimeRegistry m_mimeConverter
QWindowsContext::HandleBaseWindowHash m_windows
QSharedPointer< QWindowCreationContext > m_creationContext