Merge pull request #69246 from nongvantinh/3.x-check-null-for-input_event
3.x Enhance null checking for input event
This commit is contained in:
commit
6f91639af2
14 changed files with 30 additions and 0 deletions
|
@ -106,6 +106,8 @@ bool WindowDialog::has_point(const Point2 &p_point) const {
|
|||
}
|
||||
|
||||
void WindowDialog::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
|
|
|
@ -78,6 +78,8 @@ void FileDialog::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
if (k.is_valid() && is_window_modal_on_top()) {
|
||||
if (k->is_pressed()) {
|
||||
|
|
|
@ -1098,6 +1098,8 @@ void GraphEdit::set_selected(Node *p_child) {
|
|||
}
|
||||
|
||||
void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||
ERR_FAIL_COND(p_ev.is_null());
|
||||
|
||||
Ref<InputEventMouseMotion> mm = p_ev;
|
||||
if (mm.is_valid() && (mm->get_button_mask() & BUTTON_MASK_MIDDLE || (mm->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
|
||||
Vector2i relative = Input::get_singleton()->warp_mouse_motion(mm, get_global_rect());
|
||||
|
|
|
@ -746,6 +746,8 @@ Color GraphNode::get_connection_output_color(int p_idx) {
|
|||
}
|
||||
|
||||
void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||
ERR_FAIL_COND(p_ev.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_ev;
|
||||
if (mb.is_valid()) {
|
||||
ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");
|
||||
|
|
|
@ -49,6 +49,8 @@ static bool _is_text_char(CharType c) {
|
|||
}
|
||||
|
||||
void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> b = p_event;
|
||||
|
||||
if (b.is_valid()) {
|
||||
|
|
|
@ -1164,6 +1164,8 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const
|
|||
}
|
||||
|
||||
void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> b = p_event;
|
||||
|
||||
if (b.is_valid()) {
|
||||
|
|
|
@ -88,6 +88,8 @@ void ScrollContainer::_cancel_drag() {
|
|||
}
|
||||
|
||||
void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
ERR_FAIL_COND(p_gui_input.is_null());
|
||||
|
||||
double prev_v_scroll = v_scroll->get_value();
|
||||
double prev_h_scroll = h_scroll->get_value();
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ Size2 Slider::get_minimum_size() const {
|
|||
}
|
||||
|
||||
void Slider::_gui_input(Ref<InputEvent> p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
if (!editable) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,8 @@ void SpinBox::_release_mouse() {
|
|||
}
|
||||
|
||||
void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
if (!is_editable()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -196,6 +196,8 @@ void SplitContainer::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ int TabContainer::_get_top_margin() const {
|
|||
}
|
||||
|
||||
void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
Popup *popup = get_popup();
|
||||
|
|
|
@ -84,6 +84,8 @@ Size2 Tabs::get_minimum_size() const {
|
|||
}
|
||||
|
||||
void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
if (mm.is_valid()) {
|
||||
|
|
|
@ -2402,6 +2402,8 @@ void TextEdit::_get_minimap_mouse_row(const Point2i &p_mouse, int &r_row) const
|
|||
}
|
||||
|
||||
void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
ERR_FAIL_COND(p_gui_input.is_null());
|
||||
|
||||
double prev_v_scroll = v_scroll->get_value();
|
||||
double prev_h_scroll = h_scroll->get_value();
|
||||
|
||||
|
|
|
@ -1414,6 +1414,8 @@ void Viewport::_vp_input_text(const String &p_text) {
|
|||
}
|
||||
|
||||
void Viewport::_vp_input(const Ref<InputEvent> &p_ev) {
|
||||
ERR_FAIL_COND(p_ev.is_null());
|
||||
|
||||
if (disable_input) {
|
||||
return;
|
||||
}
|
||||
|
@ -1436,6 +1438,8 @@ void Viewport::_vp_input(const Ref<InputEvent> &p_ev) {
|
|||
}
|
||||
|
||||
void Viewport::_vp_unhandled_input(const Ref<InputEvent> &p_ev) {
|
||||
ERR_FAIL_COND(p_ev.is_null());
|
||||
|
||||
if (disable_input) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue