Skip to content

Commit

Permalink
Changes for 3ds Max 2020
Browse files Browse the repository at this point in the history
 - Merging all 3ds Max specific changes from Qt 5.6.3 into Qt 5.11.2
 - Adding raiseWidget() function to the QMainWindow (exposing the function with the same name from the layout).
 - Adding UI-Automation WIN32/Qt hierarchy mix
 - Adding back versioning information to libEGL.dll and libGLESv2.dll
  • Loading branch information
haberlu committed Mar 12, 2019
1 parent b0dce50 commit ef893e0
Show file tree
Hide file tree
Showing 32 changed files with 3,009 additions and 110 deletions.
12 changes: 11 additions & 1 deletion qmake/generators/win32/winmakefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,18 @@ void Win32MakefileGenerator::processRcFileVar()
QTextStream ts(&rcString, QFile::WriteOnly);

QStringList vers = project->first("VERSION").toQString().split(".", QString::SkipEmptyParts);
//---------------------------------------------------------------------
// Autodesk 3ds Max Addition:
// Qt defaults to "0" here, what we use for 3ds Max Release, but change
// that to "1" for update 1, "2" for update 2. "3" for update 3, etc.
// This is needed to allow the patch scripts to replace the dlls with
// the newer version during the update installation.
// "5.11.1.0" -> "5.11.1.*"
//---------------------------------------------------------------------
for (int i = vers.size(); i < 4; i++)
vers += "0";
{
vers += "0"; //for 3ds Max
}
QString versionString = vers.join('.');

QStringList rcIcons;
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/angle/src/common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef COMMON_VERSION_H_
#define COMMON_VERSION_H_

#include "id/commit.h"
#include "../id/commit.h"

#define ANGLE_MAJOR_VERSION 2
#define ANGLE_MINOR_VERSION 1
Expand Down
103 changes: 103 additions & 0 deletions src/3rdparty/angle/src/libEGL/libEGL.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include "../common/version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""../common/version.h""\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libEGL"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libEGL.dll"
VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
VALUE "ProductVersion", ANGLE_VERSION_STRING
VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
103 changes: 103 additions & 0 deletions src/3rdparty/angle/src/libGLESv2/libGLESv2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include "../common/version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""../common/version.h""\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libGLESv2"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libGLESv2.dll"
VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
VALUE "ProductVersion", ANGLE_VERSION_STRING
VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
2 changes: 2 additions & 0 deletions src/angle/src/libEGL/libEGL.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ egl_headers.files = \
$$ANGLE_DIR/include/EGL/eglplatform.h
egl_headers.path = $$[QT_INSTALL_HEADERS]/QtANGLE/EGL
INSTALLS += egl_headers

RC_FILE = $$ANGLE_DIR/src/libEGL/libEGL.rc
2 changes: 2 additions & 0 deletions src/angle/src/libGLESv2/libGLESv2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ TARGET = $$qtLibraryTarget($${LIBGLESV2_NAME})
} else {
DEFINES += DllMain=DllMain_ANGLE # prevent symbol from conflicting with the user's DllMain
}

RC_FILE = $$ANGLE_DIR/src/libGLESv2/libGLESv2.rc
5 changes: 5 additions & 0 deletions src/plugins/platforms/windows/qwindowscontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,11 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
if (!(cwexFlags & CWP_SKIPTRANSPARENT)
&& (GetWindowLongPtr(child, GWL_EXSTYLE) & WS_EX_TRANSPARENT)) {
const HWND nonTransparentChild = ChildWindowFromPointEx(*hwnd, point, cwexFlags | CWP_SKIPTRANSPARENT);

if ( !nonTransparentChild || nonTransparentChild == *hwnd ) {
return false;
}

if (QWindowsWindow *nonTransparentWindow = context->findPlatformWindow(nonTransparentChild)) {
*result = nonTransparentWindow;
*hwnd = nonTransparentChild;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/platforms/windows/qwindowsdrag.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
class QPlatformScreen;

class QWindowsDropMimeData : public QWindowsInternalMimeData {
Q_OBJECT
Q_PROPERTY( IDataObject* IDataObject READ retrieveDataObject )
public:
QWindowsDropMimeData() {}
IDataObject *retrieveDataObject() const override;
Expand Down
32 changes: 31 additions & 1 deletion src/plugins/platforms/windows/qwindowswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,37 @@ void QWindowsWindow::requestActivateWindow()
}
}
}
SetForegroundWindow(m_data.hwnd);

//------------------------------------------------------------------
// Autodesk 3ds Max addition: When 3ds Max starts up we have a lot
// of focus stealing issues of 3ds Max on other applications foreground
// windows. This is caused by the call to SetForegroundWindow()
// whenever a Qt window gets focused / activated.
// To prevent this we make the SetForegroundWindow() call conditional
// on a flag that 3ds Max can set when it is launching.
// Note that QWindow::requestActivate() offers a possiblity via the
// flag 'Qt::WindowDoesNotAcceptFocus' to suppress calls to
// QWindowsWindow::requestActivateWindow() for that window, but using
// the flag would disable both calls to SetForegroundWindow() and
// SetFocus(), which is not useful in the case of 3ds Max, since it
// can execute scripts on start up that popup Qt windows which rely
// on the proper focus setting.
//------------------------------------------------------------------
bool doSetForegroundWnd = true;
if ( qApp )
{
auto prop = qApp->property( "_3dsmax_disableSetForegroundWnd" );
if ( prop.isValid() && prop.toBool() == true )
{
doSetForegroundWnd = false;
}
}

if ( doSetForegroundWnd )
{
SetForegroundWindow(m_data.hwnd);
}

SetFocus(m_data.hwnd);
if (attached)
AttachThreadInput(foregroundThread, currentThread, FALSE);
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ QWindow *windowForAccessible(const QAccessibleInterface *accessible)
// Usually it will be NULL, as Qt5 by default uses alien widgets with no native windows.
HWND hwndForAccessible(const QAccessibleInterface *accessible)
{
//-------------------------------------------------------------------------
// Autodesk 3ds Max Addition
//-------------------------------------------------------------------------
// Some QWidgets in 3ds Max are hosting native legacy HWNDs showing various
// UI elements. Since those are just shallow wrappers around the embedded
// HWNDs, we directly jump to the embedded HWND here.
// The 3ds Max team has patched the QWinHost class of the QtWinMigrate
// project also to use this property accordingly.
//-------------------------------------------------------------------------
if (auto obj = accessible->object()) {
auto prop = obj->property("_3dsmax_hosted_hwnd");
if (prop.isValid()) {
if (auto nativeChildHWND = reinterpret_cast<HWND>(qvariant_cast<void *>(prop))) {
if (IsWindow(nativeChildHWND)) {
return nativeChildHWND;
}
}
}
}

if (QWindow *window = accessible->window()) {
if (!accessible->parent() || (accessible->parent()->window() != window)) {
return QWindowsBaseWindow::handleOf(window);
Expand Down
32 changes: 27 additions & 5 deletions src/widgets/accessible/qaccessiblewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,19 @@ static QString buddyString(const QWidget *widget)
}
#endif

#if QT_CONFIG(groupbox)
QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent);
if (groupbox)
return groupbox->title();
#endif

//----------------------------------------------------------------------------
// Autodesk 3ds Max change: We don't want that behavior to happen, cause this
// additional buddy-string thing is interfering with our automation scripts.
// We often have a bunch of widgets inside a groupbox that do not have an
// explicit accessible name set, so this would lead to a ton of spinners that
// share the same name.
// #if QT_CONFIG(groupbox)
// QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent);
// if (groupbox)
// return groupbox->title();
// #endif
//----------------------------------------------------------------------------

return QString();
}
Expand Down Expand Up @@ -434,10 +442,24 @@ QString QAccessibleWidget::text(QAccessible::Text t) const
str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget());
} else {
str = qt_accStripAmp(buddyString(widget()));
//----------------------------------------------------------------
// Autodesk 3ds Max change: If no specific string has been set and
// no buddy eigther, we will fall back to use the objectname - or
// even the class name for fixing that.
//----------------------------------------------------------------
if ( !widget()->inherits("QGroupBox") && !widget()->inherits("QMenu") )
{
if (str.isEmpty())
str = widget()->objectName();
if (str.isEmpty())
str = widget()->metaObject()->className();
}
}
break;
case QAccessible::Description:
str = widget()->accessibleDescription();
if (str.isEmpty())
str = widget()->objectName();
#ifndef QT_NO_TOOLTIP
if (str.isEmpty())
str = widget()->toolTip();
Expand Down
Loading

0 comments on commit ef893e0

Please sign in to comment.