fix(workspaces): avoid useless mutex lock
This commit is contained in:
parent
16b856c8bc
commit
52a4e761a8
|
@ -136,7 +136,6 @@ std::string waybar::modules::sway::Workspaces::getIcon(std::string name)
|
||||||
|
|
||||||
bool waybar::modules::sway::Workspaces::handleScroll(GdkEventScroll *e)
|
bool waybar::modules::sway::Workspaces::handleScroll(GdkEventScroll *e)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
|
||||||
// Avoid concurrent scroll event
|
// Avoid concurrent scroll event
|
||||||
if (scrolling_) {
|
if (scrolling_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,6 +143,7 @@ bool waybar::modules::sway::Workspaces::handleScroll(GdkEventScroll *e)
|
||||||
scrolling_ = true;
|
scrolling_ = true;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
uint16_t idx = 0;
|
uint16_t idx = 0;
|
||||||
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
for (; idx < workspaces_.size(); idx += 1) {
|
for (; idx < workspaces_.size(); idx += 1) {
|
||||||
if (workspaces_[idx]["focused"].asBool()) {
|
if (workspaces_[idx]["focused"].asBool()) {
|
||||||
id = workspaces_[idx]["num"].asInt();
|
id = workspaces_[idx]["num"].asInt();
|
||||||
|
|
Loading…
Reference in New Issue