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

Method takeOverNativeEvent

ElaWidgetTools/ElaAppBar.cpp:391–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389int ElaAppBar::takeOverNativeEvent(const QByteArray& eventType, void* message, qintptr* result)
390#else
391int ElaAppBar::takeOverNativeEvent(const QByteArray& eventType, void* message, long* result)
392#endif
393{
394 Q_D(ElaAppBar);
395 if ((eventType != "windows_generic_MSG") || !message)
396 {
397 return 0;
398 }
399 const auto msg = static_cast<const MSG*>(message);
400 const HWND hwnd = msg->hwnd;
401 if (!hwnd || !msg)
402 {
403 return 0;
404 }
405 d->_currentWinID = (qint64)hwnd;
406 const UINT uMsg = msg->message;
407 const WPARAM wParam = msg->wParam;
408 const LPARAM lParam = msg->lParam;
409 switch (uMsg)
410 {
411 case WM_WINDOWPOSCHANGING:
412 {
413 WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(lParam);
414 if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
415 {
416 wp->flags |= SWP_NOCOPYBITS;
417 *result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam);
418 return 1;
419 }
420 return 0;
421 }
422 case WM_NCPAINT:
423 {
424 if (!eWinHelper->getIsCompositionEnabled())
425 {
426 *result = FALSE;
427 return 1;
428 }
429 else
430 {
431 return -1;
432 }
433 }
434 case WM_NCACTIVATE:
435 {
436 if (eWinHelper->getIsCompositionEnabled())
437 {
438 *result = ::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1);
439 }
440 else
441 {
442 *result = TRUE;
443 }
444 return 1;
445 }
446 case WM_SIZE:
447 {
448 if (wParam == SIZE_RESTORED)

Callers

nothing calls this directly

Calls 9

_containsCursorToItemMethod · 0.80
setIsSelectedMethod · 0.80
postMethod · 0.80
onMaxButtonClickedMethod · 0.80
_showAppBarMenuMethod · 0.80

Tested by

no test coverage detected