Skip to content

config/lua: fix device bool int reads - #14313

Merged
vaxerski merged 2 commits into
hyprwm:mainfrom
imperishableSecret:fix/mouse-button-switch
May 6, 2026
Merged

config/lua: fix device bool int reads#14313
vaxerski merged 2 commits into
hyprwm:mainfrom
imperishableSecret:fix/mouse-button-switch

Conversation

@imperishableSecret

@imperishableSecret imperishableSecret commented May 6, 2026

Copy link
Copy Markdown
Contributor

Describe your PR, what does it fix/add?

Fixes Lua config reads for pointer device options that are declared as boolean values but consumed through the integer device-config getter.

The Lua backend previously implemented getDeviceInt() by directly casting every stored value to Config::INTEGER. That is invalid for bool-backed options such as left_handed and natural_scroll, which are stored as Config::BOOL. When pointer config was reapplied during reload/refresher work, this could read a bool value as a nonzero integer and incorrectly enable libinput options, making mouse buttons appear swapped and scroll direction appear inverted.

This PR adds a virtual integer conversion hook for Lua config values:

  • int values return their stored integer
  • bool values return 0 or 1
  • float values return their stored float
  • vec2 values return their stored vector
  • string values return their stored string
  • unsupported value/type combinations assert instead of being reinterpreted through an invalid pointer cast

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

Hello and thank you for making a PR to Hyprland!

Please check the PR Guidelines and make sure your PR follows them.
It will make the entire review process faster. :)

If your code can be tested, please always add tests. See more here.

beep boop, I'm just a bot. A real human will review your PR soon.

@imperishableSecret
imperishableSecret marked this pull request as ready for review May 6, 2026 18:00

@vaxerski vaxerski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tnx

@vaxerski
vaxerski merged commit 336dc6c into hyprwm:main May 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants