You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-31 18:41:20 +00:00
Merge pull request #111288 from bruvzg/move_input
[Window] Add unfiltered input handler signal for custom decorations.
This commit is contained in:
@@ -1727,6 +1727,15 @@ real_t Window::get_content_scale_factor() const {
|
||||
return content_scale_factor;
|
||||
}
|
||||
|
||||
void Window::set_nonclient_area(const Rect2i &p_rect) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
nonclient_area = p_rect;
|
||||
}
|
||||
|
||||
Rect2i Window::get_nonclient_area() const {
|
||||
return nonclient_area;
|
||||
}
|
||||
|
||||
DisplayServer::WindowID Window::get_window_id() const {
|
||||
ERR_READ_THREAD_GUARD_V(DisplayServer::INVALID_WINDOW_ID);
|
||||
if (get_embedder()) {
|
||||
@@ -1817,6 +1826,12 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
|
||||
if (exclusive_child != nullptr) {
|
||||
if (nonclient_area.has_area() && is_inside_tree()) {
|
||||
Ref<InputEventMouse> me = p_ev;
|
||||
if (me.is_valid() && nonclient_area.has_point(me->get_position())) {
|
||||
emit_signal(SceneStringName(nonclient_window_input), p_ev);
|
||||
}
|
||||
}
|
||||
if (!is_embedding_subwindows()) { // Not embedding, no need for event.
|
||||
return;
|
||||
}
|
||||
@@ -3222,6 +3237,9 @@ void Window::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_content_scale_stretch", "stretch"), &Window::set_content_scale_stretch);
|
||||
ClassDB::bind_method(D_METHOD("get_content_scale_stretch"), &Window::get_content_scale_stretch);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_nonclient_area", "area"), &Window::set_nonclient_area);
|
||||
ClassDB::bind_method(D_METHOD("get_nonclient_area"), &Window::get_nonclient_area);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_keep_title_visible", "title_visible"), &Window::set_keep_title_visible);
|
||||
ClassDB::bind_method(D_METHOD("get_keep_title_visible"), &Window::get_keep_title_visible);
|
||||
|
||||
@@ -3326,6 +3344,7 @@ void Window::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position", PROPERTY_HINT_NONE, "suffix:px"), "set_position", "get_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size", PROPERTY_HINT_NONE, "suffix:px"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen", PROPERTY_HINT_RANGE, "0,64,1,or_greater"), "set_current_screen", "get_current_screen");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT2I, "nonclient_area", PROPERTY_HINT_NONE, ""), "set_nonclient_area", "get_nonclient_area");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "mouse_passthrough_polygon"), "set_mouse_passthrough_polygon", "get_mouse_passthrough_polygon");
|
||||
|
||||
@@ -3375,6 +3394,7 @@ void Window::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "theme_type_variation", PROPERTY_HINT_ENUM_SUGGESTION), "set_theme_type_variation", "get_theme_type_variation");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("window_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||
ADD_SIGNAL(MethodInfo("nonclient_window_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||
ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
|
||||
ADD_SIGNAL(MethodInfo("mouse_entered"));
|
||||
ADD_SIGNAL(MethodInfo("mouse_exited"));
|
||||
|
||||
@@ -171,6 +171,8 @@ private:
|
||||
|
||||
Size2i max_size_used;
|
||||
|
||||
Rect2i nonclient_area;
|
||||
|
||||
Size2i _clamp_limit_size(const Size2i &p_limit_size);
|
||||
Size2i _clamp_window_size(const Size2i &p_size);
|
||||
void _validate_limit_size();
|
||||
@@ -391,6 +393,9 @@ public:
|
||||
void set_content_scale_factor(real_t p_factor);
|
||||
real_t get_content_scale_factor() const;
|
||||
|
||||
void set_nonclient_area(const Rect2i &p_rect);
|
||||
Rect2i get_nonclient_area() const;
|
||||
|
||||
void set_mouse_passthrough_polygon(const Vector<Vector2> &p_region);
|
||||
Vector<Vector2> get_mouse_passthrough_polygon() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user