Monogame: Setting Window.Title buggy under Linux.

Created on 8 Jul 2018  路  3Comments  路  Source: MonoGame/MonoGame

Setting the Window title is hit or miss now when running my game in linux, I'm thinking since this unicode support was added but it may be something else. Last dev build I installed was 6 months ago before today and this was merged 20 days ago, so that's what made me think it. https://github.com/MonoGame/MonoGame/pull/6335

I set Window.Title = "Whatever" inside the Initialize() override, after base.Initialize() of the X:Game class. Sometimes the Window doesn't rename at all, just displaying the executable filename as if it has never been set. Other times it might say "Whatever {Random garbage}".

What version of MonoGame does the bug occur on:

  • MonoGame 3.7

What operating system are you using:

  • Linux

What MonoGame platform are you using:

  • DesktopGL
Help Wanted Linux

All 3 comments

After testing around with it, for some reason this seem to specifically affect titles with a character count that is a multiple of 24. Setting the title to something with such a character count will either set it and add gibberish or not set it at all. As a work around, you can set the title to something else (without a multiple of 24 character count) first and then set it again to a 24 character title.

While this seems to work, the nature of the bug itself makes me feel a bit uneasy.

After reading the underlying code, I think this may be a timing issue. The initial window creation code ignores any title setting(The actual game window is initialized after this point). The solution would be to set the title earlier as in the constructor for Game1 and allow it to be honored in the SDL window creation code(which it currently does not do).

As far as the 24 char question, I believe the OP may be supplying UTF-16 strings(Any C# string in "" is UTF-16) when UTF-8 is the expected format.
Please note the preceding statement is purely supposition based on the given results to the facts as described. I may be well off base with my conclusion without more evidence.

Either way, the setting of the window title should be allowed at the construction of the game window no matter the platform(and cached if the first window doesn't comply(i.e. Loader screens))

This looks to have turned out to be something involving the Ubuntu based distros that I and a friend tested on. I can not reproduce the bug anymore, after installing some updates today. This is regardless of character count and when the title is set. The relatively recent change in the window title code and my personal timing with updating MG caused me to be too laser focused on it being the culprit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomspilman picture tomspilman  路  4Comments

Ellesent picture Ellesent  路  5Comments

tomspilman picture tomspilman  路  4Comments

dazinator picture dazinator  路  5Comments

willmotil picture willmotil  路  5Comments