mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-06 15:00:44 +09:00
Remove (x11 applications only) from screenshot for kwin and hyprland
This commit is contained in:
@@ -290,5 +290,7 @@ namespace gsr {
|
|||||||
ClipboardFile clipboard_file;
|
ClipboardFile clipboard_file;
|
||||||
|
|
||||||
std::unique_ptr<LedIndicator> led_indicator = nullptr;
|
std::unique_ptr<LedIndicator> led_indicator = nullptr;
|
||||||
|
|
||||||
|
bool supports_window_title = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace gsr {
|
|||||||
|
|
||||||
class ScreenshotSettingsPage : public StaticPage {
|
class ScreenshotSettingsPage : public StaticPage {
|
||||||
public:
|
public:
|
||||||
ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack);
|
ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack, bool supports_window_title);
|
||||||
ScreenshotSettingsPage(const ScreenshotSettingsPage&) = delete;
|
ScreenshotSettingsPage(const ScreenshotSettingsPage&) = delete;
|
||||||
ScreenshotSettingsPage& operator=(const ScreenshotSettingsPage&) = delete;
|
ScreenshotSettingsPage& operator=(const ScreenshotSettingsPage&) = delete;
|
||||||
|
|
||||||
@@ -85,5 +85,7 @@ namespace gsr {
|
|||||||
Entry *create_custom_script_screenshot_entry_ptr = nullptr;
|
Entry *create_custom_script_screenshot_entry_ptr = nullptr;
|
||||||
|
|
||||||
PageStack *page_stack = nullptr;
|
PageStack *page_stack = nullptr;
|
||||||
|
|
||||||
|
bool supports_window_title = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace gsr {
|
|||||||
STREAM
|
STREAM
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack);
|
SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack, bool supports_window_title);
|
||||||
SettingsPage(const SettingsPage&) = delete;
|
SettingsPage(const SettingsPage&) = delete;
|
||||||
SettingsPage& operator=(const SettingsPage&) = delete;
|
SettingsPage& operator=(const SettingsPage&) = delete;
|
||||||
|
|
||||||
|
|||||||
@@ -539,9 +539,10 @@ namespace gsr {
|
|||||||
else
|
else
|
||||||
fprintf(stderr, "Warning: XOpenDisplay failed to mapping notify\n");
|
fprintf(stderr, "Warning: XOpenDisplay failed to mapping notify\n");
|
||||||
|
|
||||||
if(this->gsr_info.system_info.display_server == DisplayServer::X11)
|
if(this->gsr_info.system_info.display_server == DisplayServer::X11) {
|
||||||
cursor_tracker = std::make_unique<CursorTrackerX11>((Display*)mgl_get_context()->connection);
|
cursor_tracker = std::make_unique<CursorTrackerX11>((Display*)mgl_get_context()->connection);
|
||||||
else if(this->gsr_info.system_info.display_server == DisplayServer::WAYLAND) {
|
supports_window_title = true;
|
||||||
|
} else if(this->gsr_info.system_info.display_server == DisplayServer::WAYLAND) {
|
||||||
if(!this->gsr_info.gpu_info.card_path.empty())
|
if(!this->gsr_info.gpu_info.card_path.empty())
|
||||||
cursor_tracker = std::make_unique<CursorTrackerWayland>(this->gsr_info.gpu_info.card_path.c_str(), wayland_dpy);
|
cursor_tracker = std::make_unique<CursorTrackerWayland>(this->gsr_info.gpu_info.card_path.c_str(), wayland_dpy);
|
||||||
|
|
||||||
@@ -555,8 +556,10 @@ namespace gsr {
|
|||||||
|
|
||||||
if (wm_name.find("Hyprland") != std::string::npos) {
|
if (wm_name.find("Hyprland") != std::string::npos) {
|
||||||
start_hyprland_listener_thread();
|
start_hyprland_listener_thread();
|
||||||
|
supports_window_title = true;
|
||||||
} else if (wm_name == "KWin") {
|
} else if (wm_name == "KWin") {
|
||||||
start_kwin_helper_thread();
|
start_kwin_helper_thread();
|
||||||
|
supports_window_title = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,7 +1284,7 @@ namespace gsr {
|
|||||||
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
||||||
button->on_click = [this](const std::string &id) {
|
button->on_click = [this](const std::string &id) {
|
||||||
if(id == "settings") {
|
if(id == "settings") {
|
||||||
auto replay_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::REPLAY, &gsr_info, config, &page_stack);
|
auto replay_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::REPLAY, &gsr_info, config, &page_stack, supports_window_title);
|
||||||
replay_settings_page->on_config_changed = [this]() {
|
replay_settings_page->on_config_changed = [this]() {
|
||||||
replay_startup_mode = replay_startup_string_to_type(config.replay_config.turn_on_replay_automatically_mode.c_str());
|
replay_startup_mode = replay_startup_string_to_type(config.replay_config.turn_on_replay_automatically_mode.c_str());
|
||||||
if(recording_status == RecordingStatus::REPLAY)
|
if(recording_status == RecordingStatus::REPLAY)
|
||||||
@@ -1315,7 +1318,7 @@ namespace gsr {
|
|||||||
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
||||||
button->on_click = [this](const std::string &id) {
|
button->on_click = [this](const std::string &id) {
|
||||||
if(id == "settings") {
|
if(id == "settings") {
|
||||||
auto record_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::RECORD, &gsr_info, config, &page_stack);
|
auto record_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::RECORD, &gsr_info, config, &page_stack, supports_window_title);
|
||||||
record_settings_page->on_config_changed = [this]() {
|
record_settings_page->on_config_changed = [this]() {
|
||||||
if(recording_status == RecordingStatus::RECORD)
|
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);
|
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);
|
||||||
@@ -1342,7 +1345,7 @@ namespace gsr {
|
|||||||
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
button->set_item_icon("settings", &get_theme().settings_extra_small_texture);
|
||||||
button->on_click = [this](const std::string &id) {
|
button->on_click = [this](const std::string &id) {
|
||||||
if(id == "settings") {
|
if(id == "settings") {
|
||||||
auto stream_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::STREAM, &gsr_info, config, &page_stack);
|
auto stream_settings_page = std::make_unique<SettingsPage>(SettingsPage::Type::STREAM, &gsr_info, config, &page_stack, supports_window_title);
|
||||||
stream_settings_page->on_config_changed = [this]() {
|
stream_settings_page->on_config_changed = [this]() {
|
||||||
if(recording_status == RecordingStatus::STREAM)
|
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);
|
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);
|
||||||
@@ -1429,7 +1432,7 @@ namespace gsr {
|
|||||||
button->set_icon(&get_theme().screenshot_texture);
|
button->set_icon(&get_theme().screenshot_texture);
|
||||||
button->set_icon_padding_scale(1.2f);
|
button->set_icon_padding_scale(1.2f);
|
||||||
button->on_click = [&]() {
|
button->on_click = [&]() {
|
||||||
auto screenshot_settings_page = std::make_unique<ScreenshotSettingsPage>(&gsr_info, config, &page_stack);
|
auto screenshot_settings_page = std::make_unique<ScreenshotSettingsPage>(&gsr_info, config, &page_stack, supports_window_title);
|
||||||
screenshot_settings_page->on_config_changed = [this]() {
|
screenshot_settings_page->on_config_changed = [this]() {
|
||||||
update_led_indicator_after_settings_change();
|
update_led_indicator_after_settings_change();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,11 +11,12 @@
|
|||||||
#include "../../include/gui/FileChooser.hpp"
|
#include "../../include/gui/FileChooser.hpp"
|
||||||
|
|
||||||
namespace gsr {
|
namespace gsr {
|
||||||
ScreenshotSettingsPage::ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack) :
|
ScreenshotSettingsPage::ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack, bool supports_window_title) :
|
||||||
StaticPage(mgl::vec2f(get_theme().window_width, get_theme().window_height).floor()),
|
StaticPage(mgl::vec2f(get_theme().window_width, get_theme().window_height).floor()),
|
||||||
config(config),
|
config(config),
|
||||||
gsr_info(gsr_info),
|
gsr_info(gsr_info),
|
||||||
page_stack(page_stack)
|
page_stack(page_stack),
|
||||||
|
supports_window_title(supports_window_title)
|
||||||
{
|
{
|
||||||
capture_options = get_supported_capture_options(*gsr_info);
|
capture_options = get_supported_capture_options(*gsr_info);
|
||||||
|
|
||||||
@@ -209,7 +210,7 @@ namespace gsr {
|
|||||||
|
|
||||||
std::unique_ptr<CheckBox> ScreenshotSettingsPage::create_save_screenshot_in_game_folder() {
|
std::unique_ptr<CheckBox> ScreenshotSettingsPage::create_save_screenshot_in_game_folder() {
|
||||||
char text[256];
|
char text[256];
|
||||||
snprintf(text, sizeof(text), "Save screenshot in a folder based on the focused applications name%s", gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)");
|
snprintf(text, sizeof(text), "Save screenshot in a folder based on the focused applications name%s", supports_window_title ? "" : " (X11 applications only)");
|
||||||
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
||||||
save_screenshot_in_game_folder_checkbox_ptr = checkbox.get();
|
save_screenshot_in_game_folder_checkbox_ptr = checkbox.get();
|
||||||
return checkbox;
|
return checkbox;
|
||||||
|
|||||||
@@ -10,13 +10,9 @@
|
|||||||
#include "../../include/Theme.hpp"
|
#include "../../include/Theme.hpp"
|
||||||
#include "../../include/GsrInfo.hpp"
|
#include "../../include/GsrInfo.hpp"
|
||||||
#include "../../include/Utils.hpp"
|
#include "../../include/Utils.hpp"
|
||||||
#include "../../include/WindowUtils.hpp"
|
|
||||||
|
|
||||||
#include <mglpp/window/Window.hpp>
|
#include <mglpp/window/Window.hpp>
|
||||||
#include <mglpp/window/Event.hpp>
|
#include <mglpp/window/Event.hpp>
|
||||||
extern "C" {
|
|
||||||
#include <mgl/mgl.h>
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -40,25 +36,18 @@ namespace gsr {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage::SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack) :
|
SettingsPage::SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack, bool supports_window_title) :
|
||||||
StaticPage(mgl::vec2f(get_theme().window_width, get_theme().window_height).floor()),
|
StaticPage(mgl::vec2f(get_theme().window_width, get_theme().window_height).floor()),
|
||||||
type(type),
|
type(type),
|
||||||
config(config),
|
config(config),
|
||||||
gsr_info(gsr_info),
|
gsr_info(gsr_info),
|
||||||
page_stack(page_stack)
|
page_stack(page_stack),
|
||||||
|
supports_window_title(supports_window_title)
|
||||||
{
|
{
|
||||||
audio_devices = get_audio_devices();
|
audio_devices = get_audio_devices();
|
||||||
application_audio = get_application_audio();
|
application_audio = get_application_audio();
|
||||||
capture_options = get_supported_capture_options(*gsr_info);
|
capture_options = get_supported_capture_options(*gsr_info);
|
||||||
|
|
||||||
mgl_context *context = mgl_get_context();
|
|
||||||
Display *display = (Display*)context->connection;
|
|
||||||
|
|
||||||
const std::string wm_name = get_window_manager_name(display);
|
|
||||||
const bool is_hyprland = wm_name.find("Hyprland") != std::string::npos;
|
|
||||||
const bool is_kwin = wm_name == "KWin";
|
|
||||||
supports_window_title = gsr_info->system_info.display_server == DisplayServer::X11 || is_hyprland || is_kwin;
|
|
||||||
|
|
||||||
auto content_page = std::make_unique<GsrPage>(settings_page_type_to_title_text(type), "Settings");
|
auto content_page = std::make_unique<GsrPage>(settings_page_type_to_title_text(type), "Settings");
|
||||||
content_page->add_button("Back", "back", get_color_theme().page_bg_color);
|
content_page->add_button("Back", "back", get_color_theme().page_bg_color);
|
||||||
content_page->on_click = [page_stack](const std::string &id) {
|
content_page->on_click = [page_stack](const std::string &id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user