1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Linux windowing: Display utf-8 native window titles correctly

This commit is contained in:
reuk 2021-08-17 12:21:55 +01:00
parent 8cc0d12fb3
commit f989182f32
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
4 changed files with 12 additions and 3 deletions

View file

@ -67,7 +67,7 @@ public:
appProperties.setStorageParameters (options);
}
const String getApplicationName() override { return JucePlugin_Name; }
const String getApplicationName() override { return CharPointer_UTF8 (JucePlugin_Name); }
const String getApplicationVersion() override { return JucePlugin_VersionString; }
bool moreThanOneInstanceAllowed() override { return true; }
void anotherInstanceStarted (const String&) override {}

View file

@ -188,6 +188,7 @@ bool X11Symbols::loadAllSymbols()
makeSymbolBinding (xUngrabServer, "XUngrabServer"),
makeSymbolBinding (xUnlockDisplay, "XUnlockDisplay"),
makeSymbolBinding (xUnmapWindow, "XUnmapWindow"),
makeSymbolBinding (xutf8TextListToTextProperty, "Xutf8TextListToTextProperty"),
makeSymbolBinding (xWarpPointer, "XWarpPointer")))
return false;

View file

@ -449,6 +449,10 @@ public:
(char**, int, XTextProperty*),
Status)
JUCE_GENERATE_FUNCTION_WITH_DEFAULT (Xutf8TextListToTextProperty, xutf8TextListToTextProperty,
(::Display*, char**, int, XICCEncodingStyle, XTextProperty*),
int)
JUCE_GENERATE_FUNCTION_WITH_DEFAULT (XSync, xSync,
(::Display*, Bool),
void)

View file

@ -1606,12 +1606,16 @@ void XWindowSystem::setTitle (::Window windowH, const String& title) const
{
jassert (windowH != 0);
XTextProperty nameProperty;
XTextProperty nameProperty{};
char* strings[] = { const_cast<char*> (title.toRawUTF8()) };
XWindowSystemUtilities::ScopedXLock xLock;
if (X11Symbols::getInstance()->xStringListToTextProperty (strings, 1, &nameProperty))
if (X11Symbols::getInstance()->xutf8TextListToTextProperty (display,
strings,
numElementsInArray (strings),
XUTF8StringStyle,
&nameProperty) >= 0)
{
X11Symbols::getInstance()->xSetWMName (display, windowH, &nameProperty);
X11Symbols::getInstance()->xSetWMIconName (display, windowH, &nameProperty);