diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-03 02:27:20 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-03 02:27:20 +0100 |
commit | 88b8c80c2bc64579aa1c36c1825fb8c7377f7742 (patch) | |
tree | 9e6cb498daae190a1f446514c49588853109da8e /src | |
parent | 2a07c741121e737aec9bdd5214ba66efbf252da0 (diff) |
A little bit of glitch fixing, warp cursor after hiding ui when XI grabbing
Diffstat (limited to 'src')
-rw-r--r-- | src/Overlay.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp index 896f611..e736627 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -1115,8 +1115,6 @@ namespace gsr { XFlush(display); if(xi_display) { - XFixesShowCursor(xi_display, DefaultRootWindow(xi_display)); - XFlush(xi_display); cursor_texture.clear(); cursor_sprite.set_texture(nullptr); } @@ -1142,6 +1140,18 @@ namespace gsr { if(xi_display) { XCloseDisplay(xi_display); xi_display = nullptr; + + if(window) { + mgl_context *context = mgl_get_context(); + Display *display = (Display*)context->connection; + + const mgl::vec2i new_cursor_position = mgl::vec2i(window->internal_window()->pos.x, window->internal_window()->pos.y) + window->get_mouse_position(); + XWarpPointer(display, DefaultRootWindow(display), DefaultRootWindow(display), 0, 0, 0, 0, new_cursor_position.x, new_cursor_position.y); + XFlush(display); + + XFixesShowCursor(display, DefaultRootWindow(display)); + XFlush(display); + } } if(window) { |