mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-07 15:19:56 +09:00
Move first mouse move event to after frame has been drawn
This commit is contained in:
@@ -160,5 +160,6 @@ namespace gsr {
|
|||||||
XEvent *xi_output_xev = nullptr;
|
XEvent *xi_output_xev = nullptr;
|
||||||
|
|
||||||
std::array<KeyBinding, 1> key_bindings;
|
std::array<KeyBinding, 1> key_bindings;
|
||||||
|
bool drawn_first_frame = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -635,6 +635,15 @@ namespace gsr {
|
|||||||
|
|
||||||
window->display();
|
window->display();
|
||||||
|
|
||||||
|
if(!drawn_first_frame) {
|
||||||
|
drawn_first_frame = true;
|
||||||
|
mgl::Event event;
|
||||||
|
event.type = mgl::Event::MouseMoved;
|
||||||
|
event.mouse_move.x = window->get_mouse_position().x;
|
||||||
|
event.mouse_move.y = window->get_mouse_position().y;
|
||||||
|
on_event(event);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,6 +726,7 @@ namespace gsr {
|
|||||||
if(visible)
|
if(visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
drawn_first_frame = false;
|
||||||
window.reset();
|
window.reset();
|
||||||
window = std::make_unique<mgl::Window>();
|
window = std::make_unique<mgl::Window>();
|
||||||
deinit_theme();
|
deinit_theme();
|
||||||
@@ -936,12 +946,6 @@ namespace gsr {
|
|||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
||||||
mgl::Event event;
|
|
||||||
event.type = mgl::Event::MouseMoved;
|
|
||||||
event.mouse_move.x = window->get_mouse_position().x;
|
|
||||||
event.mouse_move.y = window->get_mouse_position().y;
|
|
||||||
on_event(event);
|
|
||||||
|
|
||||||
if(gpu_screen_recorder_process > 0) {
|
if(gpu_screen_recorder_process > 0) {
|
||||||
switch(recording_status) {
|
switch(recording_status) {
|
||||||
case RecordingStatus::NONE:
|
case RecordingStatus::NONE:
|
||||||
@@ -997,6 +1001,8 @@ namespace gsr {
|
|||||||
screenshot_sprite.set_texture(nullptr);
|
screenshot_sprite.set_texture(nullptr);
|
||||||
|
|
||||||
visible = false;
|
visible = false;
|
||||||
|
drawn_first_frame = false;
|
||||||
|
|
||||||
if(window) {
|
if(window) {
|
||||||
const mgl::vec2i new_cursor_position = mgl::vec2i(window->internal_window()->pos.x, window->internal_window()->pos.y) + window->get_mouse_position();
|
const mgl::vec2i new_cursor_position = mgl::vec2i(window->internal_window()->pos.x, window->internal_window()->pos.y) + window->get_mouse_position();
|
||||||
window->set_visible(false);
|
window->set_visible(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user