diff --git a/core/global/launch_manager.gd b/core/global/launch_manager.gd index 144b508e..7d65adff 100644 --- a/core/global/launch_manager.gd +++ b/core/global/launch_manager.gd @@ -55,16 +55,13 @@ var _apps_by_name: Dictionary = {} var _data_dir: String = ProjectSettings.get_setting("OpenGamepadUI/data/directory") var _persist_path: String = "/".join([_data_dir, "launcher.json"]) var _persist_data: Dictionary = {"version": 1} -var _ogui_window_id: int +var _ogui_window_id := gamescope.get_window_id(PID, gamescope.XWAYLAND.OGUI) var should_manage_overlay := true var logger := Log.get_logger("LaunchManager", Log.LEVEL.INFO) # Connect to Gamescope signals func _init() -> void: - # Grab the window ID of OpenGamepadUI - _ogui_window_id = gamescope.get_window_id(PID, gamescope.XWAYLAND.OGUI) - # When window focus changes, update the current app and gamepad profile var on_focus_changed := func(from: int, to: int): logger.info("Window focus changed from " + str(from) + " to: " + str(to)) @@ -109,9 +106,8 @@ func _init() -> void: if not should_manage_overlay: return - var ogui_window_id = gamescope.get_window_id(PID, gamescope.XWAYLAND.OGUI) logger.debug("Disabling STEAM_OVERLAY atom") - gamescope.set_overlay(ogui_window_id, 1) + gamescope.set_overlay(_ogui_window_id, 1) in_game_state.state_entered.connect(on_game_state_entered) in_game_state.state_exited.connect(on_game_state_exited) @@ -301,7 +297,6 @@ func set_app_gamepad_profile(app: RunningApp) -> void: ## Sets the gamepad profile for the running app with the given profile func set_gamepad_profile(path: String, target_gamepad: String = "") -> void: - logger.warn("Set gamepad profile to:", path, "With target_gamepad:", target_gamepad) # Discover the currently set gamepad to properly add additional capabilities based on that gamepad var profile_modifier := target_gamepad if target_gamepad.is_empty(): @@ -313,7 +308,7 @@ func set_gamepad_profile(path: String, target_gamepad: String = "") -> void: var profile_path := settings_manager.get_value("input", "gamepad_profile", InputPlumber.DEFAULT_GLOBAL_PROFILE) as String if not profile_path.ends_with(".json") or not FileAccess.file_exists(profile_path): profile_path = InputPlumber.DEFAULT_GLOBAL_PROFILE - logger.debug("Loading global gamepad profile: " + profile_path) + logger.info("Loading global gamepad profile: " + profile_path) for gamepad in input_plumber.composite_devices: gamepad.target_modify_profile(profile_path, profile_modifier) @@ -326,12 +321,12 @@ func set_gamepad_profile(path: String, target_gamepad: String = "") -> void: target_devices.append("touchpad") _: logger.debug(target_gamepad, "needs no additional target devices.") - logger.debug("Setting target devices to: ", target_devices) + logger.info("Setting target devices to: ", target_devices) gamepad.set_target_devices(target_devices) return - logger.debug("Loading gamepad profile: " + path) + logger.info("Loading gamepad profile: " + path) if not FileAccess.file_exists(path): logger.warn("Gamepad profile not found: " + path) return @@ -354,7 +349,7 @@ func set_gamepad_profile(path: String, target_gamepad: String = "") -> void: target_devices.append("touchpad") _: logger.debug(target_gamepad, "needs no additional target devices.") - logger.debug("Setting target devices to: ", target_devices) + logger.info("Setting target devices to: ", target_devices) gamepad.set_target_devices(target_devices) var notify := Notification.new("Using gamepad profile: " + profile.name) diff --git a/core/systems/input/focus_group.gd b/core/systems/input/focus_group.gd index d8a83411..a477dc7a 100644 --- a/core/systems/input/focus_group.gd +++ b/core/systems/input/focus_group.gd @@ -11,6 +11,7 @@ class_name FocusGroup @export_category("Focus Control") ## The current focus of the focus group @export var current_focus: Control +## DEPRECATED: Use [InputWatcher] nodes with [FocusSetter] to handle back input. ## Menus with multiple levels of focus groups can be part of a chain of focus @export var focus_stack: FocusStack ## The InputEvent that will trigger focusing a parent focus group @@ -423,6 +424,7 @@ func _vbox_set_focus_tree(control_children: Array[Control]) -> void: child.focus_next = control_children[i + 1].get_path() child.focus_neighbor_bottom = control_children[i + 1].get_path() else: + # If wrap focus is enabled, then link focus of the last node to the first node. if wrap_focus: child.focus_next = control_children[0].get_path() child.focus_neighbor_bottom = control_children[0].get_path() diff --git a/core/systems/input/input_manager.gd b/core/systems/input/input_manager.gd index 633a04e6..7925a935 100644 --- a/core/systems/input/input_manager.gd +++ b/core/systems/input/input_manager.gd @@ -176,7 +176,9 @@ func _guide_input(event: InputEvent) -> void: # Only act on release events if event.is_pressed(): logger.warn("Guide pressed. Waiting for additional events.") - # Set the gamepad profile to the global default so we can capture button events + # Set the gamepad profile to the global default so we can capture button events. + # This ensures that we use the global profile and not the game's input profile for + # processing guide button combos and navigating the menu. launch_manager.set_gamepad_profile("") return @@ -201,14 +203,13 @@ func _main_menu_input(event: InputEvent) -> void: # Open the main menu var state := popup_state_machine.current_state() - var menu_state := main_menu_state - if state == menu_state: + if state == main_menu_state: popup_state_machine.pop_state() elif state in [quick_bar_state, osk_state]: - popup_state_machine.replace_state(menu_state) + popup_state_machine.replace_state(main_menu_state) else: - popup_state_machine.push_state(menu_state) + popup_state_machine.push_state(main_menu_state) ## Handle quick bar menu events to open the quick bar menu @@ -234,7 +235,6 @@ func _osk_input(event: InputEvent) -> void: var state := popup_state_machine.current_state() if state == osk_state: - logger.error("POP POP MUTHAFUCKA") osk.close() popup_state_machine.pop_state() return diff --git a/core/systems/input/overlay_mode_input_manager.gd b/core/systems/input/overlay_mode_input_manager.gd index 1d22de7e..f060c8fe 100644 --- a/core/systems/input/overlay_mode_input_manager.gd +++ b/core/systems/input/overlay_mode_input_manager.gd @@ -246,7 +246,9 @@ func _guide_input(event: InputEvent) -> void: # Only act on release events if event.is_pressed(): logger.debug("Guide pressed. Waiting for additional events.") - # Set the gamepad profile to the global default so we can capture button events + # Set the gamepad profile to the global default so we can capture button events. + # This ensures that we use the global profile and not the game's input profile for + # processing guide button combos and navigating the menu. launch_manager.set_gamepad_profile("") return diff --git a/core/ui/card_ui/gamepad/gamepad_settings.gd b/core/ui/card_ui/gamepad/gamepad_settings.gd index 6f0add40..d5dbdab0 100644 --- a/core/ui/card_ui/gamepad/gamepad_settings.gd +++ b/core/ui/card_ui/gamepad/gamepad_settings.gd @@ -679,7 +679,7 @@ func _save_profile() -> void: if running_app: if running_app.launch_item.name != library_item.name: pass - logger.warn("Reloading gamepad profile for running game") + logger.debug("Reloading gamepad profile for running game") launch_manager.set_gamepad_profile(path) diff --git a/core/ui/card_ui/home/cardui_home.gd b/core/ui/card_ui/home/cardui_home.gd index 09f30021..41ba2809 100644 --- a/core/ui/card_ui/home/cardui_home.gd +++ b/core/ui/card_ui/home/cardui_home.gd @@ -20,13 +20,13 @@ var recent_apps: Array var tween: Tween var logger := Log.get_logger("HomeMenu", Log.LEVEL.INFO) -@onready var container: HBoxContainer = $%CardContainer -@onready var banner: TextureRect = $%BannerTexture +@onready var container := $%CardContainer as HBoxContainer +@onready var banner := $%BannerTexture as TextureRect @onready var library_banner := $%LibraryBanner as Control -@onready var player: AnimationPlayer = $%AnimationPlayer -@onready var scroll_container: ScrollContainer = $%ScrollContainer -@onready var library_deck: LibraryDeck = $%LibraryDeck -@onready var end_spacer := $%EndSpacer +@onready var player := $%AnimationPlayer as AnimationPlayer +@onready var scroll_container := $%ScrollContainer as ScrollContainer +@onready var library_deck := $%LibraryDeck as LibraryDeck +@onready var end_spacer := $%EndSpacer as Control # Called when the node enters the scene tree for the first time. diff --git a/core/ui/card_ui/navigation/running_game_card.tscn b/core/ui/card_ui/navigation/running_game_card.tscn index 8038c16a..279c8c8a 100644 --- a/core/ui/card_ui/navigation/running_game_card.tscn +++ b/core/ui/card_ui/navigation/running_game_card.tscn @@ -17,7 +17,7 @@ [ext_resource type="Resource" uid="uid://cr544el0cqjlm" path="res://assets/state/state_machines/global_state_machine.tres" id="15_p4kr0"] [ext_resource type="Resource" uid="uid://cv3vduo0ojk1u" path="res://assets/state/states/menu.tres" id="16_vmedb"] -[sub_resource type="Image" id="Image_w47dc"] +[sub_resource type="Image" id="Image_2yqt6"] data = { "data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0), "format": "RGBA8", @@ -27,7 +27,7 @@ data = { } [sub_resource type="ImageTexture" id="ImageTexture_osglk"] -image = SubResource("Image_w47dc") +image = SubResource("Image_2yqt6") [node name="RunningGameCard" type="PanelContainer"] anchors_preset = 10 @@ -152,7 +152,7 @@ layout_mode = 2 [node name="ResumeButton" parent="MarginContainer/VBoxContainer/ContentContainer" instance=ExtResource("8_ixs6g")] unique_name_in_owner = true layout_mode = 2 -text = "Resume" +text = "Return" [node name="PauseButton" parent="MarginContainer/VBoxContainer/ContentContainer" instance=ExtResource("8_ixs6g")] unique_name_in_owner = true diff --git a/core/ui/card_ui/settings/plugin_settings_menu.tscn b/core/ui/card_ui/settings/plugin_settings_menu.tscn index dd55257a..4706c2d7 100644 --- a/core/ui/card_ui/settings/plugin_settings_menu.tscn +++ b/core/ui/card_ui/settings/plugin_settings_menu.tscn @@ -12,7 +12,7 @@ [ext_resource type="PackedScene" uid="uid://o0equu1tyr4s" path="res://core/ui/components/expandable_card.tscn" id="8_veuxu"] [ext_resource type="PackedScene" uid="uid://b0cyl6fdqxevn" path="res://core/systems/input/scroller_joystick.tscn" id="10_nbqrj"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l6jww"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xcwv0"] resource_local_to_scene = true bg_color = Color(0.105882, 0.109804, 0.141176, 1) border_blend = true @@ -72,6 +72,6 @@ horizontal_alignment = 1 [node name="ExpandableCard" parent="MarginContainer/ContentContainer" instance=ExtResource("8_veuxu")] layout_mode = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_l6jww") +theme_override_styles/panel = SubResource("StyleBoxFlat_xcwv0") [node name="ScrollerJoystick" parent="." instance=ExtResource("10_nbqrj")] diff --git a/core/ui/components/drive_card.gd b/core/ui/components/drive_card.gd index 092416ac..12cce13f 100644 --- a/core/ui/components/drive_card.gd +++ b/core/ui/components/drive_card.gd @@ -77,7 +77,7 @@ func _srm_format_drive() -> void: var dialog := get_tree().get_first_node_in_group("dialog") as Dialog var msg := "WARNING: All data on " + device_path + " device will be wiped. " + \ "This action cannot be undone. Do you wish to continue?" - dialog.open(self, msg, "Cancel", "Continue Format") + dialog.open(format_button, msg, "Cancel", "Continue Format") var cancel := await dialog.choice_selected as bool if cancel: return diff --git a/core/ui/components/plugin_store_card.gd b/core/ui/components/plugin_store_card.gd index 6de13e71..e86346a6 100644 --- a/core/ui/components/plugin_store_card.gd +++ b/core/ui/components/plugin_store_card.gd @@ -149,20 +149,3 @@ func _gui_input(event: InputEvent) -> void: pressed.emit() else: button_up.emit() - -# -#func _input(event: InputEvent) -> void: -# if not event.is_action("ogui_east"): -# return -# if not event.is_released(): -# return -# -# # Only process input if a child node has focus -# var focus_owner := get_viewport().gui_get_focus_owner() -# if not self.is_ancestor_of(focus_owner): -# return -# -# # Stop the event from propagating -# #logger.debug("Consuming input event '{action}' for node {n}".format({"action": action, "n": str(self)})) -# get_viewport().set_input_as_handled() -#