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
qwindowsguieventdispatcher.cpp
Go to the documentation of this file.
1// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
7
8#include <qpa/qwindowsysteminterface.h>
9
10#include <QtCore/QCoreApplication>
11#include <QtCore/QDebug>
12
14
15/*!
16 \class QWindowsGuiEventDispatcher
17 \brief Event dispatcher for Windows
18
19 Maintains a global stack storing the current event dispatcher and
20 its processing flags for access from the Windows procedure
21 qWindowsWndProc. Handling the QPA gui events should be done
22 from within the qWindowsWndProc to ensure correct processing of messages.
23
24 \internal
25*/
26
27QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
28 QEventDispatcherWin32(parent)
29{
30 setObjectName(QStringLiteral("QWindowsGuiEventDispatcher"));
31}
32
33bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
34{
35 const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
36 m_flags = flags;
37 const bool rc = QEventDispatcherWin32::processEvents(flags);
38 m_flags = oldFlags;
39 return rc;
40}
41
42void QWindowsGuiEventDispatcher::sendPostedEvents()
43{
44 QEventDispatcherWin32::sendPostedEvents();
45 QWindowSystemInterface::sendWindowSystemEvents(m_flags);
46}
47
48// Helpers for printing debug output for WM_* messages.
55
56static const MessageDebugEntry
58 {WM_CREATE, "WM_CREATE", true},
59 {WM_PAINT, "WM_PAINT", true},
60 {WM_CLOSE, "WM_CLOSE", true},
61 {WM_DESTROY, "WM_DESTROY", true},
62 {WM_MOVE, "WM_MOVE", true},
63 {WM_SIZE, "WM_SIZE", true},
64 {WM_GETICON, "WM_GETICON", false},
65 {WM_KEYDOWN, "WM_KEYDOWN", true},
66 {WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true},
67 {WM_SYSCOMMAND, "WM_SYSCOMMAND", true},
68 {WM_KEYUP, "WM_KEYUP", true},
69 {WM_SYSKEYUP, "WM_SYSKEYUP", true},
70#if defined(WM_APPCOMMAND)
71 {WM_APPCOMMAND, "WM_APPCOMMAND", true},
72#endif
73 {WM_IME_CHAR, "WM_IMECHAR", true},
74 {WM_IME_KEYDOWN, "WM_IMECHAR", true},
75 {WM_CANCELMODE, "WM_CANCELMODE", true},
76 {WM_CHAR, "WM_CHAR", true},
77 {WM_DEADCHAR, "WM_DEADCHAR", true},
78 {WM_ACTIVATE, "WM_ACTIVATE", true},
79 {WM_SETFOCUS, "WM_SETFOCUS", true},
80 {WM_KILLFOCUS, "WM_KILLFOCUS", true},
81 {WM_ENABLE, "WM_ENABLE", true},
82 {WM_SHOWWINDOW, "WM_SHOWWINDOW", true},
83 {WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true},
84 {WM_SETCURSOR, "WM_SETCURSOR", false},
85 {WM_GETFONT, "WM_GETFONT", true},
86 {WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true},
87 {WM_LBUTTONUP, "WM_LBUTTONUP", true},
88 {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true},
89 {WM_RBUTTONDOWN, "WM_RBUTTONDOWN", true},
90 {WM_RBUTTONUP, "WM_RBUTTONUP", true},
91 {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK", true},
92 {WM_MBUTTONDOWN, "WM_MBUTTONDOWN", true},
93 {WM_MBUTTONUP, "WM_MBUTTONUP", true},
94 {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK", true},
95 {WM_MOUSEWHEEL, "WM_MOUSEWHEEL", true},
96 {WM_XBUTTONDOWN, "WM_XBUTTONDOWN", true},
97 {WM_XBUTTONUP, "WM_XBUTTONUP", true},
98 {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", true},
99 {WM_MOUSEHWHEEL, "WM_MOUSEHWHEEL", true},
100 {WM_GETOBJECT, "WM_GETOBJECT", true},
101 {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
102 {WM_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true},
103 {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
104#if defined(WM_DWMNCRENDERINGCHANGED)
105 {WM_DWMNCRENDERINGCHANGED, "WM_DWMNCRENDERINGCHANGED", true},
106#endif
107 {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
108 {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
109 {WM_RENDERFORMAT, "WM_RENDERFORMAT", true},
110 {WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true},
111 {WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true},
112 {WM_CAPTURECHANGED, "WM_CAPTURECHANGED", true},
113 {WM_IME_STARTCOMPOSITION, "WM_IME_STARTCOMPOSITION", true},
114 {WM_IME_COMPOSITION, "WM_IME_COMPOSITION", true},
115 {WM_IME_ENDCOMPOSITION, "WM_IME_ENDCOMPOSITION", true},
116 {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
117 {WM_IME_REQUEST, "WM_IME_REQUEST", true},
118#if !defined(QT_NO_SESSIONMANAGER)
119 {WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true},
120 {WM_ENDSESSION, "WM_ENDSESSION", true},
121#endif
122 {WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true},
123 {WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true},
124 {WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true},
125 {WM_ENTERIDLE, "WM_ENTERIDLE", false},
126 {WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true},
127 {WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true},
128 {WM_NCCREATE, "WM_NCCREATE", true},
129 {WM_NCDESTROY, "WM_NCDESTROY", true},
130 {WM_NCCALCSIZE, "WM_NCCALCSIZE", true},
131 {WM_NCACTIVATE, "WM_NCACTIVATE", true},
132 {WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true},
133 {WM_NCMOUSELEAVE, "WM_NCMOUSELEAVE", true},
134 {WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN", true},
135 {WM_NCLBUTTONUP, "WM_NCLBUTTONUP", true},
136 {WM_ACTIVATEAPP, "WM_ACTIVATEAPP", true},
137 {WM_NCPAINT, "WM_NCPAINT", true},
138 {WM_ERASEBKGND, "WM_ERASEBKGND", true},
139 {WM_MOUSEMOVE, "WM_MOUSEMOVE", true},
140 {WM_MOUSELEAVE, "WM_MOUSELEAVE", true},
141 {WM_NCHITTEST, "WM_NCHITTEST", false},
142#ifdef WM_TOUCH
143 {WM_TOUCH, "WM_TOUCH", true},
144#endif
145 {WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true},
146 {WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true},
147 {WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
148 {WM_THEMECHANGED, "WM_THEMECHANGED", true},
149 {0x90, "WM_UAHDESTROYWINDOW", true},
150 {0x272, "WM_UNREGISTER_WINDOW_SERVICES", true},
151#ifdef WM_POINTERUPDATE
152 {WM_POINTERDEVICECHANGE, "WM_POINTERDEVICECHANGE", true},
153 {WM_POINTERDEVICEINRANGE, "WM_POINTERDEVICEINRANGE", true},
154 {WM_POINTERDEVICEOUTOFRANGE, "WM_POINTERDEVICEOUTOFRANGE", true},
155 {WM_NCPOINTERUPDATE, "WM_NCPOINTERUPDATE", true},
156 {WM_NCPOINTERDOWN, "WM_NCPOINTERDOWN", true},
157 {WM_NCPOINTERUP, "WM_NCPOINTERUP", true},
158 {WM_POINTERUPDATE, "WM_POINTERUPDATE", true},
159 {WM_POINTERDOWN, "WM_POINTERDOWN", true},
160 {WM_POINTERUP, "WM_POINTERUP", true},
161 {WM_POINTERENTER, "WM_POINTERENTER", true},
162 {WM_POINTERLEAVE, "WM_POINTERLEAVE", true},
163 {WM_POINTERACTIVATE, "WM_POINTERACTIVATE", true},
164 {WM_POINTERCAPTURECHANGED, "WM_POINTERCAPTURECHANGED", true},
165 {WM_TOUCHHITTESTING, "WM_TOUCHHITTESTING", true},
166 {WM_POINTERWHEEL, "WM_POINTERWHEEL", true},
167 {WM_POINTERHWHEEL, "WM_POINTERHWHEEL", true},
168#endif // WM_POINTERUPDATE
169#ifdef DM_POINTERHITTEST
170 {DM_POINTERHITTEST, "DM_POINTERHITTEST", true},
171#endif // DM_POINTERHITTEST
172#ifdef WM_POINTERROUTEDTO
173 {WM_POINTERROUTEDTO, "WM_POINTERROUTEDTO", true},
174 {WM_POINTERROUTEDAWAY, "WM_POINTERROUTEDAWAY", true},
175 {WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true},
176#endif // WM_POINTERROUTEDTO
177#ifdef WM_GETDPISCALEDSIZE
178 {WM_GETDPISCALEDSIZE, "WM_GETDPISCALEDSIZE", true},
179#endif
180#ifdef WM_DPICHANGED
181 {WM_DPICHANGED, "WM_DPICHANGED", true},
182#endif
183};
184
185static inline const MessageDebugEntry *messageDebugEntry(UINT msg)
186{
187 for (size_t i = 0; i < sizeof(messageDebugEntries)/sizeof(MessageDebugEntry); i++)
188 if (messageDebugEntries[i].message == msg)
189 return messageDebugEntries + i;
190 return 0;
191}
192
193const char *QWindowsGuiEventDispatcher::windowsMessageName(UINT msg)
194{
195 if (const MessageDebugEntry *e = messageDebugEntry(msg))
196 return e->description;
197 return "Unknown";
198}
199
200QT_END_NAMESPACE
201
202#include "moc_qwindowsguieventdispatcher_p.cpp"
Combined button and popup list for selecting options.
static const MessageDebugEntry messageDebugEntries[]
static const MessageDebugEntry * messageDebugEntry(UINT msg)