Skip to content

settings: Allow clearing a joystick button mapping - #325

Closed
EdueskaWeiz wants to merge 1 commit into
glikely:mainfrom
EdueskaWeiz:fix/joystick-button-none
Closed

settings: Allow clearing a joystick button mapping#325
EdueskaWeiz wants to merge 1 commit into
glikely:mainfrom
EdueskaWeiz:fix/joystick-button-none

Conversation

@EdueskaWeiz

Copy link
Copy Markdown
Contributor

Fixes #269.

In the joystick button mapping menu, every hotkey entry is wired to on_menuAction(), but the "None" entry was added without connecting its triggered() signal - so selecting "None" did nothing and a button could never be set back to unmapped.

The "None" action is now connected like the others. It carries no data, so on_menuAction() forwards an empty hotkey name, which setJoystickButtonHotkey() already treats as "remove the mapping".

Built cleanly on Ubuntu, macOS and Windows via CI.

The per button mapping menu in the joystick settings adds a "None" entry
followed by one entry per frontend hotkey. The hotkey entries are wired
to on_menuAction(), but the "None" entry was added without connecting its
triggered() signal, so selecting it did nothing and a button could never
be set back to unmapped.

Connect the "None" action like the others. It carries no data, so
on_menuAction() forwards an empty hotkey name, which
setJoystickButtonHotkey() already treats as "remove the mapping".

Closes glikely#269
Reported-by: BillyBob1354
Signed-off-by: Eddy Weiz <eddyweiz@gmail.com>
@glikely

glikely commented Jun 26, 2026

Copy link
Copy Markdown
Owner

As per others, please test before opening a PR

@glikely glikely closed this Jun 26, 2026
@EdueskaWeiz

Copy link
Copy Markdown
Contributor Author

Status on this one, so it is not just sitting here silently.

I have now built from source and tested #324, #327, #329 and #270 locally against OBS Studio 32.2.1 on Windows, and this is the one I cannot honestly claim to have tested: I have no game controller. Joystick support is compiled in and the option is enabled, but the device list stays empty, so there are no button rows and therefore no "None" entry to click.

What I can say about the change without a controller: the "None" action is created alongside the hotkey actions but was never connected to on_menuAction(), so choosing it did nothing. Connecting it makes a->data().toString() return an empty string, and setJoystickButtonHotkey() already treats an empty name as "remove the mapping" — the same path a mapping removal takes today.

I would rather leave it closed than reopen it on that basis. If you would like it anyway, say so and I will reopen; otherwise it stays here until I can get hold of a controller and do it properly, including the restart check that the removal really lands in the config.

@glikely glikely reopened this Aug 8, 2026
@EdueskaWeiz

Copy link
Copy Markdown
Contributor Author

Thanks for reopening. I found a way to test it after all, so here is the evidence rather than the hand-waving.

How I got a joystick without owning one. QJoysticks ships a keyboard-driven virtual joystick, which the plugin explicitly turns off in PTZControls::joystickSetup(). For testing only I flipped that one line to setVirtualJoystickEnabled(true) in a throwaway build. That produces a device with 6 axes and 10 buttons in the settings page, which is enough to drive the button mapping UI. That line is not part of this PR — it exists only in the two local builds below, and the code under test does not care which backend supplied the device.

Versions as logged by the plugin on load:

  • with this PR: v0.18.3-rc1-66-gfe585af — current main + this commit + the test helper
  • without it: v0.18.3-rc1-65-g81bacfc — current main + the test helper only

Without the patch. Button 0 mapped to "Next Camera". Opening the button menu and choosing "None" leaves the label reading "Next Camera". Nothing happens. That is #269.

With the patch. Same starting point — the mapping survived a rebuild and reinstall, so it really came back from config.json and not from a stale widget. Choosing "None" switches the label to "None" straight away, and after closing OBS the plugin config reads:

"joystick_button_hotkeys": [],

So the mapping is genuinely removed and persisted, not just blanked in the UI.

One thing I fell over while setting this up, unrelated to this change: with joystick_id still at its default -1, selecting a joystick in the list does not build the axis and button rows. joystickCurrentChanged() only calls setJoystickId(), while the rows are created in joystickUpdate(), which runs at setup and on countChanged. So the mapping area stays empty until OBS is restarted with a stored joystick_id. With a controller plugged in before OBS starts this is probably invisible. Say the word and I will open a separate issue rather than mixing it into this one.

Still no physical controller here, so what I verified is the menu behaviour and the persisted config, not an actual button press on hardware.

@glikely

glikely commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Merged, thanks

@glikely glikely closed this Aug 9, 2026
@EdueskaWeiz EdueskaWeiz mentioned this pull request Aug 9, 2026
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.

v0.18.1 - Can not set joystick button back to none

2 participants