Fix deadlock on workspace scrolling (#403)
Fix deadlock on workspace scrolling
This commit is contained in:
commit
d607a4e33f
|
@ -218,23 +218,25 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
|
||||||
if (dir == SCROLL_DIR::NONE) {
|
if (dir == SCROLL_DIR::NONE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
|
||||||
auto it = std::find_if(workspaces_.begin(), workspaces_.end(), [](const auto &workspace) {
|
|
||||||
return workspace["focused"].asBool();
|
|
||||||
});
|
|
||||||
if (it == workspaces_.end()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
std::string name;
|
std::string name;
|
||||||
if (dir == SCROLL_DIR::DOWN || dir == SCROLL_DIR::RIGHT) {
|
{
|
||||||
name = getCycleWorkspace(it, false);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
} else if (dir == SCROLL_DIR::UP || dir == SCROLL_DIR::LEFT) {
|
auto it = std::find_if(workspaces_.begin(), workspaces_.end(), [](const auto &workspace) {
|
||||||
name = getCycleWorkspace(it, true);
|
return workspace["focused"].asBool();
|
||||||
} else {
|
});
|
||||||
return true;
|
if (it == workspaces_.end()) {
|
||||||
}
|
return true;
|
||||||
if (name == (*it)["name"].asString()) {
|
}
|
||||||
return true;
|
if (dir == SCROLL_DIR::DOWN || dir == SCROLL_DIR::RIGHT) {
|
||||||
|
name = getCycleWorkspace(it, false);
|
||||||
|
} else if (dir == SCROLL_DIR::UP || dir == SCROLL_DIR::LEFT) {
|
||||||
|
name = getCycleWorkspace(it, true);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (name == (*it)["name"].asString()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", name));
|
ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", name));
|
||||||
|
|
Loading…
Reference in New Issue