summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/input/input.cpp10
-rw-r--r--core/input/input.h4
-rw-r--r--doc/classes/Control.xml4
-rw-r--r--doc/classes/DisplayServer.xml14
-rw-r--r--doc/classes/HTTPRequest.xml2
-rw-r--r--doc/classes/Input.xml6
-rw-r--r--doc/classes/Viewport.xml2
-rw-r--r--editor/editor_spin_slider.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp16
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/scene_tree_editor.cpp8
-rw-r--r--editor/script_create_dialog.cpp38
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--platform/linuxbsd/display_server_x11.cpp6
-rw-r--r--platform/linuxbsd/display_server_x11.h2
-rw-r--r--platform/osx/display_server_osx.h2
-rw-r--r--platform/osx/display_server_osx.mm4
-rw-r--r--platform/windows/display_server_windows.cpp10
-rw-r--r--platform/windows/display_server_windows.h2
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/main/http_request.cpp6
-rw-r--r--scene/main/http_request.h6
-rw-r--r--scene/main/viewport.cpp8
-rw-r--r--scene/main/viewport.h2
-rw-r--r--servers/display_server.cpp6
-rw-r--r--servers/display_server.h2
27 files changed, 82 insertions, 93 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 656bb92203..e64b5a3ab7 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -72,7 +72,7 @@ Input *Input::singleton = nullptr;
void (*Input::set_mouse_mode_func)(Input::MouseMode) = nullptr;
Input::MouseMode (*Input::get_mouse_mode_func)() = nullptr;
-void (*Input::warp_mouse_func)(const Vector2 &p_to_pos) = nullptr;
+void (*Input::warp_mouse_func)(const Vector2 &p_position) = nullptr;
Input::CursorShape (*Input::get_current_cursor_shape_func)() = nullptr;
void (*Input::set_custom_mouse_cursor_func)(const RES &, Input::CursorShape, const Vector2 &) = nullptr;
@@ -126,7 +126,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask);
ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode);
ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode);
- ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Input::warp_mouse);
ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f));
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW));
@@ -733,8 +733,8 @@ MouseButton Input::get_mouse_button_mask() const {
return mouse_button_mask; // do not trust OS implementation, should remove it - OS::get_singleton()->get_mouse_button_state();
}
-void Input::warp_mouse_position(const Vector2 &p_to) {
- warp_mouse_func(p_to);
+void Input::warp_mouse(const Vector2 &p_position) {
+ warp_mouse_func(p_position);
}
Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
@@ -756,7 +756,7 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
const Point2i pos_local = p_motion->get_global_position() - p_rect.position;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
if (pos_warped != pos_local) {
- warp_mouse_position(pos_warped + p_rect.position);
+ warp_mouse(pos_warped + p_rect.position);
}
return rel_warped;
diff --git a/core/input/input.h b/core/input/input.h
index ab2cd377f4..ac688b53b8 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -216,7 +216,7 @@ private:
static void (*set_mouse_mode_func)(MouseMode);
static MouseMode (*get_mouse_mode_func)();
- static void (*warp_mouse_func)(const Vector2 &p_to_pos);
+ static void (*warp_mouse_func)(const Vector2 &p_position);
static CursorShape (*get_current_cursor_shape_func)();
static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
@@ -273,7 +273,7 @@ public:
Vector2 get_last_mouse_velocity();
MouseButton get_mouse_button_mask() const;
- void warp_mouse_position(const Vector2 &p_to);
+ void warp_mouse(const Vector2 &p_position);
Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
void parse_input_event(const Ref<InputEvent> &p_event);
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 3163ac5610..78150af9dd 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -943,9 +943,9 @@
</method>
<method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to_position" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
- Moves the mouse cursor to [code]to_position[/code], relative to [member position] of this [Control].
+ Moves the mouse cursor to [code]position[/code], relative to [member position] of this [Control].
</description>
</method>
</methods>
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 47bc496100..16a2019149 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -670,13 +670,6 @@
<description>
</description>
</method>
- <method name="mouse_warp_to_position">
- <return type="void" />
- <argument index="0" name="position" type="Vector2i" />
- <description>
- Sets the mouse cursor position to the given [code]position[/code].
- </description>
- </method>
<method name="process_events">
<return type="void" />
<description>
@@ -852,6 +845,13 @@
[b]Note:[/b] This method is implemented on Android, iOS and UWP.
</description>
</method>
+ <method name="warp_mouse">
+ <return type="void" />
+ <argument index="0" name="position" type="Vector2i" />
+ <description>
+ Sets the mouse cursor position to the given [code]position[/code] relative to an origin at the upper left corner of the currently focused game Window Manager window.
+ </description>
+ </method>
<method name="window_attach_instance_id">
<return type="void" />
<argument index="0" name="instance_id" type="int" />
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index 42047a68c8..641d73e333 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -247,7 +247,7 @@
<member name="max_redirects" type="int" setter="set_max_redirects" getter="get_max_redirects" default="8">
Maximum number of allowed redirects.
</member>
- <member name="timeout" type="int" setter="set_timeout" getter="get_timeout" default="0">
+ <member name="timeout" type="float" setter="set_timeout" getter="get_timeout" default="0.0">
</member>
<member name="use_threads" type="bool" setter="set_use_threads" getter="is_using_threads" default="false">
If [code]true[/code], multithreading is used to improve performance.
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index 64a914bb31..c3552c9f62 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -379,11 +379,11 @@
[b]Note:[/b] It needs [code]VIBRATE[/code] permission for Android at export settings. iOS does not support duration.
</description>
</method>
- <method name="warp_mouse_position">
+ <method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
- Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the game window.
+ Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.
Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to [code]MOUSE_MODE_CONFINED[/code] or [code]MOUSE_MODE_CONFINED_HIDDEN[/code].
</description>
</method>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index a72e7f1eb0..b5916f8c17 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -172,7 +172,7 @@
</method>
<method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to_position" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport].
</description>
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 9bf3c4c590..32d28cd3a7 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -81,7 +81,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
if (grabbing_spinner_attempt) {
if (grabbing_spinner) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
- Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
+ Input::get_singleton()->warp_mouse(grabbing_spinner_mouse_pos);
update();
} else {
_focus_entered();
@@ -414,7 +414,7 @@ void EditorSpinSlider::_draw_spin_slider() {
grabber->set_position(get_global_position() + (grabber_rect.get_center() - grabber->get_size() * 0.5) * scale);
if (mousewheel_over_grabber) {
- Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
+ Input::get_singleton()->warp_mouse(grabber->get_position() + grabber_rect.size);
}
grabber_range = width;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index d713e70251..764f467192 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4324,8 +4324,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case UNLOCK_SELECTED: {
@@ -4346,8 +4346,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case GROUP_SELECTED: {
@@ -4368,8 +4368,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
case UNGROUP_SELECTED: {
@@ -4390,8 +4390,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed");
undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed");
}
- undo_redo->add_do_method(viewport, "update", Variant());
- undo_redo->add_undo_method(viewport, "update", Variant());
+ undo_redo->add_do_method(viewport, "update");
+ undo_redo->add_undo_method(viewport, "update");
undo_redo->commit_action();
} break;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 52e60b606c..ea119a33fa 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -205,7 +205,7 @@ void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) {
orbiting = false;
if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
- Input::get_singleton()->warp_mouse_position(orbiting_mouse_start);
+ Input::get_singleton()->warp_mouse(orbiting_mouse_start);
}
}
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 3b8c540592..44eb5c670d 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -96,8 +96,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
if (n->is_class("CanvasItem") || n->is_class("Node3D")) {
undo_redo->add_do_method(n, "remove_meta", "_edit_lock_");
undo_redo->add_undo_method(n, "set_meta", "_edit_lock_", true);
- undo_redo->add_do_method(this, "_update_tree", Variant());
- undo_redo->add_undo_method(this, "_update_tree", Variant());
+ undo_redo->add_do_method(this, "_update_tree");
+ undo_redo->add_undo_method(this, "_update_tree");
undo_redo->add_do_method(this, "emit_signal", "node_changed");
undo_redo->add_undo_method(this, "emit_signal", "node_changed");
}
@@ -114,8 +114,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
if (n->is_class("CanvasItem") || n->is_class("Node3D")) {
undo_redo->add_do_method(n, "remove_meta", "_edit_group_");
undo_redo->add_undo_method(n, "set_meta", "_edit_group_", true);
- undo_redo->add_do_method(this, "_update_tree", Variant());
- undo_redo->add_undo_method(this, "_update_tree", Variant());
+ undo_redo->add_do_method(this, "_update_tree");
+ undo_redo->add_undo_method(this, "_update_tree");
undo_redo->add_do_method(this, "emit_signal", "node_changed");
undo_redo->add_undo_method(this, "emit_signal", "node_changed");
}
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index baafef8639..72f77c859b 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -106,15 +106,7 @@ static Vector<String> _get_hierarchy(String p_class_name) {
void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
- case NOTIFICATION_THEME_CHANGED: {
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons"));
- if (language_icon.is_valid()) {
- language_menu->set_item_icon(i, language_icon);
- }
- }
-
+ case NOTIFICATION_ENTER_TREE: {
String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
if (!last_language.is_empty()) {
for (int i = 0; i < language_menu->get_item_count(); i++) {
@@ -127,9 +119,15 @@ void ScriptCreateDialog::_notification(int p_what) {
} else {
language_menu->select(default_language);
}
- if (EditorSettings::get_singleton()->has_meta("script_setup/use_script_templates")) {
- is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup/use_script_templates"));
- use_templates->set_pressed(is_using_templates);
+
+ [[fallthrough]];
+ }
+ case NOTIFICATION_THEME_CHANGED: {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons"));
+ if (language_icon.is_valid()) {
+ language_menu->set_item_icon(i, language_icon);
+ }
}
path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
@@ -332,13 +330,8 @@ void ScriptCreateDialog::_template_changed(int p_template) {
dic_templates_project[parent_name->get_text()] = sinfo.get_hash();
EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project);
} else {
- // Save template into to editor dictionary (not a project template).
- Dictionary dic_templates;
- if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) {
- dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary");
- }
- dic_templates[parent_name->get_text()] = sinfo.get_hash();
- EditorSettings::get_singleton()->set_meta("script_setup/templates_dictionary", dic_templates);
+ // Save template info to editor dictionary (not a project template).
+ templates_dictionary[parent_name->get_text()] = sinfo.get_hash();
// Remove template from project dictionary as we last used an editor level template.
Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
if (dic_templates_project.has(parent_name->get_text())) {
@@ -479,7 +472,6 @@ void ScriptCreateDialog::_built_in_pressed() {
void ScriptCreateDialog::_use_template_pressed() {
is_using_templates = use_templates->is_pressed();
- EditorSettings::get_singleton()->set_meta("script_setup/use_script_templates", is_using_templates);
_update_dialog();
}
@@ -597,10 +589,6 @@ void ScriptCreateDialog::_update_template_menu() {
if (is_language_using_templates) {
// Get the latest templates used for each type of node from project settings then global settings.
Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
- Dictionary last_global_templates;
- if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) {
- last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary");
- }
String inherits_base_type = parent_name->get_text();
// If it inherits from a script, get its parent class first.
@@ -655,7 +643,7 @@ void ScriptCreateDialog::_update_template_menu() {
// Check for last used template for this node in project settings then in global settings.
if (last_local_templates.has(parent_name->get_text()) && t.get_hash() == String(last_local_templates[parent_name->get_text()])) {
last_used_template = id;
- } else if (last_used_template == -1 && last_global_templates.has(parent_name->get_text()) && t.get_hash() == String(last_global_templates[parent_name->get_text()])) {
+ } else if (last_used_template == -1 && templates_dictionary.has(parent_name->get_text()) && t.get_hash() == String(templates_dictionary[parent_name->get_text()])) {
last_used_template = id;
}
t.id = id;
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index d7c43f322c..e9f634e2c0 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -83,6 +83,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
int current_language;
int default_language;
bool re_check_path = false;
+ Dictionary templates_dictionary;
Control *path_controls[2];
Control *name_controls[2];
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 07cb6a23e8..2ddccdb8bf 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -363,15 +363,15 @@ DisplayServerX11::MouseMode DisplayServerX11::mouse_get_mode() const {
return mouse_mode;
}
-void DisplayServerX11::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerX11::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (mouse_mode == MOUSE_MODE_CAPTURED) {
- last_mouse_pos = p_to;
+ last_mouse_pos = p_position;
} else {
WindowID window_id = windows.has(last_focused_window) ? last_focused_window : MAIN_WINDOW_ID;
XWarpPointer(x11_display, None, windows[window_id].x11_window,
- 0, 0, 0, 0, (int)p_to.x, (int)p_to.y);
+ 0, 0, 0, 0, (int)p_position.x, (int)p_position.y);
}
}
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 63d32d939d..0f44aa4b11 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -301,7 +301,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode) override;
virtual MouseMode mouse_get_mode() const override;
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
virtual MouseButton mouse_get_button_state() const override;
diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h
index d9a0d2ce17..fa3091ff81 100644
--- a/platform/osx/display_server_osx.h
+++ b/platform/osx/display_server_osx.h
@@ -271,7 +271,7 @@ public:
virtual MouseMode mouse_get_mode() const override;
bool update_mouse_wrap(WindowData &p_wd, NSPoint &r_delta, NSPoint &r_mpos, NSTimeInterval p_timestamp);
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
void mouse_set_button_state(MouseButton p_state);
virtual MouseButton mouse_get_button_state() const override;
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index 8820201c10..6cdadcae39 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -1646,7 +1646,7 @@ bool DisplayServerOSX::update_mouse_wrap(WindowData &p_wd, NSPoint &r_delta, NSP
return false;
}
-void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerOSX::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (mouse_mode != MOUSE_MODE_CAPTURED) {
@@ -1656,7 +1656,7 @@ void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) {
// Local point in window coords.
const NSRect contentRect = [wd.window_view frame];
const float scale = screen_get_max_scale();
- NSRect pointInWindowRect = NSMakeRect(p_to.x / scale, contentRect.size.height - (p_to.y / scale - 1), 0, 0);
+ NSRect pointInWindowRect = NSMakeRect(p_position.x / scale, contentRect.size.height - (p_position.y / scale - 1), 0, 0);
NSPoint pointOnScreen = [[wd.window_view window] convertRectToScreen:pointInWindowRect].origin;
// Point in scren coords.
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index d243d4c05d..16323dcc13 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -150,7 +150,7 @@ DisplayServer::MouseMode DisplayServerWindows::mouse_get_mode() const {
return mouse_mode;
}
-void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServerWindows::warp_mouse(const Point2i &p_position) {
_THREAD_SAFE_METHOD_
if (!windows.has(last_focused_window)) {
@@ -158,12 +158,12 @@ void DisplayServerWindows::mouse_warp_to_position(const Point2i &p_to) {
}
if (mouse_mode == MOUSE_MODE_CAPTURED) {
- old_x = p_to.x;
- old_y = p_to.y;
+ old_x = p_position.x;
+ old_y = p_position.y;
} else {
POINT p;
- p.x = p_to.x;
- p.y = p_to.y;
+ p.x = p_position.x;
+ p.y = p_position.y;
ClientToScreen(windows[last_focused_window].hWnd, &p);
SetCursorPos(p.x, p.y);
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index a56a2b83ac..71fedf2bca 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -457,7 +457,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode) override;
virtual MouseMode mouse_get_mode() const override;
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
virtual MouseButton mouse_get_button_state() const override;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index d2d1b5e9b7..ee35eee35d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2937,9 +2937,9 @@ Control::MouseFilter Control::get_mouse_filter() const {
return data.mouse_filter;
}
-void Control::warp_mouse(const Point2 &p_to_pos) {
+void Control::warp_mouse(const Point2 &p_position) {
ERR_FAIL_COND(!is_inside_tree());
- get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
+ get_viewport()->warp_mouse(get_global_transform().xform(p_position));
}
bool Control::is_text_field() const {
@@ -3331,7 +3331,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview);
ClassDB::bind_method(D_METHOD("is_drag_successful"), &Control::is_drag_successful);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Control::warp_mouse);
ClassDB::bind_method(D_METHOD("update_minimum_size"), &Control::update_minimum_size);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index becb50a118..9f78d003ae 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -548,7 +548,7 @@ public:
void grab_click_focus();
- void warp_mouse(const Point2 &p_to_pos);
+ void warp_mouse(const Point2 &p_position);
virtual bool is_text_field() const;
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 700ba761f6..ac10c2bad8 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -558,12 +558,12 @@ void HTTPRequest::set_https_proxy(const String &p_host, int p_port) {
client->set_https_proxy(p_host, p_port);
}
-void HTTPRequest::set_timeout(int p_timeout) {
+void HTTPRequest::set_timeout(double p_timeout) {
ERR_FAIL_COND(p_timeout < 0);
timeout = p_timeout;
}
-int HTTPRequest::get_timeout() {
+double HTTPRequest::get_timeout() {
return timeout;
}
@@ -615,7 +615,7 @@ void HTTPRequest::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "accept_gzip"), "set_accept_gzip", "is_accepting_gzip");
ADD_PROPERTY(PropertyInfo(Variant::INT, "body_size_limit", PROPERTY_HINT_RANGE, "-1,2000000000"), "set_body_size_limit", "get_body_size_limit");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_redirects", PROPERTY_HINT_RANGE, "-1,64"), "set_max_redirects", "get_max_redirects");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "timeout", PROPERTY_HINT_RANGE, "0,86400"), "set_timeout", "get_timeout");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "timeout", PROPERTY_HINT_RANGE, "0,3600,0.1,or_greater"), "set_timeout", "get_timeout");
ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "headers"), PropertyInfo(Variant::PACKED_BYTE_ARRAY, "body")));
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 62880fa282..26d648458f 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -96,7 +96,7 @@ private:
int max_redirects = 8;
- int timeout = 0;
+ double timeout = 0;
void _redirect_request(const String &p_new_url);
@@ -146,8 +146,8 @@ public:
Timer *timer;
- void set_timeout(int p_timeout);
- int get_timeout();
+ void set_timeout(double p_timeout);
+ double get_timeout();
void _timeout();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4525696071..10ff464bfa 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1124,9 +1124,9 @@ Vector2 Viewport::get_mouse_position() const {
return gui.last_mouse_pos;
}
-void Viewport::warp_mouse(const Vector2 &p_pos) {
- Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_pos);
- Input::get_singleton()->warp_mouse_position(gpos);
+void Viewport::warp_mouse(const Vector2 &p_position) {
+ Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_position);
+ Input::get_singleton()->warp_mouse(gpos);
}
void Viewport::_gui_sort_roots() {
@@ -3642,7 +3642,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d);
ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Viewport::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Viewport::warp_mouse);
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
ClassDB::bind_method(D_METHOD("gui_is_dragging"), &Viewport::gui_is_dragging);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e4912f31c5..d5fca1b881 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -547,7 +547,7 @@ public:
bool is_input_disabled() const;
Vector2 get_mouse_position() const;
- void warp_mouse(const Vector2 &p_pos);
+ void warp_mouse(const Vector2 &p_position);
void set_physics_object_picking(bool p_enable);
bool get_physics_object_picking();
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index db65465c64..67bfc75426 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -228,7 +228,7 @@ DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {
return MOUSE_MODE_VISIBLE;
}
-void DisplayServer::mouse_warp_to_position(const Point2i &p_to) {
+void DisplayServer::warp_mouse(const Point2i &p_position) {
WARN_PRINT("Mouse warping is not supported by this display server.");
}
@@ -481,7 +481,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("mouse_set_mode", "mouse_mode"), &DisplayServer::mouse_set_mode);
ClassDB::bind_method(D_METHOD("mouse_get_mode"), &DisplayServer::mouse_get_mode);
- ClassDB::bind_method(D_METHOD("mouse_warp_to_position", "position"), &DisplayServer::mouse_warp_to_position);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &DisplayServer::warp_mouse);
ClassDB::bind_method(D_METHOD("mouse_get_position"), &DisplayServer::mouse_get_position);
ClassDB::bind_method(D_METHOD("mouse_get_button_state"), &DisplayServer::mouse_get_button_state);
@@ -729,7 +729,7 @@ Input::MouseMode DisplayServer::_input_get_mouse_mode() {
}
void DisplayServer::_input_warp(const Vector2 &p_to_pos) {
- singleton->mouse_warp_to_position(p_to_pos);
+ singleton->warp_mouse(p_to_pos);
}
Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {
diff --git a/servers/display_server.h b/servers/display_server.h
index f3a910471f..4961b07ba3 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -183,7 +183,7 @@ public:
virtual void mouse_set_mode(MouseMode p_mode);
virtual MouseMode mouse_get_mode() const;
- virtual void mouse_warp_to_position(const Point2i &p_to);
+ virtual void warp_mouse(const Point2i &p_position);
virtual Point2i mouse_get_position() const;
virtual MouseButton mouse_get_button_state() const;