aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--include/gui/GlobalSettingsPage.hpp1
-rw-r--r--meson.build4
-rw-r--r--project.conf2
-rw-r--r--src/Config.cpp1
-rw-r--r--src/gui/DropdownButton.cpp4
-rw-r--r--src/gui/GlobalSettingsPage.cpp37
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.c55
8 files changed, 78 insertions, 32 deletions
diff --git a/README.md b/README.md
index 3d4a30c..a28bcc3 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ These are the dependencies needed to build GPU Screen Recorder UI:
## Runtime dependencies
There are also additional dependencies needed at runtime:
-* [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/) (version 5.0.0 or greater)
+* [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/) (version 5.0.0 or later)
* [GPU Screen Recorder Notification](https://git.dec05eba.com/gpu-screen-recorder-notification/)
## Program behavior notes
@@ -45,8 +45,8 @@ This software is licensed under GPL3.0-only. Files under `fonts/` directory belo
[![Click here to watch a demo video on youtube](https://img.youtube.com/vi/SOqXusCTXXA/0.jpg)](https://www.youtube.com/watch?v=SOqXusCTXXA)
# Screenshots
-![](https://dec05eba.com/images/gsr-overlay-screenshot-front.webp)
-![](https://dec05eba.com/images/gsr-overlay-screenshot-settings.webp)
+![](https://dec05eba.com/images/front_page.jpg)
+![](https://dec05eba.com/images/settings_page.jpg)
# Donations
If you want to donate you can donate via bitcoin or monero.
diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp
index 92454c8..580e943 100644
--- a/include/gui/GlobalSettingsPage.hpp
+++ b/include/gui/GlobalSettingsPage.hpp
@@ -92,5 +92,6 @@ namespace gsr {
ConfigureHotkeyType configure_hotkey_type = ConfigureHotkeyType::NONE;
CustomRendererWidget *hotkey_overlay_ptr = nullptr;
+ std::string hotkey_configure_action_name;
};
} \ No newline at end of file
diff --git a/meson.build b/meson.build
index 781ed8d..b0f70eb 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gsr-ui', ['c', 'cpp'], version : '1.1.1', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
+project('gsr-ui', ['c', 'cpp'], version : '1.1.4', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
if get_option('buildtype') == 'debug'
add_project_arguments('-g3', language : ['c', 'cpp'])
@@ -52,7 +52,7 @@ datadir = get_option('datadir')
gsr_ui_resources_path = join_paths(prefix, datadir, 'gsr-ui')
add_project_arguments('-DGSR_UI_VERSION="' + meson.project_version() + '"', language: ['c', 'cpp'])
-add_project_arguments('-DGSR_FLATPAK_VERSION="5.1.0"', language: ['c', 'cpp'])
+add_project_arguments('-DGSR_FLATPAK_VERSION="5.1.2"', language: ['c', 'cpp'])
executable(
meson.project_name(),
diff --git a/project.conf b/project.conf
index 1a2d65a..e71a2fd 100644
--- a/project.conf
+++ b/project.conf
@@ -1,7 +1,7 @@
[package]
name = "gsr-ui"
type = "executable"
-version = "1.1.1"
+version = "1.1.4"
platforms = ["posix"]
[lang.cpp]
diff --git a/src/Config.cpp b/src/Config.cpp
index dfe33ff..b9e4cb7 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -6,7 +6,6 @@
#include <limits.h>
#include <inttypes.h>
#include <libgen.h>
-#include <iostream>
#include <mglpp/window/Keyboard.hpp>
#define FORMAT_I32 "%" PRIi32
diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp
index 4a2ae3a..81bc015 100644
--- a/src/gui/DropdownButton.cpp
+++ b/src/gui/DropdownButton.cpp
@@ -20,7 +20,7 @@ namespace gsr {
{
if(icon_texture && icon_texture->is_valid()) {
icon_sprite.set_texture(icon_texture);
- icon_sprite.set_height((int)(size.y * 0.5f));
+ icon_sprite.set_height((int)(size.y * 0.45f));
}
this->description.set_color(mgl::Color(150, 150, 150));
}
@@ -242,4 +242,4 @@ namespace gsr {
update_if_dirty();
return size;
}
-} \ No newline at end of file
+}
diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp
index e3c09ff..81e1d9a 100644
--- a/src/gui/GlobalSettingsPage.cpp
+++ b/src/gui/GlobalSettingsPage.cpp
@@ -132,7 +132,7 @@ namespace gsr {
if(!configure_hotkey_button)
return;
- mgl::Text title_text("Press a key combination to use for the hotkey \"Start/stop recording\":", get_theme().title_font);
+ mgl::Text title_text("Press a key combination to use for the hotkey \"" + hotkey_configure_action_name + "\":", get_theme().title_font);
mgl::Text hotkey_text(configure_hotkey_button->get_text(), get_theme().top_bar_font);
mgl::Text description_text("The hotkey has to contain one or more of these keys: Alt, Ctrl, Shift and Super. Press Esc to cancel.", get_theme().body_font);
const float text_max_width = std::max(title_text.get_bounds().size.x, std::max(hotkey_text.get_bounds().size.x, description_text.get_bounds().size.x));
@@ -153,11 +153,14 @@ namespace gsr {
title_text.set_position(mgl::vec2f(bg_rect.get_position() + mgl::vec2f(bg_rect.get_size().x*0.5f - title_text.get_bounds().size.x*0.5f, padding_vertical)).floor());
window.draw(title_text);
- //const float description_bottom = description_text.get_position().y + description_text.get_bounds().size.y;
- //const float remaining_height = (bg_rect.get_position().y + bg_rect.get_size().y) - description_bottom;
hotkey_text.set_position(mgl::vec2f(bg_rect.get_position() + bg_rect.get_size()*0.5f - hotkey_text.get_bounds().size*0.5f).floor());
window.draw(hotkey_text);
+ const float caret_padding_x = int(0.001f * get_theme().window_height);
+ const mgl::vec2f caret_size = mgl::vec2f(std::max(2.0f, 0.002f * get_theme().window_height), hotkey_text.get_bounds().size.y).floor();
+ mgl::Rectangle caret_rect(hotkey_text.get_position() + mgl::vec2f(hotkey_text.get_bounds().size.x + caret_padding_x, hotkey_text.get_bounds().size.y*0.5f - caret_size.y*0.5f).floor(), caret_size);
+ window.draw(caret_rect);
+
description_text.set_position(mgl::vec2f(bg_rect.get_position() + mgl::vec2f(bg_rect.get_size().x*0.5f - description_text.get_bounds().size.x*0.5f, bg_rect.get_size().y - description_text.get_bounds().size.y - padding_vertical)).floor());
window.draw(description_text);
};
@@ -253,7 +256,6 @@ namespace gsr {
configure_hotkey_start(ConfigureHotkeyType::SHOW_HIDE);
};
-
return list;
}
@@ -581,6 +583,31 @@ namespace gsr {
content_page_ptr->set_visible(false);
hotkey_overlay_ptr->set_visible(true);
overlay->unbind_all_keyboard_hotkeys();
+ configure_hotkey_get_button_by_active_type()->set_text("");
+
+ switch(hotkey_type) {
+ case ConfigureHotkeyType::NONE:
+ hotkey_configure_action_name = "";
+ break;
+ case ConfigureHotkeyType::REPLAY_START_STOP:
+ hotkey_configure_action_name = "Turn replay on/off";
+ break;
+ case ConfigureHotkeyType::REPLAY_SAVE:
+ hotkey_configure_action_name = "Save replay";
+ break;
+ case ConfigureHotkeyType::RECORD_START_STOP:
+ hotkey_configure_action_name = "Start/stop recording";
+ break;
+ case ConfigureHotkeyType::RECORD_PAUSE_UNPAUSE:
+ hotkey_configure_action_name = "Pause/unpause recording";
+ break;
+ case ConfigureHotkeyType::STREAM_START_STOP:
+ hotkey_configure_action_name = "Start/stop streaming";
+ break;
+ case ConfigureHotkeyType::SHOW_HIDE:
+ hotkey_configure_action_name = "Show/hide UI";
+ break;
+ }
}
void GlobalSettingsPage::configure_hotkey_cancel() {
@@ -623,4 +650,4 @@ namespace gsr {
hotkey_overlay_ptr->set_visible(false);
overlay->rebind_all_keyboard_hotkeys();
}
-} \ No newline at end of file
+}
diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c
index b8d94fd..99f33ee 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.c
+++ b/tools/gsr-global-hotkeys/keyboard_event.c
@@ -81,19 +81,19 @@ static void keyboard_event_fetch_update_key_states(keyboard_event *self, event_e
}
}
-static void keyboard_event_process_key_state_change(keyboard_event *self, struct input_event event, event_extra_data *extra_data, int fd) {
- if(event.type != EV_KEY)
+static void keyboard_event_process_key_state_change(keyboard_event *self, const struct input_event *event, event_extra_data *extra_data, int fd) {
+ if(event->type != EV_KEY)
return;
- if(!extra_data->key_states || event.code >= KEY_STATES_SIZE * 8)
+ if(!extra_data->key_states || event->code >= KEY_STATES_SIZE * 8)
return;
- const unsigned int byte_index = event.code / 8;
- const unsigned char bit_index = event.code % 8;
+ const unsigned int byte_index = event->code / 8;
+ const unsigned char bit_index = event->code % 8;
unsigned char key_byte_state = extra_data->key_states[byte_index];
const bool prev_key_pressed = (key_byte_state & (1 << bit_index)) != KEY_RELEASE;
- if(event.value == KEY_RELEASE) {
+ if(event->value == KEY_RELEASE) {
key_byte_state &= ~(1 << bit_index);
if(prev_key_pressed)
--extra_data->num_keys_pressed;
@@ -154,6 +154,12 @@ static uint32_t keycode_to_modifier_bit(uint32_t keycode) {
return 0;
}
+static bool key_is_mouse_button(uint32_t keycode) {
+ return (keycode >= BTN_MISC && keycode <= BTN_GEAR_UP)
+ || (keycode >= BTN_TRIGGER_HAPPY && keycode <= BTN_TRIGGER_HAPPY40)
+ || (keycode >= BTN_DPAD_UP && keycode <= BTN_DPAD_RIGHT);
+}
+
static void keyboard_event_process_input_event_data(keyboard_event *self, event_extra_data *extra_data, int fd) {
struct input_event event;
if(read(fd, &event, sizeof(event)) != sizeof(event)) {
@@ -171,8 +177,8 @@ static void keyboard_event_process_input_event_data(keyboard_event *self, event_
//fprintf(stderr, "fd: %d, type: %d, pressed %d, value: %d\n", fd, event.type, event.code, event.value);
//}
- if(event.type == EV_KEY) {
- keyboard_event_process_key_state_change(self, event, extra_data, fd);
+ if(event.type == EV_KEY && !key_is_mouse_button(event.code)) {
+ keyboard_event_process_key_state_change(self, &event, extra_data, fd);
const uint32_t modifier_bit = keycode_to_modifier_bit(event.code);
if(modifier_bit == 0) {
if(keyboard_event_on_key_pressed(self, &event, self->modifier_button_states))
@@ -286,7 +292,7 @@ static bool keyboard_event_try_add_device_if_keyboard(keyboard_event *self, cons
unsigned long evbit = 0;
ioctl(fd, EVIOCGBIT(0, sizeof(evbit)), &evbit);
- const bool is_keyboard = evbit & (1 << EV_KEY);
+ const bool is_keyboard = (evbit & (1 << EV_SYN)) && (evbit & (1 << EV_KEY)) && (evbit & (1 << EV_MSC)) && (evbit & (1 << EV_REP));
if(is_keyboard && strcmp(device_name, GSR_UI_VIRTUAL_KEYBOARD_NAME) != 0) {
unsigned char key_bits[KEY_MAX/8 + 1] = {0};
@@ -297,7 +303,7 @@ static bool keyboard_event_try_add_device_if_keyboard(keyboard_event *self, cons
//const bool supports_touch_events = key_bits[BTN_TOUCH/8] & (1 << (BTN_TOUCH % 8));
const bool supports_joystick_events = key_bits[BTN_JOYSTICK/8] & (1 << (BTN_JOYSTICK % 8));
const bool supports_wheel_events = key_bits[BTN_WHEEL/8] & (1 << (BTN_WHEEL % 8));
- if(supports_key_events && !supports_mouse_events && !supports_joystick_events && !supports_wheel_events) {
+ if(supports_key_events && !supports_joystick_events && !supports_wheel_events) {
unsigned char *key_states = calloc(1, KEY_STATES_SIZE);
if(key_states && self->num_event_polls < MAX_EVENT_POLLS) {
//fprintf(stderr, "%s (%s) supports key inputs\n", dev_input_filepath, device_name);
@@ -314,9 +320,16 @@ static bool keyboard_event_try_add_device_if_keyboard(keyboard_event *self, cons
.num_keys_pressed = 0
};
- keyboard_event_fetch_update_key_states(self, &self->event_extra_data[self->num_event_polls], fd);
- if(self->event_extra_data[self->num_event_polls].num_keys_pressed > 0)
- fprintf(stderr, "Info: device not grabbed yet because some keys are still being pressed: /dev/input/event%d\n", dev_input_id);
+ if(supports_mouse_events) {
+ fprintf(stderr, "Info: device not grabbed yet because it might be a mouse: /dev/input/event%d\n", dev_input_id);
+ fsync(fd);
+ if(ioctl(fd, EVIOCGKEY(KEY_STATES_SIZE), self->event_extra_data[self->num_event_polls].key_states) == -1)
+ fprintf(stderr, "Warning: failed to fetch key states for device: /dev/input/event%d\n", dev_input_id);
+ } else {
+ keyboard_event_fetch_update_key_states(self, &self->event_extra_data[self->num_event_polls], fd);
+ if(self->event_extra_data[self->num_event_polls].num_keys_pressed > 0)
+ fprintf(stderr, "Info: device not grabbed yet because some keys are still being pressed: /dev/input/event%d\n", dev_input_id);
+ }
++self->num_event_polls;
return true;
@@ -389,14 +402,20 @@ static int setup_virtual_keyboard_input(const char *name) {
success &= (ioctl(fd, UI_SET_EVBIT, EV_SYN) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_MSC) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_KEY) != -1);
+ success &= (ioctl(fd, UI_SET_EVBIT, EV_REP) != -1);
+ success &= (ioctl(fd, UI_SET_EVBIT, EV_REL) != -1);
+ success &= (ioctl(fd, UI_SET_EVBIT, EV_LED) != -1);
+
+ success &= (ioctl(fd, UI_SET_MSCBIT, MSC_SCAN) != -1);
for(int i = 1; i < KEY_MAX; ++i) {
success &= (ioctl(fd, UI_SET_KEYBIT, i) != -1);
}
-
- success &= (ioctl(fd, UI_SET_EVBIT, EV_REL) != -1);
- success &= (ioctl(fd, UI_SET_RELBIT, REL_X) != -1);
- success &= (ioctl(fd, UI_SET_RELBIT, REL_Y) != -1);
- success &= (ioctl(fd, UI_SET_RELBIT, REL_Z) != -1);
+ for(int i = 0; i < REL_MAX; ++i) {
+ success &= (ioctl(fd, UI_SET_RELBIT, i) != -1);
+ }
+ for(int i = 0; i < LED_MAX; ++i) {
+ success &= (ioctl(fd, UI_SET_LEDBIT, i) != -1);
+ }
// success &= (ioctl(fd, UI_SET_EVBIT, EV_ABS) != -1);
// success &= (ioctl(fd, UI_SET_ABSBIT, ABS_X) != -1);