mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-08 04:18:08 +09:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4c85910ce | ||
|
|
fd63ac3626 | ||
|
|
2a0782eb02 | ||
|
|
f505323d56 | ||
|
|
309cc3425b | ||
|
|
81cb8f539f | ||
|
|
5214fb1d7f | ||
|
|
9aebe81ec4 | ||
|
|
d73bd68a70 |
@@ -39,7 +39,7 @@ This program has to grab all keyboards and create a virtual keyboard (`gsr-ui vi
|
||||
This might cause issues for you if you use input remapping software. To workaround this you can go into settings and select "Only grab virtual devices"
|
||||
|
||||
# License
|
||||
This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`.
|
||||
This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`. `images/default.cur` it part of the [Adwaita icon theme](https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/tree/master) which is licensed under `Creative Commons Attribution-Share Alike 3.0`.
|
||||
|
||||
# Demo
|
||||
[](https://www.youtube.com/watch?v=SOqXusCTXXA)
|
||||
|
||||
9
TODO
9
TODO
@@ -107,4 +107,11 @@ When adding window capture only add it to recording and streaming and do the win
|
||||
|
||||
Show an error that prime run will be disabled when using desktop portal capture option. This can cause issues as the user may have selected a video codec option that isn't available on their iGPU but is available on the prime-run dGPU.
|
||||
|
||||
Is it possible to configure hotkey and the new hotkey to get triggered immediately?
|
||||
Is it possible to configure hotkey and the new hotkey to get triggered immediately?
|
||||
|
||||
For keyboards that report supporting mice the keyboard grab will be delayed until any key has been pressed (and then released), see: https://github.com/dec05eba/gpu-screen-recorder-issues/issues/97
|
||||
See if there is any way around this.
|
||||
|
||||
Instead of installing gsr-global-hotkeys in flatpak use kms-server-proxy to launch gsr-global-hotkeys inside the flatpak with root, just like gsr-kms-server. This removes the need to update gsr-global-hotkeys everytime there is an update.
|
||||
|
||||
Check if "modprobe uinput" is needed on some systems (old fedora?).
|
||||
BIN
images/default.cur
Normal file
BIN
images/default.cur
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
project('gsr-ui', ['c', 'cpp'], version : '1.1.4', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
|
||||
project('gsr-ui', ['c', 'cpp'], version : '1.1.6', 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.2"', language: ['c', 'cpp'])
|
||||
add_project_arguments('-DGSR_FLATPAK_VERSION="5.1.3"', language: ['c', 'cpp'])
|
||||
|
||||
executable(
|
||||
meson.project_name(),
|
||||
@@ -74,6 +74,7 @@ executable(
|
||||
[
|
||||
'tools/gsr-global-hotkeys/hotplug.c',
|
||||
'tools/gsr-global-hotkeys/keyboard_event.c',
|
||||
'tools/gsr-global-hotkeys/keys.c',
|
||||
'tools/gsr-global-hotkeys/main.c'
|
||||
],
|
||||
c_args : '-fstack-protector-all',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "gsr-ui"
|
||||
type = "executable"
|
||||
version = "1.1.4"
|
||||
version = "1.1.6"
|
||||
platforms = ["posix"]
|
||||
|
||||
[lang.cpp]
|
||||
|
||||
@@ -772,9 +772,32 @@ namespace gsr {
|
||||
if(cursor_size <= 1)
|
||||
cursor_size = 24;
|
||||
|
||||
XcursorImage *cursor_image = XcursorShapeLoadImage(XC_left_ptr, cursor_theme, cursor_size);
|
||||
XcursorImage *cursor_image = nullptr;
|
||||
for(int cursor_size_test : {cursor_size, 24}) {
|
||||
for(const char *cursor_theme_test : {cursor_theme, "default", "Adwaita"}) {
|
||||
for(unsigned int shape : {XC_left_ptr, XC_arrow}) {
|
||||
cursor_image = XcursorShapeLoadImage(shape, cursor_theme_test, cursor_size_test);
|
||||
if(cursor_image)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if(!cursor_image) {
|
||||
fprintf(stderr, "Error: failed to get cursor, loading bundled default cursor instead\n");
|
||||
const std::string default_cursor_path = resources_path + "images/default.cur";
|
||||
for(int cursor_size_test : {cursor_size, 24}) {
|
||||
cursor_image = XcursorFilenameLoadImage(default_cursor_path.c_str(), cursor_size_test);
|
||||
if(cursor_image)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!cursor_image) {
|
||||
fprintf(stderr, "Error: failed to get cursor\n");
|
||||
XFixesShowCursor(xi_display, DefaultRootWindow(xi_display));
|
||||
XFlush(xi_display);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "keyboard_event.h"
|
||||
#include "keys.h"
|
||||
|
||||
/* C stdlib */
|
||||
#include <stdio.h>
|
||||
@@ -154,12 +155,6 @@ 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)) {
|
||||
@@ -177,7 +172,7 @@ 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 && !key_is_mouse_button(event.code)) {
|
||||
if(event.type == EV_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) {
|
||||
@@ -408,7 +403,8 @@ static int setup_virtual_keyboard_input(const char *name) {
|
||||
|
||||
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);
|
||||
if(is_key_or_mouse_button(i))
|
||||
success &= (ioctl(fd, UI_SET_KEYBIT, i) != -1);
|
||||
}
|
||||
for(int i = 0; i < REL_MAX; ++i) {
|
||||
success &= (ioctl(fd, UI_SET_RELBIT, i) != -1);
|
||||
|
||||
25
tools/gsr-global-hotkeys/keys.c
Normal file
25
tools/gsr-global-hotkeys/keys.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "keys.h"
|
||||
#include <linux/input-event-codes.h>
|
||||
|
||||
bool is_key_or_mouse_button(uint32_t keycode) {
|
||||
return (keycode >= KEY_ESC && keycode <= KEY_KPDOT)
|
||||
|| (keycode >= KEY_ZENKAKUHANKAKU && keycode <= KEY_F24)
|
||||
|| (keycode >= KEY_PLAYCD && keycode <= KEY_MICMUTE)
|
||||
|| (keycode >= BTN_MISC && keycode <= BTN_TASK)
|
||||
|| (keycode >= BTN_JOYSTICK && keycode <= BTN_THUMBR)
|
||||
|| (keycode >= BTN_DIGI && keycode <= BTN_GEAR_UP)
|
||||
|| (keycode >= KEY_OK && keycode <= KEY_IMAGES)
|
||||
|| (keycode >= KEY_DEL_EOL && keycode <= KEY_DEL_LINE)
|
||||
|| (keycode >= KEY_FN && keycode <= KEY_FN_B)
|
||||
|| (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT10)
|
||||
|| (keycode >= KEY_NUMERIC_0 && keycode <= KEY_LIGHTS_TOGGLE)
|
||||
|| (keycode >= BTN_DPAD_UP && keycode <= BTN_DPAD_RIGHT)
|
||||
|| (keycode == KEY_ALS_TOGGLE)
|
||||
|| (keycode >= KEY_BUTTONCONFIG && keycode <= KEY_VOICECOMMAND)
|
||||
|| (keycode >= KEY_BRIGHTNESS_MIN && keycode <= KEY_BRIGHTNESS_MAX)
|
||||
|| (keycode >= KEY_KBDINPUTASSIST_PREV && keycode <= KEY_ONSCREEN_KEYBOARD);
|
||||
}
|
||||
|
||||
bool is_mouse_button(uint32_t keycode) {
|
||||
return (keycode >= BTN_MOUSE && keycode <= BTN_TASK);
|
||||
}
|
||||
10
tools/gsr-global-hotkeys/keys.h
Normal file
10
tools/gsr-global-hotkeys/keys.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef KEYS_H
|
||||
#define KEYS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
bool is_key_or_mouse_button(uint32_t keycode);
|
||||
bool is_mouse_button(uint32_t keycode);
|
||||
|
||||
#endif /* KEYS_H */
|
||||
Reference in New Issue
Block a user