diff options
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | include/Config.hpp | 1 | ||||
-rw-r--r-- | include/gui/RadioButton.hpp | 3 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 4 | ||||
-rw-r--r-- | meson.build | 12 | ||||
-rw-r--r-- | project.conf | 2 | ||||
-rw-r--r-- | src/Config.cpp | 1 | ||||
-rw-r--r-- | src/Overlay.cpp | 10 | ||||
-rw-r--r-- | src/gui/RadioButton.cpp | 11 | ||||
-rw-r--r-- | src/gui/SettingsPage.cpp | 38 |
10 files changed, 72 insertions, 22 deletions
@@ -164,9 +164,15 @@ Keyboard layout is incorrect on wayland when using kde plasma keyboard settings Need to use "setxkbmap fr" as well. This happens only when grabbing keyboard (gsr-global-hotkeys). Same thing is seen with xev. -Allow to configure replay by disk space as well. When changing bitrate change an editable field that says the disk space, and when changing that disk space field then change the bitrate or duration. - Getting focused monitor on wayland doesn't work when vrr is enabled. This is because it uses software cursor instead (at least on kde plasma wayland). Right now it falls back to create window & getting window position trick if there is no cursor visible (or a software cursor) and one monitor has vrr enabled. Remove this when linux & wayland supports vrr with hardware cursor plane. - Find out another way to get cursor position on wayland.
\ No newline at end of file + Find out another way to get cursor position on wayland. + This was fixed in linux 6.11 and in kde plasma in this commit: https://invent.kde.org/plasma/kwin/-/merge_requests/7582/diffs. + +Add option to start recording/replay/stream after the notification has disappeared. Show "Starting recording on this monitor in 3 seconds". + See if we can use hardware overlay plane instead somehow. + +When using wayland for mgl try using wlr-layer-shell and set layer to overlay and keyboard interactivity to exclusive. Do something similar for notifications. + +When starting gsr-ui remove any temporary replay disk data that has possibly remained from a crash, by looking for all folders that starts with gsr-replay and end with .gsr, in the replay directory.
\ No newline at end of file diff --git a/include/Config.hpp b/include/Config.hpp index c8c6650..2bb79fb 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -117,6 +117,7 @@ namespace gsr { std::string save_directory; std::string container = "mp4"; int32_t replay_time = 60; + std::string replay_storage = "ram"; ConfigHotkey start_stop_hotkey; ConfigHotkey save_hotkey; ConfigHotkey save_1_min_hotkey; diff --git a/include/gui/RadioButton.hpp b/include/gui/RadioButton.hpp index 16d638e..e319aa0 100644 --- a/include/gui/RadioButton.hpp +++ b/include/gui/RadioButton.hpp @@ -23,7 +23,8 @@ namespace gsr { void add_item(const std::string &text, const std::string &id); void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true); - const std::string get_selected_id() const; + const std::string& get_selected_id() const; + const std::string& get_selected_text() const; mgl::vec2f get_size() override; diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index fb705cc..ae4b480 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -97,11 +97,12 @@ namespace gsr { std::unique_ptr<List> create_container_section(); std::unique_ptr<List> create_replay_time_entry(); std::unique_ptr<List> create_replay_time(); + std::unique_ptr<List> create_replay_storage(); std::unique_ptr<RadioButton> create_start_replay_automatically(); std::unique_ptr<CheckBox> create_save_replay_in_game_folder(); std::unique_ptr<CheckBox> create_restart_replay_on_save(); std::unique_ptr<Label> create_estimated_replay_file_size(); - void update_estimated_replay_file_size(); + void update_estimated_replay_file_size(const std::string &replay_storage_type); void update_replay_time_text(); std::unique_ptr<CheckBox> create_save_recording_in_game_folder(); std::unique_ptr<Label> create_estimated_record_file_size(); @@ -186,6 +187,7 @@ namespace gsr { Entry *youtube_stream_key_entry_ptr = nullptr; Entry *stream_url_entry_ptr = nullptr; Entry *replay_time_entry_ptr = nullptr; + RadioButton *replay_storage_button_ptr = nullptr; Label *replay_time_label_ptr = nullptr; RadioButton *turn_on_replay_automatically_mode_ptr = nullptr; Subsection *audio_section_ptr = nullptr; diff --git a/meson.build b/meson.build index 2f991ed..254c5b5 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('gsr-ui', ['c', 'cpp'], version : '1.5.1', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends') +project('gsr-ui', ['c', 'cpp'], version : '1.6.0', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends') if get_option('buildtype') == 'debug' add_project_arguments('-g3', language : ['c', 'cpp']) @@ -32,6 +32,11 @@ src = [ 'src/gui/GlobalSettingsPage.cpp', 'src/gui/GsrPage.cpp', 'src/gui/Subsection.cpp', + 'src/GlobalHotkeys/GlobalHotkeysX11.cpp', + 'src/GlobalHotkeys/GlobalHotkeysLinux.cpp', + 'src/GlobalHotkeys/GlobalHotkeysJoystick.cpp', + 'src/CursorTracker/CursorTrackerX11.cpp', + 'src/CursorTracker/CursorTrackerWayland.cpp', 'src/Utils.cpp', 'src/WindowUtils.cpp', 'src/RegionSelector.cpp', @@ -39,11 +44,6 @@ src = [ 'src/GsrInfo.cpp', 'src/Process.cpp', 'src/Overlay.cpp', - 'src/GlobalHotkeys/GlobalHotkeysX11.cpp', - 'src/GlobalHotkeys/GlobalHotkeysLinux.cpp', - 'src/GlobalHotkeys/GlobalHotkeysJoystick.cpp', - 'src/CursorTracker/CursorTrackerX11.cpp', - 'src/CursorTracker/CursorTrackerWayland.cpp', 'src/AudioPlayer.cpp', 'src/Hotplug.cpp', 'src/Rpc.cpp', diff --git a/project.conf b/project.conf index 6e67858..fb4a3a4 100644 --- a/project.conf +++ b/project.conf @@ -1,7 +1,7 @@ [package] name = "gsr-ui" type = "executable" -version = "1.5.1" +version = "1.6.0" platforms = ["posix"] [lang.cpp] diff --git a/src/Config.cpp b/src/Config.cpp index 2de6a96..3445e56 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -264,6 +264,7 @@ namespace gsr { {"replay.save_directory", &config.replay_config.save_directory}, {"replay.container", &config.replay_config.container}, {"replay.time", &config.replay_config.replay_time}, + {"replay.replay_storage", &config.replay_config.replay_storage}, {"replay.start_stop_hotkey", &config.replay_config.start_stop_hotkey}, {"replay.save_hotkey", &config.replay_config.save_hotkey}, {"replay.save_1_min_hotkey", &config.replay_config.save_1_min_hotkey}, diff --git a/src/Overlay.cpp b/src/Overlay.cpp index c423125..70278ee 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -934,8 +934,11 @@ namespace gsr { // when a compositor isn't running. window_create_params.graphics_api = gsr_info.system_info.display_server == DisplayServer::WAYLAND ? MGL_GRAPHICS_API_GLX : MGL_GRAPHICS_API_EGL; - if(!window->create("gsr ui", window_create_params)) + if(!window->create("gsr ui", window_create_params)) { fprintf(stderr, "error: failed to create window\n"); + window.reset(); + return; + } //window->set_low_latency(true); @@ -2308,6 +2311,11 @@ namespace gsr { args.push_back("yes"); } + if(gsr_info.system_info.gsr_version >= GsrVersion{5, 5, 0}) { + args.push_back("-replay-storage"); + args.push_back(config.replay_config.replay_storage.c_str()); + } + char region_str[128]; add_common_gpu_screen_recorder_args(args, config.replay_config.record_options, audio_tracks, video_bitrate, size, region_str, sizeof(region_str), region_selector); diff --git a/src/gui/RadioButton.cpp b/src/gui/RadioButton.cpp index a6ef96a..bbb958a 100644 --- a/src/gui/RadioButton.cpp +++ b/src/gui/RadioButton.cpp @@ -169,7 +169,7 @@ namespace gsr { } } - const std::string RadioButton::get_selected_id() const { + const std::string& RadioButton::get_selected_id() const { if(items.empty()) { static std::string dummy; return dummy; @@ -177,4 +177,13 @@ namespace gsr { return items[selected_item].id; } } + + const std::string& RadioButton::get_selected_text() const { + if(items.empty()) { + static std::string dummy; + return dummy; + } else { + return items[selected_item].text.get_string(); + } + } }
\ No newline at end of file diff --git a/src/gui/SettingsPage.cpp b/src/gui/SettingsPage.cpp index 9890d17..b457ab4 100644 --- a/src/gui/SettingsPage.cpp +++ b/src/gui/SettingsPage.cpp @@ -715,7 +715,7 @@ namespace gsr { auto list = std::make_unique<List>(List::Orientation::HORIZONTAL, List::Alignment::CENTER); auto replay_time_entry = std::make_unique<Entry>(&get_theme().body_font, "60", get_theme().body_font.get_character_size() * 3); - replay_time_entry->validate_handler = create_entry_validator_integer_in_range(1, 10800); + replay_time_entry->validate_handler = create_entry_validator_integer_in_range(2, 86400); replay_time_entry_ptr = replay_time_entry.get(); list->add_widget(std::move(replay_time_entry)); @@ -733,6 +733,24 @@ namespace gsr { return replay_time_list; } + std::unique_ptr<List> SettingsPage::create_replay_storage() { + auto list = std::make_unique<List>(List::Orientation::VERTICAL); + list->add_widget(std::make_unique<Label>(&get_theme().body_font, "Where should temporary replay data be stored?", get_color_theme().text_color)); + auto replay_storage_button = std::make_unique<RadioButton>(&get_theme().body_font, RadioButton::Orientation::HORIZONTAL); + replay_storage_button_ptr = replay_storage_button.get(); + replay_storage_button->add_item("RAM", "ram"); + replay_storage_button->add_item("Disk (not recommended on SSDs)", "disk"); + + replay_storage_button->on_selection_changed = [this](const std::string&, const std::string &id) { + update_estimated_replay_file_size(id); + return true; + }; + + list->add_widget(std::move(replay_storage_button)); + list->set_visible(gsr_info->system_info.gsr_version >= GsrVersion{5, 5, 0}); + return list; + } + std::unique_ptr<RadioButton> SettingsPage::create_start_replay_automatically() { char fullscreen_text[256]; snprintf(fullscreen_text, sizeof(fullscreen_text), "Turn on replay when starting a fullscreen application%s", gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)"); @@ -766,13 +784,13 @@ namespace gsr { return label; } - void SettingsPage::update_estimated_replay_file_size() { + void SettingsPage::update_estimated_replay_file_size(const std::string &replay_storage_type) { const int64_t replay_time_seconds = atoi(replay_time_entry_ptr->get_text().c_str()); const int64_t video_bitrate_bps = atoi(video_bitrate_entry_ptr->get_text().c_str()) * 1000LL / 8LL; const double video_filesize_mb = ((double)replay_time_seconds * (double)video_bitrate_bps) / 1000.0 / 1000.0 * 1.024; char buffer[256]; - snprintf(buffer, sizeof(buffer), "Estimated video max file size in RAM: %.2fMB.\nChange video bitrate or replay duration to change file size.", video_filesize_mb); + snprintf(buffer, sizeof(buffer), "Estimated video max file size %s: %.2fMB.\nChange video bitrate or replay duration to change file size.", replay_storage_type == "ram" ? "in RAM" : "on disk", video_filesize_mb); estimated_file_size_ptr->set_text(buffer); } @@ -811,12 +829,14 @@ namespace gsr { settings_list_ptr->add_widget(std::make_unique<Subsection>("File info", std::move(file_info_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f))); auto general_list = std::make_unique<List>(List::Orientation::VERTICAL); - general_list->add_widget(create_start_replay_automatically()); + general_list->add_widget(create_replay_storage()); general_list->add_widget(create_save_replay_in_game_folder()); if(gsr_info->system_info.gsr_version >= GsrVersion{5, 0, 3}) general_list->add_widget(create_restart_replay_on_save()); settings_list_ptr->add_widget(std::make_unique<Subsection>("General", std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f))); + settings_list_ptr->add_widget(std::make_unique<Subsection>("Autostart", create_start_replay_automatically(), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f))); + auto checkboxes_list = std::make_unique<List>(List::Orientation::VERTICAL); auto show_replay_started_notification_checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Show replay started notification"); @@ -845,12 +865,12 @@ namespace gsr { view_radio_button_ptr->on_selection_changed("Simple", "simple"); replay_time_entry_ptr->on_changed = [this](const std::string&) { - update_estimated_replay_file_size(); + update_estimated_replay_file_size(replay_storage_button_ptr->get_selected_id()); update_replay_time_text(); }; video_bitrate_entry_ptr->on_changed = [this](const std::string&) { - update_estimated_replay_file_size(); + update_estimated_replay_file_size(replay_storage_button_ptr->get_selected_id()); }; } @@ -1173,6 +1193,7 @@ namespace gsr { void SettingsPage::load_replay() { load_common(config.replay_config.record_options); + replay_storage_button_ptr->set_selected_item(config.replay_config.replay_storage); turn_on_replay_automatically_mode_ptr->set_selected_item(config.replay_config.turn_on_replay_automatically_mode); save_replay_in_game_folder_ptr->set_checked(config.replay_config.save_video_in_game_folder); if(restart_replay_on_save) @@ -1185,8 +1206,8 @@ namespace gsr { if(config.replay_config.replay_time < 2) config.replay_config.replay_time = 2; - if(config.replay_config.replay_time > 10800) - config.replay_config.replay_time = 10800; + if(config.replay_config.replay_time > 86400) + config.replay_config.replay_time = 86400; replay_time_entry_ptr->set_text(std::to_string(config.replay_config.replay_time)); } @@ -1322,6 +1343,7 @@ namespace gsr { config.replay_config.save_directory = save_directory_button_ptr->get_text(); config.replay_config.container = container_box_ptr->get_selected_id(); config.replay_config.replay_time = atoi(replay_time_entry_ptr->get_text().c_str()); + config.replay_config.replay_storage = replay_storage_button_ptr->get_selected_id(); if(config.replay_config.replay_time < 5) { config.replay_config.replay_time = 5; |