Skip to content

Commit

Permalink
Adjust gamepad disconnect behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
msub2 committed Feb 12, 2024
1 parent 237f537 commit dd0a268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/gamepadlist.rs
Expand Up @@ -46,7 +46,7 @@ impl GamepadList {
}

pub fn remove_gamepad(&self, index: usize) {
self.list.borrow_mut().remove(index).update_connected(false);
self.list.borrow_mut().remove(index);
}
}

Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/globalscope.rs
Expand Up @@ -3166,7 +3166,8 @@ impl GlobalScope {
let global = this.root();
if let Some(window) = global.downcast::<Window>() {
let gamepad_list = window.Navigator().GetGamepads();
if gamepad_list.Length() > 0 {
if let Some(gamepad) = gamepad_list.Item(index as u32) {
gamepad.update_connected(false);
gamepad_list.remove_gamepad(index);
}
}
Expand Down

0 comments on commit dd0a268

Please sign in to comment.