2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Get rid of redudant fontconfig hack

This commit is contained in:
Ilya Fedin
2020-08-07 10:07:43 +04:00
committed by John Preston
parent f56af090e0
commit 580e6baee6
6 changed files with 0 additions and 108 deletions

View File

@@ -209,71 +209,6 @@ bool RunShellCommand(const QString &program, const QStringList &arguments) {
return true;
}
[[nodiscard]] bool CheckFontConfigCrash() {
return InSnap();
}
[[nodiscard]] QString FallbackFontConfigCheckPath() {
return cWorkingDir() + "tdata/fc-check";
}
#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK
[[nodiscard]] bool BadFontConfigVersion() {
if (CheckFontConfigCrash()) {
return QFile(FallbackFontConfigCheckPath()).exists();
}
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.start("fc-list", QStringList() << "--version");
process.waitForFinished();
if (process.exitCode() > 0) {
LOG(("App Error: Could not start fc-list. Process exited with code: %1.").arg(process.exitCode()));
return false;
}
QString result(process.readAllStandardOutput());
DEBUG_LOG(("Fontconfig version string: ") + result);
QVersionNumber version = QVersionNumber::fromString(result.split("version ").last());
if (version.isNull()) {
LOG(("App Error: Could not get version from fc-list output."));
return false;
}
LOG(("Fontconfig version: %1.").arg(version.toString()));
if (version < QVersionNumber::fromString("2.13")) {
if (!qEnvironmentVariableIsSet("TDESKTOP_FORCE_CUSTOM_FONTCONFIG")) {
return false;
}
}
return true;
}
void FallbackFontConfig() {
const auto custom = cWorkingDir() + "tdata/fc-custom-1.conf";
auto doFallback = [&] {
if (QFile(custom).exists()) {
LOG(("Custom FONTCONFIG_FILE: ") + custom);
qputenv("FONTCONFIG_FILE", QFile::encodeName(custom));
return true;
}
return false;
};
if (doFallback()) {
return;
}
if (BadFontConfigVersion()) {
QFile(":/fc/fc-custom.conf").copy(custom);
doFallback();
}
}
#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK
bool GenerateDesktopFile(
const QString &targetPath,
const QString &args,
@@ -965,23 +900,6 @@ void SetTrayIconSupported(bool supported) {
IsTrayIconSupported = supported;
}
void FallbackFontConfigCheckBegin() {
if (!CheckFontConfigCrash()) {
return;
}
auto file = QFile(FallbackFontConfigCheckPath());
if (file.open(QIODevice::WriteOnly)) {
file.write("1", 1);
}
}
void FallbackFontConfigCheckEnd() {
if (!CheckFontConfigCrash()) {
return;
}
QFile(FallbackFontConfigCheckPath()).remove();
}
bool StartSystemMove(QWindow *window) {
if (IsWayland()) {
return StartWaylandMove(window);
@@ -1178,10 +1096,6 @@ void start() {
LOG(("Launcher filename: %1").arg(GetLauncherFilename()));
#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK
FallbackFontConfig();
#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());

View File

@@ -42,9 +42,6 @@ QString GetIconName();
inline void IgnoreApplicationActivationRightNow() {
}
void FallbackFontConfigCheckBegin();
void FallbackFontConfigCheckEnd();
bool GtkClipboardSupported();
void SetTrayIconSupported(bool supported);
void InstallMainDesktopFile();