From d2f6b0738bdd90a5503fff404dfa4f0ad0962ef3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 14 Nov 2024 00:25:37 +0100 Subject: Add option to start replay on fullscreen --- TODO | 8 ++- include/Config.hpp | 2 +- include/Overlay.hpp | 4 ++ include/gui/LineSeparator.hpp | 6 +- include/gui/RadioButton.hpp | 8 ++- include/gui/SettingsPage.hpp | 4 +- src/Config.cpp | 2 +- src/Overlay.cpp | 149 ++++++++++++++++++++++++++++++++++++++---- src/gui/LineSeparator.cpp | 2 +- src/gui/RadioButton.cpp | 47 +++++++++++-- src/gui/SettingsPage.cpp | 25 +++---- src/main.cpp | 2 +- 12 files changed, 218 insertions(+), 41 deletions(-) diff --git a/TODO b/TODO index ac71593..696d368 100644 --- a/TODO +++ b/TODO @@ -78,4 +78,10 @@ Add profile option. Convert view to profile, add an option at the bottom that sa Verify monitor/audio when starting recording. Give an error if the options are no longer valid. -Add option to record focused monitor. This is less error prone when plugging in monitors, etc. \ No newline at end of file +Add option to record focused monitor. This is less error prone when plugging in monitors, etc. + +Get focused window when opening gsr-ui and pass that to the save replay script, to ignore gsr-ui when getting game name. + +gsr ui window has _NET_WM_STATE _NET_WM_STATE_ABOVE, not _NET_WM_STATE_FULLSCREEN + +For replay on fullscreen detect focused fullscreen window by checking if the window size is the same as the monitor size instead of _NET_WM_STATE_FULLSCREEN. \ No newline at end of file diff --git a/include/Config.hpp b/include/Config.hpp index fbfc86f..cfb64df 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -81,7 +81,7 @@ namespace gsr { struct ReplayConfig { RecordOptions record_options; - bool start_replay_automatically = false; + std::string turn_on_replay_automatically_mode = "dont_turn_on_automatically"; bool save_video_in_game_folder = false; bool show_replay_started_notifications = true; bool show_replay_stopped_notifications = true; diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 823e3a6..de27bf3 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -59,6 +59,8 @@ namespace gsr { void update_notification_process_status(); void update_gsr_process_status(); + void update_focused_fullscreen_status(); + void update_ui_recording_paused(); void update_ui_recording_unpaused(); @@ -115,6 +117,8 @@ namespace gsr { RecordingStatus recording_status = RecordingStatus::NONE; bool paused = false; + mgl::Clock focused_fullscreen_clock; + std::array key_bindings; }; } \ No newline at end of file diff --git a/include/gui/LineSeparator.hpp b/include/gui/LineSeparator.hpp index 8c39114..7996071 100644 --- a/include/gui/LineSeparator.hpp +++ b/include/gui/LineSeparator.hpp @@ -5,11 +5,11 @@ namespace gsr { class LineSeparator : public Widget { public: - enum class Type { + enum class Orientation { HORIZONTAL }; - LineSeparator(Type type, float width); + LineSeparator(Orientation orientation, float width); LineSeparator(const LineSeparator&) = delete; LineSeparator& operator=(const LineSeparator&) = delete; @@ -18,7 +18,7 @@ namespace gsr { mgl::vec2f get_size() override; private: - Type type; + Orientation orientation; float width; }; } \ No newline at end of file diff --git a/include/gui/RadioButton.hpp b/include/gui/RadioButton.hpp index 69339db..a009eab 100644 --- a/include/gui/RadioButton.hpp +++ b/include/gui/RadioButton.hpp @@ -9,7 +9,12 @@ namespace gsr { class RadioButton : public Widget { public: - RadioButton(mgl::Font *font); + enum class Orientation { + VERTICAL, + HORIZONTAL + }; + + RadioButton(mgl::Font *font, Orientation orientation); RadioButton(const RadioButton&) = delete; RadioButton& operator=(const RadioButton&) = delete; @@ -32,6 +37,7 @@ namespace gsr { }; mgl::Font *font; + Orientation orientation; std::vector items; size_t selected_item = 0; bool dirty = true; diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index 2fba93b..6c8a5cb 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -92,7 +92,7 @@ namespace gsr { std::unique_ptr create_container_section(); std::unique_ptr create_replay_time_entry(); std::unique_ptr create_replay_time(); - std::unique_ptr create_start_replay_on_startup(); + std::unique_ptr create_start_replay_automatically(); std::unique_ptr create_save_replay_in_game_folder(); std::unique_ptr