1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2026-02-10 09:42:23 +00:00

3 Commits

Author SHA1 Message Date
Filippo Scognamiglio
029ac4a05b Force basic render loop and add some debug logs. 2026-02-09 23:21:27 +01:00
Filippo Scognamiglio
f6b36105ce Force terminal widget size to be > 0. 2026-02-09 23:21:05 +01:00
Filippo Scognamiglio
f4facfed3b Allow using font rendering via CPU instead of GPU. 2026-02-09 12:30:27 +01:00
5 changed files with 38 additions and 13 deletions

View File

@@ -8,6 +8,7 @@
#include <QIcon>
#include <QQuickStyle>
#include <QtQml/qqml.h>
#include <QQuickWindow>
#include <kdsingleapplication.h>
@@ -44,9 +45,10 @@ int main(int argc, char *argv[])
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
// #if defined (Q_OS_LINUX)
// setenv("QSG_RENDER_LOOP", "threaded", 0);
// #endif
// Set render loop to basic for debug/test builds.
#if defined (Q_OS_LINUX)
setenv("QSG_RENDER_LOOP", "basic", 0);
#endif
#if defined(Q_OS_MAC)
// This allows UTF-8 characters usage in OSX.
@@ -88,6 +90,12 @@ int main(int argc, char *argv[])
app.setOrganizationDomain(QStringLiteral("cool-retro-term"));
app.setApplicationVersion(appVersion);
qInfo() << "cool-retro-term version" << appVersion;
qInfo() << "Qt version" << QT_VERSION_STR;
qInfo() << "Platform" << QGuiApplication::platformName();
qInfo() << "QSG_RENDER_LOOP" << qgetenv("QSG_RENDER_LOOP");
qInfo() << "QQuickWindow graphicsApi" << QQuickWindow::graphicsApi();
KDSingleApplication singleApp(QStringLiteral("cool-retro-term"));
if (!singleApp.isPrimaryInstance()) {

View File

@@ -38,6 +38,7 @@ QtObject {
readonly property real maxBurnInFadeTime: 1.6
property bool isMacOS: Qt.platform.os === "osx"
property bool isLinux: Qt.platform.os === "linux"
// GENERAL SETTINGS ///////////////////////////////////////////////////////
property bool showMenubar: false
@@ -52,6 +53,7 @@ QtObject {
property real burnInQuality: 0.5
property bool blinkingCursor: false
property bool preferAcceleratedFontRendering: false
// PROFILE SETTINGS ///////////////////////////////////////////////////////
@@ -167,7 +169,8 @@ QtObject {
"bloomQuality": bloomQuality,
"burnInQuality": burnInQuality,
"useCustomCommand": useCustomCommand,
"customCommand": customCommand
"customCommand": customCommand,
"preferAcceleratedFontRendering": preferAcceleratedFontRendering
}
return stringify(settings)
}
@@ -260,6 +263,8 @@ QtObject {
!== undefined ? settings.useCustomCommand : useCustomCommand
customCommand = settings.customCommand
!== undefined ? settings.customCommand : customCommand
preferAcceleratedFontRendering = settings.preferAcceleratedFontRendering
!== undefined ? settings.preferAcceleratedFontRendering : preferAcceleratedFontRendering
}
function loadProfileString(profileString) {

View File

@@ -93,16 +93,16 @@ Item{
property int textureResolutionScale: appSettings.lowResolutionFont ? Screen.devicePixelRatio : 1
property int margin: appSettings.margin / screenScaling
property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth))
property int totalHeight: Math.floor(parent.height / screenScaling)
property int totalWidth: Math.max(1, Math.floor(parent.width / (screenScaling * fontWidth)))
property int totalHeight: Math.max(1, Math.floor(parent.height / screenScaling))
property int rawWidth: totalWidth - 2 * margin
property int rawHeight: totalHeight - 2 * margin
property int rawWidth: Math.max(1, totalWidth - 2 * margin)
property int rawHeight: Math.max(1, totalHeight - 2 * margin)
textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale)
width: ensureMultiple(rawWidth, Screen.devicePixelRatio)
height: ensureMultiple(rawHeight, Screen.devicePixelRatio)
width: Math.max(1, ensureMultiple(rawWidth, Screen.devicePixelRatio))
height: Math.max(1, ensureMultiple(rawHeight, Screen.devicePixelRatio))
/** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */
function ensureMultiple(size, factor) {
@@ -111,6 +111,7 @@ Item{
fullCursorHeight: true
blinkingCursor: appSettings.blinkingCursor
useFBORendering: appSettings.preferAcceleratedFontRendering
colorScheme: "cool-retro-term"
@@ -266,8 +267,11 @@ Item{
hideSource: true
wrapMode: ShaderEffectSource.Repeat
visible: false
textureSize: Qt.size(kterminal.totalWidth * scaleTexture, kterminal.totalHeight * scaleTexture)
sourceRect: Qt.rect(-kterminal.margin, -kterminal.margin, kterminal.totalWidth, kterminal.totalHeight)
textureSize: Qt.size(Math.max(1, kterminal.totalWidth * scaleTexture),
Math.max(1, kterminal.totalHeight * scaleTexture))
sourceRect: Qt.rect(-kterminal.margin, -kterminal.margin,
Math.max(1, kterminal.totalWidth),
Math.max(1, kterminal.totalHeight))
}
Item {

View File

@@ -146,6 +146,14 @@ ColumnLayout {
SizedLabel {
text: Math.round(burnInSlider.value * 100) + "%"
}
CheckBox {
Layout.columnSpan: 4
text: qsTr("Prefer accelerated font rendering")
visible: appSettings.isLinux
checked: appSettings.preferAcceleratedFontRendering
onCheckedChanged: appSettings.preferAcceleratedFontRendering = checked
}
}
}
}