Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
Fingerterm improvements

See merge request mer-core/fingerterm!27
  • Loading branch information
pvuorela committed Aug 24, 2018
2 parents 64a3554 + e389354 commit 552c8b4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 deletions.
37 changes: 16 additions & 21 deletions main.cpp
Expand Up @@ -71,39 +71,34 @@ int main(int argc, char *argv[])
if(execCmd.isEmpty()) {
execCmd = settings->value("general/execCmd").toString();
}
if(execCmd.isEmpty()) {
// execute the user's default shell
passwd *pwdstruct = getpwuid(getuid());
execCmd = QString(pwdstruct->pw_shell);
execCmd.append(" --login");
}

delete settings; // don't need 'em here

QStringList execParts = execCmd.split(' ', QString::SkipEmptyParts);
if(execParts.length()==0)
exit(0);
char *ptrs[execParts.length()+1];
for(int i=0; i<execParts.length(); i++) {
ptrs[i] = new char[execParts.at(i).toLatin1().length()+1];
memcpy(ptrs[i], execParts.at(i).toLatin1().data(), execParts.at(i).toLatin1().length());
ptrs[i][execParts.at(i).toLatin1().length()] = 0;
passwd *pwdstruct = getpwuid(getuid());
char *shell = pwdstruct->pw_shell;
if (execCmd.isEmpty()) {
// execute the user's default shell
execl(shell, shell, "--login", (char*)NULL);
} else {
execl(shell, shell, "-c", qPrintable(execCmd), (char*)NULL);
}
ptrs[execParts.length()] = 0;

execvp(execParts.first().toLatin1(), ptrs);
exit(0);
}

QGuiApplication app(argc, argv);

QScreen* sc = app.primaryScreen();
if(sc){
sc->setOrientationUpdateMask(Qt::PrimaryOrientation
| Qt::LandscapeOrientation
| Qt::PortraitOrientation
| Qt::InvertedLandscapeOrientation
| Qt::InvertedPortraitOrientation);
QFlags<Qt::ScreenOrientation> mask = Qt::PrimaryOrientation
| Qt::PortraitOrientation
| Qt::LandscapeOrientation
| Qt::InvertedPortraitOrientation
| Qt::InvertedLandscapeOrientation;
if (settings->contains("ui/orientationMask")) {
mask &= settings->value("ui/orientationMask").toInt();
}
sc->setOrientationUpdateMask(mask);
}

qmlRegisterType<TextRender>("FingerTerm", 1, 0, "TextRender");
Expand Down
18 changes: 15 additions & 3 deletions qml/Main.qml
Expand Up @@ -87,7 +87,20 @@ Item {
property int scrollBarWidth: 6*window.pixelRatio

anchors.fill: parent
color: bellTimer.running ? "#ffffff" : bgcolor
color: bgcolor

Rectangle {
id: bellTimerRect
visible: opacity > 0
opacity: bellTimer.running ? 0.5 : 0.0
anchors.fill: parent
color: "#ffffff"
Behavior on opacity {
NumberAnimation {
duration: bellTimer.interval
}
}
}

Lineview {
id: lineView
Expand Down Expand Up @@ -236,8 +249,7 @@ Item {

Timer {
id: bellTimer

interval: 80
interval: 120
}

Connections {
Expand Down
4 changes: 4 additions & 0 deletions terminal.cpp
Expand Up @@ -178,6 +178,10 @@ void Terminal::keyPress(int key, int modifiers, const QString& text)

resetBackBufferScrollPos();

// physical sticky shift generates key=0, mod=Qt::ShiftModifier, sticky alt: key=0, mod=0
if (key == 0 && (modifiers == Qt::ShiftModifier || modifiers == Qt::NoModifier))
return;

if (key > 0xFFFF) {
int modcode = (modifiers & Qt::ShiftModifier ? 1 : 0) |
(modifiers & Qt::AltModifier ? 2 : 0) |
Expand Down
1 change: 1 addition & 0 deletions textrender.cpp
Expand Up @@ -76,6 +76,7 @@ TextRender::TextRender(QQuickItem *parent) :
iShowBufferScrollIndicator = false;

iFont = QFont(sUtil->fontFamily(), sUtil->fontSize());
iFont.setStyleHint(QFont::Monospace, QFont::StyleStrategy(QFont::PreferDefault | QFont::ForceIntegerMetrics));
iFont.setBold(false);
QFontMetrics fontMetrics(iFont);
iFontHeight = fontMetrics.height();
Expand Down
2 changes: 1 addition & 1 deletion util.cpp
Expand Up @@ -154,7 +154,7 @@ void Util::keyPressFeedback()

void Util::keyReleaseFeedback()
{
if( !settingsValue("ui/keyPressFeedback", true).toBool() )
if( !settingsValue("ui/keyReleaseFeedback", true).toBool() )
return;

// TODO: check what's more comfortable, only press, or press and release
Expand Down

0 comments on commit 552c8b4

Please sign in to comment.