aboutsummaryrefslogtreecommitdiff
path: root/src/Overlay.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-12-02 22:02:36 +0100
committerdec05eba <dec05eba@protonmail.com>2024-12-02 22:02:36 +0100
commit3ed89cd80b033c3239fb9f57069fcf6804a34773 (patch)
tree724acbfc9d3f3535da03ff218ad0da4a3b929e1a /src/Overlay.cpp
parent9e220bb5f64e5ce2b466a25aa7869a322726ad06 (diff)
Move first mouse move event to after frame has been drawn
Diffstat (limited to 'src/Overlay.cpp')
-rw-r--r--src/Overlay.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 92eb19a..86d87a0 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -635,6 +635,15 @@ namespace gsr {
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;
}
@@ -717,6 +726,7 @@ namespace gsr {
if(visible)
return;
+ drawn_first_frame = false;
window.reset();
window = std::make_unique<mgl::Window>();
deinit_theme();
@@ -936,12 +946,6 @@ namespace gsr {
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) {
switch(recording_status) {
case RecordingStatus::NONE:
@@ -997,6 +1001,8 @@ namespace gsr {
screenshot_sprite.set_texture(nullptr);
visible = false;
+ drawn_first_frame = false;
+
if(window) {
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);