[gnome-games/wip/exalm/ds: 9/15] ui: Process runner shortcuts
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/ds: 9/15] ui: Process runner shortcuts
- Date: Sun, 20 Jan 2019 12:52:19 +0000 (UTC)
commit 7f6759657bbc6041db729a809c722b089db09461
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Jan 19 02:47:25 2019 +0500
ui: Process runner shortcuts
src/ui/application-window.vala | 6 ++++++
src/ui/display-box.vala | 24 ++++++++++++++++++++++++
2 files changed, 30 insertions(+)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 443036a7..94ccabd0 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -291,6 +291,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
if (!event.get_button (out button))
return false;
+ if (display_box.gamepad_button_press_event (event))
+ return true;
+
switch (button) {
case EventCode.BTN_MODE:
ui_state = UiState.COLLECTION;
@@ -619,6 +622,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
if (ui_state != UiState.DISPLAY)
return false;
+ if (display_box.on_key_press_event (event))
+ return true;
+
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
if ((event.keyval == Gdk.Key.f || event.keyval == Gdk.Key.F) &&
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index 97e96039..1162066c 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -70,4 +70,28 @@ private class Games.DisplayBox : Gtk.Bin {
if (child != null)
display_bin.remove (child);
}
+
+ public bool on_key_press_event (Gdk.EventKey event) {
+ if (!get_mapped ())
+ return false;
+
+ if (runner == null)
+ return false;
+
+ return runner.key_press_event (event);
+ }
+
+ public bool gamepad_button_press_event (Manette.Event event) {
+ if (!get_mapped ())
+ return false;
+
+ if (runner == null)
+ return false;
+
+ uint16 button;
+ if (!event.get_button (out button))
+ return false;
+
+ return runner.gamepad_button_press_event (button);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]