aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Config.hpp2
-rw-r--r--include/GlobalHotkeys/GlobalHotkeysJoystick.hpp2
-rw-r--r--include/Overlay.hpp14
-rw-r--r--include/RegionSelector.hpp1
-rw-r--r--include/Utils.hpp1
-rw-r--r--include/WindowSelector.hpp33
-rw-r--r--include/WindowUtils.hpp1
-rw-r--r--include/gui/ScreenshotSettingsPage.hpp2
-rw-r--r--include/gui/SettingsPage.hpp2
9 files changed, 48 insertions, 10 deletions
diff --git a/include/Config.hpp b/include/Config.hpp
index b0686c0..7c2aeda 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -45,7 +45,7 @@ namespace gsr {
int32_t video_width = 0;
int32_t video_height = 0;
int32_t fps = 60;
- int32_t video_bitrate = 15000;
+ int32_t video_bitrate = 8000;
bool merge_audio_tracks = true; // TODO: Remove in the future
bool application_audio_invert = false; // TODO: Remove in the future
bool change_video_resolution = false;
diff --git a/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp
index 4b266cb..0177d29 100644
--- a/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp
+++ b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp
@@ -56,6 +56,8 @@ namespace gsr {
bool down_pressed = false;
bool left_pressed = false;
bool right_pressed = false;
+ bool l3_button_pressed = false;
+ bool r3_button_pressed = false;
bool save_replay = false;
bool save_1_min_replay = false;
diff --git a/include/Overlay.hpp b/include/Overlay.hpp
index 4cfab1d..5f97e5f 100644
--- a/include/Overlay.hpp
+++ b/include/Overlay.hpp
@@ -9,6 +9,7 @@
#include "GlobalHotkeys/GlobalHotkeysJoystick.hpp"
#include "AudioPlayer.hpp"
#include "RegionSelector.hpp"
+#include "WindowSelector.hpp"
#include "CursorTracker/CursorTracker.hpp"
#include <mglpp/window/Window.hpp>
@@ -116,10 +117,10 @@ namespace gsr {
void on_press_save_replay();
void on_press_save_replay_1_min_replay();
void on_press_save_replay_10_min_replay();
- bool on_press_start_replay(bool disable_notification, bool finished_region_selection);
- void on_press_start_record(bool finished_region_selection);
- void on_press_start_stream(bool finished_region_selection);
- void on_press_take_screenshot(bool finished_region_selection, bool force_region_capture);
+ bool on_press_start_replay(bool disable_notification, bool finished_selection);
+ void on_press_start_record(bool finished_selection);
+ void on_press_start_stream(bool finished_selection);
+ void on_press_take_screenshot(bool finished_selection, bool force_region_capture);
bool update_compositor_texture(const Monitor &monitor);
std::string get_capture_target(const std::string &capture_target, const SupportedCaptureOptions &capture_options);
@@ -213,10 +214,15 @@ namespace gsr {
int replay_save_duration_min = 0;
AudioPlayer audio_player;
+
RegionSelector region_selector;
bool start_region_capture = false;
std::function<void()> on_region_selected;
+ WindowSelector window_selector;
+ bool start_window_capture = false;
+ std::function<void()> on_window_selected;
+
std::string recording_capture_target;
std::string screenshot_capture_target;
diff --git a/include/RegionSelector.hpp b/include/RegionSelector.hpp
index 0465302..ef0bc0e 100644
--- a/include/RegionSelector.hpp
+++ b/include/RegionSelector.hpp
@@ -26,7 +26,6 @@ namespace gsr {
bool failed() const;
bool poll_events();
- bool is_selected() const;
bool take_selection();
bool take_canceled();
Region get_selection() const;
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 38088be..3d3c029 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -16,6 +16,7 @@ namespace gsr {
void string_split_char(std::string_view str, char delimiter, StringSplitCallback callback_func);
bool starts_with(std::string_view str, const char *substr);
bool ends_with(std::string_view str, const char *substr);
+ std::string strip(const std::string &str);
std::string get_home_dir();
std::string get_config_dir();
diff --git a/include/WindowSelector.hpp b/include/WindowSelector.hpp
new file mode 100644
index 0000000..ab4a85d
--- /dev/null
+++ b/include/WindowSelector.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <X11/Xlib.h>
+
+#include <mglpp/graphics/Color.hpp>
+
+namespace gsr {
+ class WindowSelector {
+ public:
+ WindowSelector();
+ WindowSelector(const WindowSelector&) = delete;
+ WindowSelector& operator=(const WindowSelector&) = delete;
+ ~WindowSelector();
+
+ bool start(mgl::Color border_color);
+ void stop();
+ bool is_started() const;
+
+ bool failed() const;
+ bool poll_events();
+ bool take_selection();
+ bool take_canceled();
+ Window get_selection() const;
+ private:
+ Display *dpy = nullptr;
+ Cursor crosshair_cursor = None;
+ Colormap border_window_colormap = None;
+ Window border_window = None;
+ Window selected_window = None;
+ bool selected = false;
+ bool canceled = false;
+ };
+} \ No newline at end of file
diff --git a/include/WindowUtils.hpp b/include/WindowUtils.hpp
index 72d2179..5c4d39a 100644
--- a/include/WindowUtils.hpp
+++ b/include/WindowUtils.hpp
@@ -24,6 +24,7 @@ namespace gsr {
std::string get_window_name_at_position(Display *dpy, mgl::vec2i position, Window ignore_window);
std::string get_window_name_at_cursor_position(Display *dpy, Window ignore_window);
void set_window_size_not_resizable(Display *dpy, Window window, int width, int height);
+ Window window_get_target_window_child(Display *display, Window window);
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);
diff --git a/include/gui/ScreenshotSettingsPage.hpp b/include/gui/ScreenshotSettingsPage.hpp
index 1cfbf00..db66d66 100644
--- a/include/gui/ScreenshotSettingsPage.hpp
+++ b/include/gui/ScreenshotSettingsPage.hpp
@@ -26,7 +26,6 @@ namespace gsr {
private:
std::unique_ptr<ComboBox> create_record_area_box();
std::unique_ptr<Widget> create_record_area();
- std::unique_ptr<List> create_select_window();
std::unique_ptr<Entry> create_image_width_entry();
std::unique_ptr<Entry> create_image_height_entry();
std::unique_ptr<List> create_image_resolution();
@@ -56,7 +55,6 @@ namespace gsr {
GsrPage *content_page_ptr = nullptr;
ScrollablePage *settings_scrollable_page_ptr = nullptr;
- List *select_window_list_ptr = nullptr;
List *image_resolution_list_ptr = nullptr;
List *restore_portal_session_list_ptr = nullptr;
List *color_range_list_ptr = nullptr;
diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp
index 08bbd9d..1810de5 100644
--- a/include/gui/SettingsPage.hpp
+++ b/include/gui/SettingsPage.hpp
@@ -46,7 +46,6 @@ namespace gsr {
std::unique_ptr<RadioButton> create_view_radio_button();
std::unique_ptr<ComboBox> create_record_area_box();
std::unique_ptr<Widget> create_record_area();
- std::unique_ptr<List> create_select_window();
std::unique_ptr<Entry> create_area_width_entry();
std::unique_ptr<Entry> create_area_height_entry();
std::unique_ptr<List> create_area_size();
@@ -147,7 +146,6 @@ namespace gsr {
GsrPage *content_page_ptr = nullptr;
ScrollablePage *settings_scrollable_page_ptr = nullptr;
List *settings_list_ptr = nullptr;
- List *select_window_list_ptr = nullptr;
List *area_size_list_ptr = nullptr;
List *video_resolution_list_ptr = nullptr;
List *restore_portal_session_list_ptr = nullptr;