Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed natural scrolling bug #9

Merged
merged 4 commits into from
Apr 1, 2024
Merged

Conversation

salihefee
Copy link

@salihefee salihefee commented Apr 1, 2024

Used the Gio.Settings API to query the natural-scroll option and inverted scrolling accordingly.

Copy link
Owner

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment; also did you build and test this locally? Did you try without natural turned on as well?

case Clutter.ScrollDirection.UP:
volume += this._get_step();
volume += naturalScroll ? -this._get_step() : this._get_step();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe pull this ternary out to store a ? -1 : 1 multiplier before the switch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@salihefee
Copy link
Author

Just a comment; also did you build and test this locally? Did you try without natural turned on as well?

Yes, it works with natural scrolling on and off.

Copy link
Owner

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing

[email protected]/extension.js Outdated Show resolved Hide resolved
Copy link
Owner

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and...

[email protected]/extension.js Outdated Show resolved Hide resolved
@francislavoie
Copy link
Owner

Oh - I guess this assumes all scroll events come from the trackpad? What if a user uses a mouse instead but has natural enabled? It might flip how the mouse behaves I think.

@salihefee
Copy link
Author

Oh - I guess this assumes all scroll events come from the trackpad? What if a user uses a mouse instead but has natural enabled? It might flip how the mouse behaves I think.

Oh my god... I don't know how I didn't realise that. I am discarding this and I will create another PR with an "Invert Direction" settings added. I am so sorry.

@francislavoie
Copy link
Owner

I think it might be possible to check the source of the scroll event though. You could experiment with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants