From 6b1f0c53a5193bc6b26a00ffb9058a0318f815c0 Mon Sep 17 00:00:00 2001 From: guthadam Date: Tue, 4 May 2021 10:30:27 -0500 Subject: [PATCH] Injecting --activateWindow every time new process sends command line Updated comments --- .../Code/Source/MaterialEditorApplication.cpp | 10 ++++++---- .../Source/Material/EditorMaterialSystemComponent.cpp | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp index 3ffe2af1a6..1f32c2a66b 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp @@ -432,10 +432,16 @@ namespace MaterialEditor // Forward commandline options to other application instance. QByteArray buffer; buffer.append("ProcessCommandLine:"); + + // Add the command line options from this process to the message, skipping the executable path for (int argi = 1; argi < m_argC; ++argi) { buffer.append(QString(m_argV[argi]).append("\n").toUtf8()); } + + // Inject command line option to always bring the main window to the foreground + buffer.append("--activatewindow\n"); + m_socket.Send(buffer); m_socket.Disconnect(); return false; @@ -446,10 +452,6 @@ namespace MaterialEditor // Handle commmand line params from connected socket if (buffer.startsWith("ProcessCommandLine:")) { - // Bring the material editor to the foreground - MaterialEditor::MaterialEditorWindowRequestBus::Broadcast( - &MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow); - // Remove header and parse commands AZStd::string params(buffer.data(), buffer.size()); params = params.substr(strlen("ProcessCommandLine:")); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp index 4cf51e2f37..e9a81f2e9f 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp @@ -128,9 +128,6 @@ namespace AZ QStringList arguments; arguments.append(sourcePath.c_str()); - // Bring the material editor to the foreground if running - arguments.append("--activatewindow"); - // Use the same RHI as the main editor AZ::Name apiName = AZ::RHI::Factory::Get().GetName(); if (!apiName.IsEmpty())