Add support for event accumlation (off by default, on for editor), fixes #26536

This commit is contained in:
Juan Linietsky
2019-03-03 19:52:18 -03:00
parent a9fe834a8e
commit a1e73dcc94
10 changed files with 106 additions and 17 deletions

View File

@ -1660,7 +1660,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
k->set_shift(true);
}
input->parse_input_event(k);
input->accumulate_input_event(k);
}
return;
}
@ -1804,7 +1804,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
}
//printf("key: %x\n",k->get_scancode());
input->parse_input_event(k);
input->accumulate_input_event(k);
}
struct Property {
@ -1991,12 +1991,12 @@ void OS_X11::process_xevents() {
// in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out
xi.mouse_pos_to_filter = pos;
}
input->parse_input_event(st);
input->accumulate_input_event(st);
} else {
if (!xi.state.has(index)) // Defensive
break;
xi.state.erase(index);
input->parse_input_event(st);
input->accumulate_input_event(st);
}
} break;
@ -2014,7 +2014,7 @@ void OS_X11::process_xevents() {
sd->set_index(index);
sd->set_position(pos);
sd->set_relative(pos - curr_pos_elem->value());
input->parse_input_event(sd);
input->accumulate_input_event(sd);
curr_pos_elem->value() = pos;
}
@ -2102,7 +2102,7 @@ void OS_X11::process_xevents() {
st.instance();
st->set_index(E->key());
st->set_position(E->get());
input->parse_input_event(st);
input->accumulate_input_event(st);
}
xi.state.clear();
#endif
@ -2163,7 +2163,7 @@ void OS_X11::process_xevents() {
}
}
input->parse_input_event(mb);
input->accumulate_input_event(mb);
} break;
case MotionNotify: {
@ -2273,7 +2273,7 @@ void OS_X11::process_xevents() {
// this is so that the relative motion doesn't get messed up
// after we regain focus.
if (window_has_focus || !mouse_mode_grab)
input->parse_input_event(mm);
input->accumulate_input_event(mm);
} break;
case KeyPress:
@ -2457,6 +2457,8 @@ void OS_X11::process_xevents() {
printf("Win: %d,%d\n", win_x, win_y);
*/
}
input->flush_accumulated_events();
}
MainLoop *OS_X11::get_main_loop() const {