mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-24 18:42:59 +09:00
Only update cursor tracker every 100ms, fix cursor hotspot offset for x11
This commit is contained in:
@@ -210,5 +210,6 @@ namespace gsr {
|
|||||||
std::function<void()> on_region_selected;
|
std::function<void()> on_region_selected;
|
||||||
|
|
||||||
std::unique_ptr<CursorTracker> cursor_tracker;
|
std::unique_ptr<CursorTracker> cursor_tracker;
|
||||||
|
mgl::Clock cursor_tracker_update_clock;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,7 @@ namespace gsr {
|
|||||||
static const double replay_saving_notification_timeout_seconds = 0.5;
|
static const double replay_saving_notification_timeout_seconds = 0.5;
|
||||||
static const double notification_timeout_seconds = 2.0;
|
static const double notification_timeout_seconds = 2.0;
|
||||||
static const double notification_error_timeout_seconds = 5.0;
|
static const double notification_error_timeout_seconds = 5.0;
|
||||||
|
static const double cursor_tracker_update_timeout_sec = 0.1;
|
||||||
|
|
||||||
static mgl::Texture texture_from_ximage(XImage *img) {
|
static mgl::Texture texture_from_ximage(XImage *img) {
|
||||||
uint8_t *texture_data = (uint8_t*)malloc(img->width * img->height * 3);
|
uint8_t *texture_data = (uint8_t*)malloc(img->width * img->height * 3);
|
||||||
@@ -634,8 +635,11 @@ namespace gsr {
|
|||||||
if(global_hotkeys_js)
|
if(global_hotkeys_js)
|
||||||
global_hotkeys_js->poll_events();
|
global_hotkeys_js->poll_events();
|
||||||
|
|
||||||
|
if(cursor_tracker_update_clock.get_elapsed_time_seconds() >= cursor_tracker_update_timeout_sec) {
|
||||||
|
cursor_tracker_update_clock.restart();
|
||||||
if(cursor_tracker)
|
if(cursor_tracker)
|
||||||
cursor_tracker->update();
|
cursor_tracker->update();
|
||||||
|
}
|
||||||
|
|
||||||
handle_keyboard_mapping_event();
|
handle_keyboard_mapping_event();
|
||||||
region_selector.poll_events();
|
region_selector.poll_events();
|
||||||
@@ -958,7 +962,7 @@ namespace gsr {
|
|||||||
// The real cursor doesn't move when all devices are grabbed, so we create our own cursor and diplay that while grabbed
|
// The real cursor doesn't move when all devices are grabbed, so we create our own cursor and diplay that while grabbed
|
||||||
cursor_hotspot = {0, 0};
|
cursor_hotspot = {0, 0};
|
||||||
xi_setup_fake_cursor();
|
xi_setup_fake_cursor();
|
||||||
if(cursor_info) {
|
if(cursor_info && gsr_info.system_info.display_server == DisplayServer::WAYLAND) {
|
||||||
win->cursor_position.x += cursor_hotspot.x;
|
win->cursor_position.x += cursor_hotspot.x;
|
||||||
win->cursor_position.y += cursor_hotspot.y;
|
win->cursor_position.y += cursor_hotspot.y;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user