summaryrefslogtreecommitdiffstats
path: root/scene/main/window.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-08-26 13:54:23 +0200
committerGitHub <noreply@github.com>2022-08-26 13:54:23 +0200
commitff612b6916876f890113d0241b39273d400314b6 (patch)
treefd6cc7e596c080012ee98d65766d9c94af239ace /scene/main/window.cpp
parent0c639428dd4e4d92a6211c3bb4d04c3af1a4d266 (diff)
parent5ac5c8bc0693465ab5bd8e21adcded10898c1a55 (diff)
downloadredot-engine-ff612b6916876f890113d0241b39273d400314b6.tar.gz
Merge pull request #64574 from Begah/fix_transient_window_wrap_mouse
Diffstat (limited to 'scene/main/window.cpp')
-rw-r--r--scene/main/window.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 68037a1211..35414da9ed 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -966,6 +966,18 @@ DisplayServer::WindowID Window::get_window_id() const {
return window_id;
}
+void Window::warp_mouse(const Vector2 &p_position) {
+ Transform2D xform = get_screen_transform();
+ Vector2 gpos = xform.xform(p_position);
+
+ if (transient_parent && !transient_parent->is_embedding_subwindows()) {
+ Transform2D window_trans = Transform2D().translated(get_position() + (transient_parent->get_visible_rect().size - transient_parent->get_real_size()));
+ gpos = window_trans.xform(gpos);
+ }
+
+ Input::get_singleton()->warp_mouse(gpos);
+}
+
void Window::set_wrap_controls(bool p_enable) {
wrap_controls = p_enable;
if (wrap_controls) {