diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Config.hpp | 3 | ||||
-rw-r--r-- | include/GlobalHotkeysLinux.hpp | 8 | ||||
-rw-r--r-- | include/Overlay.hpp | 7 | ||||
-rw-r--r-- | include/Process.hpp | 2 | ||||
-rw-r--r-- | include/WindowUtils.hpp | 5 | ||||
-rw-r--r-- | include/gui/GlobalSettingsPage.hpp | 2 | ||||
-rw-r--r-- | include/gui/RadioButton.hpp | 3 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 8 |
8 files changed, 29 insertions, 9 deletions
diff --git a/include/Config.hpp b/include/Config.hpp index de96722..6f81c1c 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -25,7 +25,7 @@ namespace gsr { int32_t video_height = 0; int32_t fps = 60; int32_t video_bitrate = 15000; - bool merge_audio_tracks = true; + bool merge_audio_tracks = true; // Currently unused for streaming because all known streaming sites only support 1 audio track bool application_audio_invert = false; bool change_video_resolution = false; std::vector<std::string> audio_tracks; @@ -43,6 +43,7 @@ namespace gsr { struct MainConfig { int32_t config_file_version = 0; bool software_encoding_warning_shown = false; + std::string hotkeys_enable_option = "enable_hotkeys"; std::string tint_color; }; diff --git a/include/GlobalHotkeysLinux.hpp b/include/GlobalHotkeysLinux.hpp index 62da74e..addb849 100644 --- a/include/GlobalHotkeysLinux.hpp +++ b/include/GlobalHotkeysLinux.hpp @@ -7,7 +7,12 @@ namespace gsr { class GlobalHotkeysLinux : public GlobalHotkeys { public: - GlobalHotkeysLinux(); + enum class GrabType { + ALL, + VIRTUAL + }; + + GlobalHotkeysLinux(GrabType grab_type); GlobalHotkeysLinux(const GlobalHotkeysLinux&) = delete; GlobalHotkeysLinux& operator=(const GlobalHotkeysLinux&) = delete; ~GlobalHotkeysLinux() override; @@ -20,5 +25,6 @@ namespace gsr { int pipes[2]; FILE *read_file = nullptr; std::unordered_map<std::string, GlobalHotkeyCallback> bound_actions_by_id; + GrabType grab_type; }; }
\ No newline at end of file diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 50a38cd..e802cd0 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -58,6 +58,8 @@ namespace gsr { bool is_open() const; bool should_exit(std::string &reason) const; void exit(); + + const Config& get_config() const; private: void xi_setup(); void handle_xi_events(); @@ -65,7 +67,6 @@ namespace gsr { void grab_mouse_and_keyboard(); void xi_setup_fake_cursor(); void xi_grab_all_devices(); - void xi_warp_pointer(mgl::vec2i position); void close_gpu_screen_recorder_output(); @@ -124,7 +125,6 @@ namespace gsr { mgl::Texture cursor_texture; mgl::Sprite cursor_sprite; mgl::vec2i cursor_hotspot; - bool cursor_drawn = false; WindowTexture window_texture; PageStack page_stack; @@ -166,5 +166,8 @@ namespace gsr { bool do_exit = false; std::string exit_reason; + + mgl::vec2i window_size = { 1280, 720 }; + mgl::vec2i window_pos = { 0, 0 }; }; }
\ No newline at end of file diff --git a/include/Process.hpp b/include/Process.hpp index 9662126..072ef58 100644 --- a/include/Process.hpp +++ b/include/Process.hpp @@ -21,5 +21,5 @@ namespace gsr { // This works the same as |exec_program_get_stdout|, except on flatpak where this runs the program on the // host machine with flatpak-spawn --host int exec_program_on_host_get_stdout(const char **args, std::string &result); - pid_t pidof(const char *process_name); + pid_t pidof(const char *process_name, pid_t ignore_pid); }
\ No newline at end of file diff --git a/include/WindowUtils.hpp b/include/WindowUtils.hpp index e647785..d17c0fd 100644 --- a/include/WindowUtils.hpp +++ b/include/WindowUtils.hpp @@ -1,5 +1,6 @@ #pragma once +#include <mglpp/system/vec.hpp> #include <string> #include <X11/Xlib.h> @@ -11,4 +12,8 @@ namespace gsr { Window get_focused_window(Display *dpy, WindowCaptureType cap_type); std::string get_focused_window_name(Display *dpy, WindowCaptureType window_capture_type); + mgl::vec2i get_cursor_position(Display *dpy, Window *window); + mgl::vec2i create_window_get_center_position(Display *display); + std::string get_window_manager_name(Display *display); + bool is_compositor_running(Display *dpy, int screen); }
\ No newline at end of file diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp index c55648b..06098f0 100644 --- a/include/gui/GlobalSettingsPage.hpp +++ b/include/gui/GlobalSettingsPage.hpp @@ -31,6 +31,7 @@ namespace gsr { private: std::unique_ptr<Subsection> create_appearance_subsection(ScrollablePage *parent_page); std::unique_ptr<Subsection> create_startup_subsection(ScrollablePage *parent_page); + std::unique_ptr<Subsection> create_hotkey_subsection(ScrollablePage *parent_page); std::unique_ptr<Button> create_exit_program_button(); std::unique_ptr<Button> create_go_back_to_old_ui_button(); std::unique_ptr<Subsection> create_application_options_subsection(ScrollablePage *parent_page); @@ -43,5 +44,6 @@ namespace gsr { PageStack *page_stack = nullptr; RadioButton *tint_color_radio_button_ptr = nullptr; RadioButton *startup_radio_button_ptr = nullptr; + RadioButton *enable_hotkeys_radio_button_ptr = nullptr; }; }
\ No newline at end of file diff --git a/include/gui/RadioButton.hpp b/include/gui/RadioButton.hpp index a009eab..16d638e 100644 --- a/include/gui/RadioButton.hpp +++ b/include/gui/RadioButton.hpp @@ -27,7 +27,8 @@ namespace gsr { mgl::vec2f get_size() override; - std::function<void(const std::string &text, const std::string &id)> on_selection_changed; + // Return false to revert the change + std::function<bool(const std::string &text, const std::string &id)> on_selection_changed; private: void update_if_dirty(); private: diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index 4057059..efa958e 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -69,7 +69,7 @@ namespace gsr { std::unique_ptr<Widget> create_audio_track_section(); std::unique_ptr<Widget> create_audio_section(); std::unique_ptr<List> create_video_quality_box(); - std::unique_ptr<Entry> create_video_bitrate_entry(); + std::unique_ptr<List> create_video_bitrate_entry(); std::unique_ptr<List> create_video_bitrate(); std::unique_ptr<ComboBox> create_color_range_box(); std::unique_ptr<List> create_color_range(); @@ -97,9 +97,11 @@ namespace gsr { std::unique_ptr<List> create_replay_time(); std::unique_ptr<RadioButton> create_start_replay_automatically(); std::unique_ptr<CheckBox> create_save_replay_in_game_folder(); - std::unique_ptr<Label> create_estimated_file_size(); - void update_estimated_file_size(); + std::unique_ptr<Label> create_estimated_replay_file_size(); + void update_estimated_replay_file_size(); std::unique_ptr<CheckBox> create_save_recording_in_game_folder(); + std::unique_ptr<Label> create_estimated_record_file_size(); + void update_estimated_record_file_size(); void add_replay_widgets(); void add_record_widgets(); |