fix(sway/workspaces): ignore emulated scroll events

GDK Wayland backend can emit two events for mouse scroll: one is a
GDK_SCROLL_SMOOTH and the other one is an emulated scroll event with
direction. We only receive emulated events on a window, thus it is not
possible to handle these in a module and stop propagation.

Ignoring emulated events should be safe since those are duplicates of
smooth scroll events anyways.

Fixes #386
This commit is contained in:
Aleksei Bavshin 2020-12-04 00:38:18 -08:00
parent 930bb4ba97
commit 68b6136989
No known key found for this signature in database
GPG Key ID: 4F071603387A382A

View File

@ -291,6 +291,12 @@ std::string Workspaces::getIcon(const std::string &name, const Json::Value &node
}
bool Workspaces::handleScroll(GdkEventScroll *e) {
if (gdk_event_get_pointer_emulated((GdkEvent *)e)) {
/**
* Ignore emulated scroll events on window
*/
return false;
}
auto dir = AModule::getScrollDir(e);
if (dir == SCROLL_DIR::NONE) {
return true;