summaryrefslogtreecommitdiff
path: root/scene/gui/control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r--scene/gui/control.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index ce268843b1..a8070be91d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2267,8 +2267,10 @@ void Control::_window_sort_subwindows() {
if (!window->subwindow_order_dirty)
return;
+
window->modal_stack.sort_custom<CComparator>();
window->subwindows.sort_custom<CComparator>();
+
window->subwindow_order_dirty=false;
}
@@ -2688,6 +2690,12 @@ Control *Control::get_focus_owner() const {
return data.window->window->key_focus;
}
+
+void Control::warp_mouse(const Point2& p_to_pos) {
+ ERR_FAIL_COND(!is_inside_tree());
+ get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
+}
+
void Control::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event);
@@ -2784,6 +2792,9 @@ void Control::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_drag_preview","control:Control"),&Control::set_drag_preview);
+ ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"),&Control::warp_mouse);
+
+
BIND_VMETHOD(MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
BIND_VMETHOD(MethodInfo(Variant::VECTOR2,"get_minimum_size"));
BIND_VMETHOD(MethodInfo(Variant::OBJECT,"get_drag_data",PropertyInfo(Variant::VECTOR2,"pos")));