Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve emulation #520

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions lib/Emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@

#include <QTime>

// KDE
//#include <kdebug.h>

// Konsole
#include "KeyboardTranslator.h"
#include "Screen.h"
Expand All @@ -63,14 +60,14 @@ Emulation::Emulation() :
_screen[1] = new Screen(40,80);
_currentScreen = _screen[0];

QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) );
QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) );
QObject::connect(&_bulkTimer1, &QTimer::timeout, this, &Konsole::Emulation::showBulk);
QObject::connect(&_bulkTimer2, &QTimer::timeout, this, &Konsole::Emulation::showBulk);

// listen for mouse status changes
connect(this , SIGNAL(programUsesMouseChanged(bool)) ,
SLOT(usesMouseChanged(bool)));
connect(this , SIGNAL(programBracketedPasteModeChanged(bool)) ,
SLOT(bracketedPasteModeChanged(bool)));
connect(this, &Konsole::Emulation::programUsesMouseChanged,
this, &Konsole::Emulation::usesMouseChanged);
connect(this, &Konsole::Emulation::programBracketedPasteModeChanged,
this, &Konsole::Emulation::bracketedPasteModeChanged);

connect(this, &Emulation::cursorChanged, this, [this] (KeyboardCursorShape cursorShape, bool blinkingCursorEnabled) {
emit titleChanged( 50, QString(QLatin1String("CursorShape=%1;BlinkingCursorEnabled=%2"))
Expand Down Expand Up @@ -104,11 +101,11 @@ ScreenWindow* Emulation::createWindow()
window->setScreen(_currentScreen);
_windows << window;

connect(window , SIGNAL(selectionChanged()),
this , SLOT(bufferedUpdate()));
connect(window, &Konsole::ScreenWindow::selectionChanged,
this, &Konsole::Emulation::bufferedUpdate);

connect(this , SIGNAL(outputChanged()),
window , SLOT(notifyOutputChanged()) );
connect(this, &Konsole::Emulation::outputChanged,
window, &Konsole::ScreenWindow::notifyOutputChanged);

connect(this, &Emulation::handleCommandFromKeyboard,
window, &ScreenWindow::handleCommandFromKeyboard);
Expand Down Expand Up @@ -332,9 +329,6 @@ int Emulation::lineCount() const
return _currentScreen->getLines() + _currentScreen->getHistLines();
}

#define BULK_TIMEOUT1 10
#define BULK_TIMEOUT2 40

void Emulation::showBulk()
{
_bulkTimer1.stop();
Expand All @@ -348,6 +342,9 @@ void Emulation::showBulk()

void Emulation::bufferedUpdate()
{
static const int BULK_TIMEOUT1 = 10;
static const int BULK_TIMEOUT2 = 40;

_bulkTimer1.setSingleShot(true);
_bulkTimer1.start(BULK_TIMEOUT1);
if (!_bulkTimer2.isActive())
Expand Down
4 changes: 2 additions & 2 deletions lib/Emulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ private slots:
private:
bool _usesMouse;
bool _bracketedPasteMode;
QTimer _bulkTimer1;
QTimer _bulkTimer2;
QTimer _bulkTimer1{this};
QTimer _bulkTimer2{this};

};

Expand Down
21 changes: 2 additions & 19 deletions lib/Vt102Emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@
#include "Vt102Emulation.h"
#include "tools.h"

// XKB
//#include <config-konsole.h>

// this allows konsole to be compiled without XKB and XTEST extensions
// even though it might be available on a particular system.
#if defined(AVOID_XKB)
#undef HAVE_XKB
#endif

#if defined(HAVE_XKB)
void scrolllock_set_off();
void scrolllock_set_on();
#endif

// Standard
#include <cstdio>
#include <unistd.h>
Expand All @@ -48,10 +34,6 @@
#include <QByteRef>
#include <QDebug>

// KDE
//#include <kdebug.h>
//#include <klocale.h>

// Konsole
#include "KeyboardTranslator.h"
#include "Screen.h"
Expand All @@ -66,7 +48,8 @@ Vt102Emulation::Vt102Emulation()
_reportFocusEvents(false)
{
_titleUpdateTimer->setSingleShot(true);
QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle()));
QObject::connect(_titleUpdateTimer, &QTimer::timeout,
this, &Konsole::Vt102Emulation::updateTitle);

initTokenizer();
reset();
Expand Down
Loading