mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
hyprland/ipc: reduce impact of racing workspace queries
This commit is contained in:
parent
9506c1bb62
commit
d3b1a65911
3 changed files with 42 additions and 21 deletions
|
|
@ -35,18 +35,21 @@ void HyprlandWorkspace::updateInitial(qint32 id, QString name) {
|
|||
}
|
||||
|
||||
void HyprlandWorkspace::updateFromObject(QVariantMap object) {
|
||||
auto id = object.value("id").value<qint32>();
|
||||
auto name = object.value("name").value<QString>();
|
||||
auto monitorId = object.value("monitorID").value<qint32>();
|
||||
auto monitorName = object.value("monitor").value<QString>();
|
||||
|
||||
if (id != this->mId) {
|
||||
this->mId = id;
|
||||
auto initial = this->mId = -1;
|
||||
|
||||
// ID cannot be updated after creation
|
||||
if (initial) {
|
||||
this->mId = object.value("id").value<qint32>();
|
||||
emit this->idChanged();
|
||||
}
|
||||
|
||||
if (name != this->mName) {
|
||||
this->mName = std::move(name);
|
||||
// No events we currently handle give a workspace id but not a name,
|
||||
// so we shouldn't set this if it isn't an initial query
|
||||
if (initial) {
|
||||
this->mName = object.value("name").value<QString>();
|
||||
emit this->nameChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue