aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-05-24 18:24:18 +0200
committerdec05eba <dec05eba@protonmail.com>2025-05-24 18:24:18 +0200
commitb80e3f8bebe48e102033fe7ab0e402aa869135d3 (patch)
tree45c5132f36ba3a2c018c161662563c7b093e053d
parentb807712d79121157b6a6d0df902f0f66da82a23f (diff)
Fix crash when opening settings page because of recent changeHEADmaster
-rw-r--r--README.md2
-rw-r--r--TODO2
-rw-r--r--include/gui/SettingsPage.hpp1
-rw-r--r--src/Overlay.cpp20
-rw-r--r--src/gui/SettingsPage.cpp2
5 files changed, 18 insertions, 9 deletions
diff --git a/README.md b/README.md
index 07bfb45..96d0d0f 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ A program called `gsr-ui-cli` is also installed when installing this software. T
# Installation
If you are using an Arch Linux based distro then you can find gpu screen recorder ui on aur under the name gpu-screen-recorder-ui (`yay -S gpu-screen-recorder-ui`).\
If you are running another distro then you can run `sudo ./install.sh`, but you need to manually install the dependencies, as described below.\
-You can also install gpu screen recorder from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder). This flatpak includes both this UI and gpu-screen-recorder so no need to install that first.
+You can also install gpu screen recorder from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder) which includes this UI.
# Dependencies
GPU Screen Recorder UI uses meson build system so you need to install `meson` to build GPU Screen Recorder UI.
diff --git a/TODO b/TODO
index cadc1d0..c7b59e2 100644
--- a/TODO
+++ b/TODO
@@ -37,8 +37,6 @@ Fix first frame being black when running without a compositor.
Add support for systray.
-Add option to take screenshot.
-
Move event callbacks to a global list instead of std::function object in each widget. This reduces the size of widgets,
since most widgets wont have the event callback set.
This event callback would pass the widget as an argument.
diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp
index 8e28345..08bbd9d 100644
--- a/include/gui/SettingsPage.hpp
+++ b/include/gui/SettingsPage.hpp
@@ -200,7 +200,6 @@ namespace gsr {
RadioButton *turn_on_replay_automatically_mode_ptr = nullptr;
Subsection *audio_section_ptr = nullptr;
List *audio_track_section_list_ptr = nullptr;
- List *replay_storage_list_ptr = nullptr;
PageStack *page_stack = nullptr;
};
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 685d95e..8a60b91 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -37,6 +37,7 @@
#include <X11/Xcursor/Xcursor.h>
#include <mglpp/system/Rect.hpp>
#include <mglpp/window/Event.hpp>
+#include <mglpp/system/Utf8.hpp>
extern "C" {
#include <mgl/mgl.h>
@@ -903,6 +904,7 @@ namespace gsr {
// Wayland doesn't allow XGrabPointer/XGrabKeyboard when a wayland application is focused.
// If the focused window is a wayland application then don't use override redirect and instead create
// a fullscreen window for the ui.
+ // TODO: (x11_cursor_window && is_window_fullscreen_on_monitor(display, x11_cursor_window, *focused_monitor))
const bool prevent_game_minimizing = gsr_info.system_info.display_server != DisplayServer::WAYLAND || x11_cursor_window || is_wlroots;
if(prevent_game_minimizing) {
@@ -1640,10 +1642,22 @@ namespace gsr {
return result;
}
- // TODO: Utf8 truncate
static void truncate_string(std::string &str, int max_length) {
- if((int)str.size() > max_length)
- str.replace(str.begin() + max_length, str.end(), "...");
+ int index = 0;
+ size_t byte_index = 0;
+
+ while(index < max_length && byte_index < str.size()) {
+ uint32_t codepoint = 0;
+ size_t codepoint_length = 0;
+ mgl::utf8_decode((const unsigned char*)str.c_str() + byte_index, str.size() - byte_index, &codepoint, &codepoint_length);
+ if(codepoint_length == 0)
+ codepoint_length = 1;
+
+ index += 1;
+ byte_index += codepoint_length;
+ }
+
+ str.erase(byte_index);
}
void Overlay::save_video_in_current_game_directory(const char *video_filepath, NotificationType notification_type) {
diff --git a/src/gui/SettingsPage.cpp b/src/gui/SettingsPage.cpp
index ce556b9..1230290 100644
--- a/src/gui/SettingsPage.cpp
+++ b/src/gui/SettingsPage.cpp
@@ -768,7 +768,6 @@ namespace gsr {
list->add_widget(std::move(replay_storage_button));
list->set_visible(gsr_info->system_info.gsr_version >= GsrVersion{5, 5, 0});
- replay_storage_list_ptr = list.get();
return list;
}
@@ -837,7 +836,6 @@ namespace gsr {
notifications_subsection_ptr->set_visible(advanced_view);
set_application_audio_options_visible(audio_track_section_list_ptr, advanced_view, *gsr_info);
settings_scrollable_page_ptr->reset_scroll();
- replay_storage_list_ptr->set_visible(advanced_view && gsr_info->system_info.gsr_version >= GsrVersion{5, 5, 0});
}
void SettingsPage::add_replay_widgets() {