MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / nativeEvent

Method nativeEvent

ElaWidgetTools/ElaDockWidget.cpp:113–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
112bool ElaDockWidget::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
113#else
114bool ElaDockWidget::nativeEvent(const QByteArray& eventType, void* message, long* result)
115#endif
116{
117 Q_D(ElaDockWidget);
118 if ((eventType != "windows_generic_MSG") || !message)
119 {
120 return false;
121 }
122 const auto msg = static_cast<const MSG*>(message);
123 const HWND hwnd = msg->hwnd;
124 if (!hwnd || !msg)
125 {
126 return false;
127 }
128 d->_currentWinID = (qint64)hwnd;
129 const UINT uMsg = msg->message;
130 const WPARAM wParam = msg->wParam;
131 const LPARAM lParam = msg->lParam;
132 switch (uMsg)
133 {
134 case WM_WINDOWPOSCHANGING:
135 {
136 WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(lParam);
137 if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
138 {
139 wp->flags |= SWP_NOCOPYBITS;
140 *result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam);
141 return true;
142 }
143 return false;
144 }
145 case WM_NCACTIVATE:
146 {
147 *result = TRUE;
148 return true;
149 }
150 case WM_NCHITTEST:
151 {
152 POINT nativeLocalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
153 ::ScreenToClient(hwnd, &nativeLocalPos);
154 RECT clientRect{0, 0, 0, 0};
155 ::GetClientRect(hwnd, &clientRect);
156 auto clientWidth = clientRect.right - clientRect.left;
157 auto clientHeight = clientRect.bottom - clientRect.top;
158 bool left = nativeLocalPos.x < d->_margins;
159 bool right = nativeLocalPos.x > clientWidth - d->_margins;
160 bool top = nativeLocalPos.y < d->_margins;
161 bool bottom = nativeLocalPos.y > clientHeight - d->_margins;
162 *result = 0;
163 if (!window()->isFullScreen() && !window()->isMaximized())
164 {
165 if (left && top)
166 {
167 *result = HTTOPLEFT;
168 }
169 else if (left && bottom)
170 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected