CustomFrame: Same some cpu cycles in case we don't care about the events
This commit is contained in:
@@ -534,6 +534,22 @@ void WidgetResizeHandler::setupWindow(QWindow *window)
|
||||
#endif // Q_OS_WIN
|
||||
}
|
||||
|
||||
bool WidgetResizeHandler::isInterestingNativeEvent(int nativeEvent)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
switch(nativeEvent) {
|
||||
case WM_NCHITTEST:
|
||||
case WM_NCCALCSIZE:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
case WM_GETMINMAXINFO:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(KDDOCKWIDGETS_QTWIDGETS)
|
||||
bool NCHITTESTEventFilter::nativeEventFilter(const QByteArray &eventType, void *message,
|
||||
Qt5Qt6Compat::qintptr *result)
|
||||
@@ -601,6 +617,10 @@ bool CustomFrameHelper::nativeEventFilter(const QByteArray &eventType, void *mes
|
||||
return false;
|
||||
|
||||
auto msg = static_cast<MSG *>(message);
|
||||
if (!WidgetResizeHandler::isInterestingNativeEvent(msg->message)) {
|
||||
// Save some CPU cycles
|
||||
return false;
|
||||
}
|
||||
|
||||
QWindow *window = QWindow::fromWinId(WId(msg->hwnd));
|
||||
if (!window)
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
static int widgetResizeHandlerMargin();
|
||||
|
||||
static void setupWindow(QWindow *window);
|
||||
|
||||
static bool isInterestingNativeEvent(int);
|
||||
#ifdef Q_OS_WIN
|
||||
static bool handleWindowsNativeEvent(QWindow *w, MSG *msg, Qt5Qt6Compat::qintptr *result, const NativeFeatures & = {});
|
||||
static bool handleWindowsNativeEvent(FloatingWindow *w, const QByteArray &eventType,
|
||||
|
||||
Reference in New Issue
Block a user