Merge pull request #3148 from VAWVAW/sway-scroll

sway/workspaces: Fix scroll on unfocused monitor
This commit is contained in:
Alexis Rouillard 2024-04-19 06:20:28 +02:00 committed by GitHub
commit 95788e8081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -434,9 +434,16 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
} }
std::string name; std::string name;
{ {
bool alloutputs = config_["all-outputs"].asBool();
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
auto it = std::find_if(workspaces_.begin(), workspaces_.end(), auto it =
[](const auto &workspace) { return hasFlag(workspace, "focused"); }); std::find_if(workspaces_.begin(), workspaces_.end(), [alloutputs](const auto &workspace) {
if (alloutputs) {
return hasFlag(workspace, "focused");
}
bool noNodes = workspace["nodes"].empty() && workspace["floating_nodes"].empty();
return hasFlag(workspace, "visible") || (workspace["output"].isString() && noNodes);
});
if (it == workspaces_.end()) { if (it == workspaces_.end()) {
return true; return true;
} }