[gnome-games] retro-input-manager: Don't set device to null redundantly



commit d5d500f9154400979fa7d6f1a0005c9bc9636a31
Author: Yetizone <andreii lisita gmail com>
Date:   Sun Dec 2 13:09:31 2018 +0200

    retro-input-manager: Don't set device to null redundantly
    
    When changing input mode without changing core view joypad port, the
    corresponding manette device is already null, so don't set it to null
    again.

 src/retro/retro-input-manager.vala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/retro/retro-input-manager.vala b/src/retro/retro-input-manager.vala
index cead29ea..3b17e131 100644
--- a/src/retro/retro-input-manager.vala
+++ b/src/retro/retro-input-manager.vala
@@ -77,8 +77,6 @@ private class Games.RetroInputManager : Object {
        }
 
        private void update_core_view_gamepad () {
-               devices[core_view_joypad_port] = null;
-
                if (input_mode == InputMode.GAMEPAD) {
                        controllers[core_view_joypad_port] = core_view_joypad;
                        core.set_controller (core_view_joypad_port, core_view_joypad);
@@ -108,6 +106,7 @@ private class Games.RetroInputManager : Object {
                        if (controllers[i] == null) {
                                // Found an disconnected port and so assigning core_view_joypad to it
                                core_view_joypad_port = i;
+                               devices[core_view_joypad_port] = null;
                                update_core_view_gamepad ();
 
                                return;
@@ -136,6 +135,7 @@ private class Games.RetroInputManager : Object {
                        controllers[core_view_joypad_port] = null;
                        core.set_controller (core_view_joypad_port, null);
                        core_view_joypad_port = port;
+                       devices[core_view_joypad_port] = null;
                        update_core_view_gamepad ();
                }
                else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]