[gnome-games/wip/exalm/ds-popover: 5/16] runner: Add key and gamepad button press callbacks



commit 77b8ec26e1412c81a7f63096501f350a88cbe9d9
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Jan 19 02:44:58 2019 +0500

    runner: Add key and gamepad button press callbacks
    
    This will allow plugins to define custom keyboard and gamepad shortcuts
    for their runners.

 src/command/command-runner.vala | 8 ++++++++
 src/core/runner.vala            | 3 +++
 src/dummy/dummy-runner.vala     | 8 ++++++++
 src/retro/retro-runner.vala     | 8 ++++++++
 4 files changed, 27 insertions(+)
---
diff --git a/src/command/command-runner.vala b/src/command/command-runner.vala
index c70191d6..8db2a5e0 100644
--- a/src/command/command-runner.vala
+++ b/src/command/command-runner.vala
@@ -85,4 +85,12 @@ public class Games.CommandRunner : Object, Runner {
        public InputMode[] get_available_input_modes () {
                return { };
        }
+
+       public bool key_press_event (Gdk.EventKey event) {
+               return false;
+       }
+
+       public bool gamepad_button_press_event (uint16 button) {
+               return false;
+       }
 }
diff --git a/src/core/runner.vala b/src/core/runner.vala
index c140405a..e5374866 100644
--- a/src/core/runner.vala
+++ b/src/core/runner.vala
@@ -17,4 +17,7 @@ public interface Games.Runner : Object {
        public abstract void pause ();
        public abstract void stop ();
        public abstract InputMode[] get_available_input_modes ();
+
+       public abstract bool key_press_event (Gdk.EventKey event);
+       public abstract bool gamepad_button_press_event (uint16 button);
 }
diff --git a/src/dummy/dummy-runner.vala b/src/dummy/dummy-runner.vala
index af443a54..d82572e0 100644
--- a/src/dummy/dummy-runner.vala
+++ b/src/dummy/dummy-runner.vala
@@ -51,4 +51,12 @@ private class Games.DummyRunner : Object, Runner {
        public InputMode[] get_available_input_modes () {
                return { };
        }
+
+       public bool key_press_event (Gdk.EventKey event) {
+               return false;
+       }
+
+       public bool gamepad_button_press_event (uint16 button) {
+               return false;
+       }
 }
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 8b1e2a8d..12f72c5e 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -309,6 +309,14 @@ public class Games.RetroRunner : Object, Runner {
                        return { InputMode.GAMEPAD };
        }
 
+       public bool key_press_event (Gdk.EventKey event) {
+               return false;
+       }
+
+       public bool gamepad_button_press_event (uint16 button) {
+               return false;
+       }
+
        private void on_media_number_changed () {
                if (!is_initialized)
                        return;


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