Commit 8030c198 authored by Matan Ziv-Av's avatar Matan Ziv-Av Committed by Tomaz Canabrava
Browse files

Kitty protocol fixes

- Allow deleting by placement id
- Delete image cache when Emulation object is destroyed.
- Small simplification of selecting image from cache.
parent 5647cc35
......@@ -1980,7 +1980,7 @@ void Screen::delPlacements(int del, qint64 id, qint64 pid, int x, int y, int z)
}
break;
case 'i':
if (placement->id == id && (pid < 0 || placement->pid == pid)) {
if ((id < 0 || placement->id) == id && (pid < 0 || placement->pid == pid)) {
remove = true;
}
break;
......
......@@ -80,7 +80,12 @@ Vt102Emulation::Vt102Emulation()
_graphicsImages = std::map<int, QImage *>();
}
Vt102Emulation::~Vt102Emulation() = default;
Vt102Emulation::~Vt102Emulation()
{
for (std::map<int, QImage *>::iterator iter = _graphicsImages.begin(); iter != _graphicsImages.end(); ++iter) {
delete iter->second;
}
}
void Vt102Emulation::clearEntireScreen()
{
......@@ -1440,12 +1445,8 @@ void Vt102Emulation::processGraphicsToken(int tokenSize)
}
}
if (keys['a'] == 'p' || (keys['a'] == 'T' && keys['m'] == 0)) {
if (keys['i']) {
if (_graphicsImages.count(keys['i'])) {
image = _graphicsImages[keys['i']];
} else {
image = nullptr;
}
if (keys['a'] == 'p') {
image = _graphicsImages[keys['i']];
}
if (image) {
QPixmap pixmap = QPixmap::fromImage(*image);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment