Compare commits

...

4 Commits
1.9.2 ... 1.9.3

Author SHA1 Message Date
dec05eba
fed47000ce 1.9.3 - Only use led indicator if it's enabled 2026-01-08 20:40:11 +01:00
dec05eba
7f43adfbd5 1.9.3 2026-01-08 20:23:39 +01:00
dec05eba
1f6251baf3 Fix high cpu usage when running global hotkeys without grab and then connecting a secondary keyboard 2026-01-08 20:23:21 +01:00
dec05eba
d1220b013e Update flatpak version reference 2026-01-08 01:25:08 +01:00
9 changed files with 39 additions and 20 deletions

View File

@@ -108,6 +108,7 @@ namespace gsr {
void on_event(mgl::Event &event);
void recreate_global_hotkeys(const char *hotkey_option);
void update_led_indicator_after_settings_change();
void create_frontpage_ui_components();
void xi_setup();
void handle_xi_events();

View File

@@ -23,6 +23,8 @@ namespace gsr {
void load();
void save();
void on_navigate_away_from_page() override;
std::function<void()> on_config_changed;
private:
std::unique_ptr<ComboBox> create_record_area_box();
std::unique_ptr<Widget> create_record_area();

View File

@@ -1,4 +1,4 @@
project('gsr-ui', ['c', 'cpp'], version : '1.9.2', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
project('gsr-ui', ['c', 'cpp'], version : '1.9.3', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
add_project_arguments('-D_FILE_OFFSET_BITS=64', language : ['c', 'cpp'])
@@ -67,7 +67,7 @@ gsr_ui_resources_path = join_paths(prefix, datadir, 'gsr-ui')
icons_path = join_paths(prefix, datadir, 'icons')
add_project_arguments('-DGSR_UI_VERSION="' + meson.project_version() + '"', language: ['c', 'cpp'])
add_project_arguments('-DGSR_FLATPAK_VERSION="5.11.3"', language: ['c', 'cpp'])
add_project_arguments('-DGSR_FLATPAK_VERSION="5.11.5"', language: ['c', 'cpp'])
executable(
meson.project_name(),

View File

@@ -1,7 +1,7 @@
[package]
name = "gsr-ui"
type = "executable"
version = "1.9.2"
version = "1.9.3"
platforms = ["posix"]
[lang.cpp]

View File

@@ -272,8 +272,10 @@ namespace gsr {
}
clipboard_copies.clear();
if(XGetSelectionOwner(dpy, clipboard_atom) == clipboard_window)
if(XGetSelectionOwner(dpy, clipboard_atom) == clipboard_window) {
XSetSelectionOwner(dpy, clipboard_atom, None, CurrentTime);
XFlush(dpy);
}
if(filepath.empty()) {
// TODO: Cancel transfer

View File

@@ -152,19 +152,24 @@ namespace gsr {
if(read_led_brightness_timer.get_elapsed_time_seconds() > 0.2) {
read_led_brightness_timer.restart();
bool led_status_outdated = false;
bool any_keyboard_with_led_enabled = false;
bool any_keyboard_with_led_disabled = false;
char buffer[32];
for(int led_brightness_file_fd : led_brightness_files) {
const ssize_t bytes_read = read(led_brightness_file_fd, buffer, sizeof(buffer));
if(bytes_read > 0) {
if(buffer[0] == '0')
led_status_outdated = true;
any_keyboard_with_led_disabled = true;
else
any_keyboard_with_led_enabled = true;
lseek(led_brightness_file_fd, 0, SEEK_SET);
}
}
if(led_status_outdated && led_enabled)
if(led_enabled && any_keyboard_with_led_disabled)
run_gsr_global_hotkeys_set_leds(true);
else if(!led_enabled && any_keyboard_with_led_enabled)
run_gsr_global_hotkeys_set_leds(false);
}
}
}

View File

@@ -525,8 +525,7 @@ namespace gsr {
}
}
// TODO: Only do this if led indicator is enabled (at startup or when changing recording/screenshot settings to enabled it)
led_indicator = std::make_unique<LedIndicator>();
update_led_indicator_after_settings_change();
}
Overlay::~Overlay() {
@@ -1179,6 +1178,15 @@ namespace gsr {
global_hotkeys.reset();
}
void Overlay::update_led_indicator_after_settings_change() {
if(config.record_config.record_options.use_led_indicator || config.replay_config.record_options.use_led_indicator || config.streaming_config.record_options.use_led_indicator || config.screenshot_config.use_led_indicator) {
if(!led_indicator)
led_indicator = std::make_unique<LedIndicator>();
} else {
led_indicator.reset();
}
}
void Overlay::create_frontpage_ui_components() {
bg_screenshot_overlay = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height));
top_bar_background = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height*0.06f).floor());
@@ -1269,6 +1277,8 @@ namespace gsr {
record_settings_page->on_config_changed = [this]() {
if(recording_status == RecordingStatus::RECORD)
show_notification("Recording settings have been modified.\nYou may need to restart recording to apply the changes.", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(record_settings_page));
} else if(id == "pause") {
@@ -1294,6 +1304,8 @@ namespace gsr {
stream_settings_page->on_config_changed = [this]() {
if(recording_status == RecordingStatus::STREAM)
show_notification("Streaming settings have been modified.\nYou may need to restart streaming to apply the changes.", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(stream_settings_page));
} else if(id == "start") {
@@ -1376,6 +1388,9 @@ namespace gsr {
button->set_icon_padding_scale(1.2f);
button->on_click = [&]() {
auto screenshot_settings_page = std::make_unique<ScreenshotSettingsPage>(&gsr_info, config, &page_stack);
screenshot_settings_page->on_config_changed = [this]() {
update_led_indicator_after_settings_change();
};
page_stack.push(std::move(screenshot_settings_page));
};
front_page_ptr->add_widget(std::move(button));

View File

@@ -357,6 +357,8 @@ namespace gsr {
}
void ScreenshotSettingsPage::save() {
Config prev_config = config;
config.screenshot_config.record_area_option = record_area_box_ptr->get_selected_id();
config.screenshot_config.image_width = atoi(image_width_entry_ptr->get_text().c_str());
config.screenshot_config.image_height = atoi(image_height_entry_ptr->get_text().c_str());
@@ -390,5 +392,8 @@ namespace gsr {
}
save_config(config);
if(on_config_changed && config != prev_config)
on_config_changed();
}
}

View File

@@ -243,17 +243,6 @@ static void keyboard_event_process_input_event_data(keyboard_event *self, event_
fprintf(stderr, "Error: failed to write event data to virtual keyboard for exclusively grabbed device\n");
}
if(event.type == EV_LED) {
write(fd, &event, sizeof(event));
const struct input_event syn_event = {
.type = EV_SYN,
.code = 0,
.value = 0
};
write(fd, &syn_event, sizeof(syn_event));
}
if(!extra_data->is_possibly_non_keyboard_device)
return;