[gnome-games/wip/aplazas/gamepad-navigation: 7/7] collection-box: Forward gamepad events to the current view
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/gamepad-navigation: 7/7] collection-box: Forward gamepad events to the current view
- Date: Sun, 5 Aug 2018 13:08:11 +0000 (UTC)
commit 9e04669f47a1a66ae4a980b14e2807c755c35c70
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Aug 5 14:54:36 2018 +0200
collection-box: Forward gamepad events to the current view
src/ui/collection-box.vala | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/collection-box.vala b/src/ui/collection-box.vala
index 7df36578..2ea9a13b 100644
--- a/src/ui/collection-box.vala
+++ b/src/ui/collection-box.vala
@@ -51,7 +51,7 @@ private class Games.CollectionBox : Gtk.Box {
}
public bool gamepad_button_press_event (Manette.Event event) {
- if (!visible)
+ if (!get_mapped ())
return false;
uint16 button;
@@ -80,16 +80,37 @@ private class Games.CollectionBox : Gtk.Box {
return true;
default:
- return collection_view.gamepad_button_press_event (event);
+ if (viewstack.visible_child == platform_view)
+ return platform_view.gamepad_button_press_event (event);
+ else if (viewstack.visible_child == developer_view)
+ return developer_view.gamepad_button_press_event (event);
+ else
+ return collection_view.gamepad_button_press_event (event);
}
}
public bool gamepad_button_release_event (Manette.Event event) {
- return collection_view.gamepad_button_release_event (event);
+ if (!get_mapped ())
+ return false;
+
+ if (viewstack.visible_child == platform_view)
+ return platform_view.gamepad_button_release_event (event);
+ else if (viewstack.visible_child == developer_view)
+ return developer_view.gamepad_button_release_event (event);
+ else
+ return collection_view.gamepad_button_release_event (event);
}
public bool gamepad_absolute_axis_event (Manette.Event event) {
- return collection_view.gamepad_absolute_axis_event (event);
+ if (!get_mapped ())
+ return false;
+
+ if (viewstack.visible_child == platform_view)
+ return platform_view.gamepad_absolute_axis_event (event);
+ else if (viewstack.visible_child == developer_view)
+ return developer_view.gamepad_absolute_axis_event (event);
+ else
+ return collection_view.gamepad_absolute_axis_event (event);
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]