From 39d86edf99a1dc295a7fa653394564d70c8f41f6 Mon Sep 17 00:00:00 2001 From: Ulrich Haberl <1841407+haberlu@users.noreply.github.com> Date: Thu, 6 Feb 2020 17:03:02 +0100 Subject: [PATCH] Changes for 3ds Max 2021.2 - Adds an additional signal 'allEventsProcessed' that gets emitted after all win32 messages have been dispatched. This is used on the 3ds Max side for triggering progressive rendering. - Adds a new 3ds Max-specific nativeEventFilter type 'windows_generic_3dsMax_MSG' that is only called once from the Qt main loop when the messages are about to get translated/dispatched. The default type "windows_generic_MSG" is also used by the QWindowsContext::windowsProc() native event filter, where the translated message already gets dispatched to the specific window. 3ds Max cannot reliably use this message for doing its 'specific' message handling, otherwise it can lead to endless loops causing stack overflows. - Replaces the newly added filterNativeEvent call on the type "windows_generic_3dsMax_MSG" with a more distinct signal 'preProcessNativeEvent'. This ensures application event filters don't get called twice and there is no need to check the event type. - Fixing the QStyleSheetStyle to remove the additional width put into the spin-box's width - even with no style applied - Make QTabBar and QTabWidget capable of multiRow tab layout - Merging all 3ds Max specific changes from Qt 5.12.4 into Qt 5.12.5 - Fixes a int32 to int64 cast bug in the WM_TIMER event which causes UI hangs on windows64 because the WM_TIMER fall-through to WM_QT_SENDPOSTEDEVENTS doesn't call sendPostedEvents anymore. - Updates the DLL version for libEGL.dll and libGLESv2.dll for the 2020.3_Update - Incorporating official fixes for QTBUG-75820 and QTBUG-76990 - Reverting commits #70d131a and #bde6a04 since they conflict with 3ds Max --- src/corelib/kernel/qeventdispatcher_win.cpp | 16 +++++++++++++++- src/corelib/kernel/qeventdispatcher_win_p.h | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 6eff2f8d262..fbc7d319112 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -634,7 +634,18 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) return false; } - if (!filterNativeEvent(QByteArrayLiteral("windows_generic_MSG"), &msg, 0)) { + // 3ds Max extension: Emit a signal that allows 3ds Max to do it's specific message preprocessing + // before Qt translates and dispatches the message. If 3ds Max already processed the message, + // there is no need to propagate / dispatch it further by Qt. + // Note, that 3ds Max cannot use the native event filter mechanism below for doing it's message + // preprocessing, since filterNativeEvent() with the event type "windows_generic_MSG" is also used + // by the QWindowsContext::windowsProc(). + // Getting called twice from two different locations without be able to do a proper distinction of + // the calling source on the 3ds Max side, can lead to endless loops causing stack overflows. + bool eventProcessed = false; + emit preProcessNativeEvent( &msg, &eventProcessed ); + + if ( !eventProcessed && !filterNativeEvent(QByteArrayLiteral("windows_generic_MSG"), &msg, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } @@ -670,6 +681,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) if (needWM_QT_SENDPOSTEDEVENTS) PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); + // 3ds Max extension for triggering progressive rendering. + emit allEventsProcessed(); + return retVal; } diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 3bb618153b3..7a927d5826d 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -108,6 +108,16 @@ class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher HWND internalHwnd(); +Q_SIGNALS: + + // 3ds Max extension for win32 message preprocessing. + // Emitted before the native event filter are called and the win32 message gets translated/dispatched. + void preProcessNativeEvent( void* message, bool* returnProcessed ); + + // 3ds Max extension for progressive rendering. + // Emitted after all win32 messages has been dispatched. + void allEventsProcessed(); + protected: QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0); virtual void sendPostedEvents();