Skip to content

settings: Widen the joystick deadzone slider to the supported range - #336

Merged
glikely merged 1 commit into
glikely:mainfrom
EdueskaWeiz:fix/joystick-deadzone-range
Aug 9, 2026
Merged

settings: Widen the joystick deadzone slider to the supported range#336
glikely merged 1 commit into
glikely:mainfrom
EdueskaWeiz:fix/joystick-deadzone-range

Conversation

@EdueskaWeiz

Copy link
Copy Markdown
Contributor

Fixes #329.

PTZControls::setJoystickDeadzone() already clamps to 0.0 - 0.5, but the settings slider was constrained to a maximum of 0.15, so the upper half of the supported range was unreachable from the UI.

The narrow slider range also silently overwrote a larger value set by editing config.json by hand, which is what the reporter of #329 observed. DoubleSlider maps the double onto an integer range, and int(total / minStep) truncates: int((0.15 - 0.01) / 0.01) is 13, not 14, because the division yields 13.999999999999998. Opening the settings page therefore called setValue(49) on a slider whose maximum is 13, QSlider clamped it, and the resulting doubleValChanged() fed 0.14 straight back into setJoystickDeadzone(). That also explains the reporter's "previous max of .14" — the effective maximum really was 0.14, not the 0.15 in the source.

Testing

Built from source and run against OBS Studio 32.2.1 (Qt 6.11.1) on Windows. Both builds are this branch and current main, so the only difference is this one line. The plugin logs its version on load, which I checked before each measurement.

Build What I did joystick_deadzone in config.json afterwards
this branch, v0.18.3-rc1-65-g7da2f7d dragged the slider to its maximum, closed OBS 0.5
main, v0.18.3-rc1-64-g1b9fda2 only opened the PTZ settings page, closed OBS 0.14

The second row is the counter-proof and the reported bug at the same time: I did not touch the slider. The stored 0.5 was overwritten with 0.14 merely by opening the settings page, and persisted on exit.

One limitation: I have no controller with a drifting stick here, so what I verified is the range and the persistence, not that a deadzone of 0.5 cures a particular device.

PTZControls::setJoystickDeadzone() already clamps the value to the range
0.0 - 0.5, but the settings slider was constrained to a maximum of 0.15,
so anything above that was unreachable from the UI. Users with worn or
drifting analogue sticks need a larger deadzone than that.

The narrower slider range also silently overwrote a larger value that
had been set by editing the configuration by hand. DoubleSlider maps the
double onto an integer range, so setDoubleConstraints(0.01, 0.15, 0.01,
0.20) calls setValue(19) on a slider whose maximum is 14. QSlider clamps
that to 14, emits valueChanged(), and the resulting doubleValChanged(0.15)
feeds straight back into setJoystickDeadzone(). Merely opening the
settings page was therefore enough to reset the value, which is what the
reporter of glikely#329 observed.

Raise the slider maximum to 0.5 so that the UI exposes the range the
implementation already supports, rather than introducing another
arbitrary limit. Minimum and step size are unchanged.

Closes glikely#329
Signed-off-by: Eddy Weiz <eddyweiz@gmail.com>
@glikely
glikely merged commit 0383658 into glikely:main Aug 9, 2026
6 checks passed
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.

Increase Joystick Deadzone Maximum From 0.14 to 0.25 (or higher)

2 participants