Fix to set the Taskbar name and Game Launcher window title to the name of the Project (#4986)

Signed-off-by: Steve Pham <spham@amazon.com>
monroegm-disable-blank-issue-2
Steve Pham 4 years ago committed by GitHub
parent 767466c57b
commit 22a287d046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -258,10 +258,17 @@ namespace AzFramework
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
void XcbNativeWindow::SetWindowTitle(const AZStd::string& title) void XcbNativeWindow::SetWindowTitle(const AZStd::string& title)
{ {
// Set the title of both the window and the task bar by using
// a buffer to hold the title twice, separated by a null-terminator
auto doubleTitleSize = (title.size() + 1) * 2;
AZStd::string doubleTitle(doubleTitleSize, '\0');
azstrncpy(doubleTitle.data(), doubleTitleSize, title.c_str(), title.size());
azstrncpy(&doubleTitle.data()[title.size() + 1], title.size(), title.c_str(), title.size());
xcb_void_cookie_t xcbCheckResult; xcb_void_cookie_t xcbCheckResult;
xcbCheckResult = xcb_change_property( xcbCheckResult = xcb_change_property(
m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, static_cast<uint32_t>(title.size()), m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, static_cast<uint32_t>(doubleTitle.size()),
title.c_str()); doubleTitle.c_str());
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set window title."); AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set window title.");
} }

@ -14,6 +14,7 @@
#include <AzCore/NativeUI/NativeUIRequests.h> #include <AzCore/NativeUI/NativeUIRequests.h>
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/smart_ptr/make_shared.h> #include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/API/ApplicationAPI.h> #include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/Components/TransformComponent.h> #include <AzFramework/Components/TransformComponent.h>
@ -115,7 +116,9 @@ namespace AZ
{ {
// GFX TODO - investigate window creation being part of the GameApplication. // GFX TODO - investigate window creation being part of the GameApplication.
m_nativeWindow = AZStd::make_unique<AzFramework::NativeWindow>("O3DELauncher", AzFramework::WindowGeometry(0, 0, 1920, 1080)); auto projectTitle = AZ::Utils::GetProjectName();
m_nativeWindow = AZStd::make_unique<AzFramework::NativeWindow>(projectTitle.c_str(), AzFramework::WindowGeometry(0, 0, 1920, 1080));
AZ_Assert(m_nativeWindow, "Failed to create the game window\n"); AZ_Assert(m_nativeWindow, "Failed to create the game window\n");
m_nativeWindow->Activate(); m_nativeWindow->Activate();

Loading…
Cancel
Save