mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Fix clipboard save to disk option not working correctly
This commit is contained in:
@@ -48,11 +48,18 @@ namespace gsr {
|
|||||||
XNextEvent(dpy, &xev);
|
XNextEvent(dpy, &xev);
|
||||||
switch(xev.type) {
|
switch(xev.type) {
|
||||||
case SelectionClear: {
|
case SelectionClear: {
|
||||||
|
bool clear_current_file = false;
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
should_clear_selection = true;
|
should_clear_selection = true;
|
||||||
if(clipboard_copies.empty()) {
|
if(clipboard_copies.empty()) {
|
||||||
should_clear_selection = false;
|
should_clear_selection = false;
|
||||||
set_current_file("", file_type);
|
clear_current_file = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(clear_current_file)
|
||||||
|
set_current_file("", file_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
@@ -205,6 +212,9 @@ namespace gsr {
|
|||||||
uint8_t file_buffer[1<<16];
|
uint8_t file_buffer[1<<16];
|
||||||
ssize_t file_bytes_read = 0;
|
ssize_t file_bytes_read = 0;
|
||||||
|
|
||||||
|
if(file_fd <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if(lseek(file_fd, clipboard_copy->file_offset, SEEK_SET) == -1) {
|
if(lseek(file_fd, clipboard_copy->file_offset, SEEK_SET) == -1) {
|
||||||
fprintf(stderr, "gsr ui: error: ClipboardFile::send_clipboard: failed to seek in clipboard file to offset " FORMAT_U64 " for requestor window " FORMAT_I64 ", error: %s\n", (uint64_t)clipboard_copy->file_offset, (int64_t)xselectionrequest->requestor, strerror(errno));
|
fprintf(stderr, "gsr ui: error: ClipboardFile::send_clipboard: failed to seek in clipboard file to offset " FORMAT_U64 " for requestor window " FORMAT_I64 ", error: %s\n", (uint64_t)clipboard_copy->file_offset, (int64_t)xselectionrequest->requestor, strerror(errno));
|
||||||
clipboard_copy->file_offset = 0;
|
clipboard_copy->file_offset = 0;
|
||||||
@@ -262,7 +272,11 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
clipboard_copies.clear();
|
clipboard_copies.clear();
|
||||||
|
|
||||||
|
if(XGetSelectionOwner(dpy, clipboard_atom) == clipboard_window)
|
||||||
|
XSetSelectionOwner(dpy, clipboard_atom, None, CurrentTime);
|
||||||
|
|
||||||
if(filepath.empty()) {
|
if(filepath.empty()) {
|
||||||
|
// TODO: Cancel transfer
|
||||||
if(file_fd > 0) {
|
if(file_fd > 0) {
|
||||||
close(file_fd);
|
close(file_fd);
|
||||||
file_fd = -1;
|
file_fd = -1;
|
||||||
|
|||||||
@@ -3408,6 +3408,8 @@ namespace gsr {
|
|||||||
|
|
||||||
args.push_back(nullptr);
|
args.push_back(nullptr);
|
||||||
|
|
||||||
|
clipboard_file.set_current_file("", ClipboardFile::FileType::JPG);
|
||||||
|
|
||||||
screenshot_filepath = output_file;
|
screenshot_filepath = output_file;
|
||||||
gpu_screen_recorder_screenshot_process = exec_program(args.data(), nullptr);
|
gpu_screen_recorder_screenshot_process = exec_program(args.data(), nullptr);
|
||||||
if(gpu_screen_recorder_screenshot_process == -1) {
|
if(gpu_screen_recorder_screenshot_process == -1) {
|
||||||
|
|||||||
@@ -367,8 +367,8 @@ namespace gsr {
|
|||||||
config.screenshot_config.restore_portal_session = restore_portal_session_checkbox_ptr->is_checked();
|
config.screenshot_config.restore_portal_session = restore_portal_session_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.save_directory = save_directory_button_ptr->get_text();
|
config.screenshot_config.save_directory = save_directory_button_ptr->get_text();
|
||||||
config.screenshot_config.save_screenshot_in_game_folder = save_screenshot_in_game_folder_checkbox_ptr->is_checked();
|
config.screenshot_config.save_screenshot_in_game_folder = save_screenshot_in_game_folder_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.save_screenshot_to_clipboard = save_screenshot_to_disk_checkbox_ptr->is_checked();
|
config.screenshot_config.save_screenshot_to_clipboard = save_screenshot_to_clipboard_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.save_screenshot_to_disk = save_screenshot_to_clipboard_checkbox_ptr->is_checked();
|
config.screenshot_config.save_screenshot_to_disk = save_screenshot_to_disk_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.show_notifications = show_notification_checkbox_ptr->is_checked();
|
config.screenshot_config.show_notifications = show_notification_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.use_led_indicator = led_indicator_checkbox_ptr->is_checked();
|
config.screenshot_config.use_led_indicator = led_indicator_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.custom_script = create_custom_script_screenshot_entry_ptr->get_text();
|
config.screenshot_config.custom_script = create_custom_script_screenshot_entry_ptr->get_text();
|
||||||
|
|||||||
Reference in New Issue
Block a user