///////////////////////////////////////////////////////
| 1018 | |
| 1019 | //////////////////////////////////////////////////////////// |
| 1020 | void WindowImplX11::setTitle(const String& title) |
| 1021 | { |
| 1022 | using namespace WindowImplX11Impl; |
| 1023 | |
| 1024 | // Bare X11 has no Unicode window title support. |
| 1025 | // There is however an option to tell the window manager your Unicode title via hints. |
| 1026 | |
| 1027 | // Convert to UTF-8 encoding. |
| 1028 | const auto utf8Title = title.toUtf8(); |
| 1029 | static const auto useUtf8 = getAtom("UTF8_STRING"); |
| 1030 | |
| 1031 | if (useUtf8) |
| 1032 | { |
| 1033 | if (isFeatureSupported("_NET_WM_NAME")) |
| 1034 | { |
| 1035 | // Set the _NET_WM_NAME atom, which specifies a UTF-8 encoded window title. |
| 1036 | static const auto wmName = getAtom("_NET_WM_NAME"); |
| 1037 | |
| 1038 | if (wmName) |
| 1039 | { |
| 1040 | XChangeProperty(m_display.get(), |
| 1041 | m_window, |
| 1042 | wmName, |
| 1043 | useUtf8, |
| 1044 | 8, |
| 1045 | PropModeReplace, |
| 1046 | utf8Title.c_str(), |
| 1047 | static_cast<int>(utf8Title.size())); |
| 1048 | } |
| 1049 | } |
| 1050 | |
| 1051 | if (isFeatureSupported("_NET_WM_ICON_NAME")) |
| 1052 | { |
| 1053 | // Set the _NET_WM_ICON_NAME atom, which specifies a UTF-8 encoded window title. |
| 1054 | static const auto wmIconName = getAtom("_NET_WM_ICON_NAME", false); |
| 1055 | |
| 1056 | if (wmIconName) |
| 1057 | { |
| 1058 | XChangeProperty(m_display.get(), |
| 1059 | m_window, |
| 1060 | wmIconName, |
| 1061 | useUtf8, |
| 1062 | 8, |
| 1063 | PropModeReplace, |
| 1064 | utf8Title.c_str(), |
| 1065 | static_cast<int>(utf8Title.size())); |
| 1066 | } |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | // Set the non-Unicode title as a fallback for window managers who don't support _NET_WM_NAME. |
| 1071 | Xutf8SetWMProperties(m_display.get(), |
| 1072 | m_window, |
| 1073 | title.toAnsiString().c_str(), |
| 1074 | title.toAnsiString().c_str(), |
| 1075 | nullptr, |
| 1076 | 0, |
| 1077 | nullptr, |
nothing calls this directly
no test coverage detected