diff options
Diffstat (limited to 'platform')
27 files changed, 141 insertions, 141 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 9534387d35..60d10b2457 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -424,7 +424,7 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis } #endif - InputFilter::get_singleton()->set_event_dispatch_function(_dispatch_input_events); + Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events); } DisplayServerAndroid::~DisplayServerAndroid() { @@ -445,16 +445,16 @@ DisplayServerAndroid::~DisplayServerAndroid() { void DisplayServerAndroid::process_joy_event(DisplayServerAndroid::JoypadEvent p_event) { switch (p_event.type) { case JOY_EVENT_BUTTON: - InputFilter::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed); + Input::get_singleton()->joy_button(p_event.device, p_event.index, p_event.pressed); break; case JOY_EVENT_AXIS: - InputFilter::JoyAxis value; + Input::JoyAxis value; value.min = -1; value.value = p_event.value; - InputFilter::get_singleton()->joy_axis(p_event.device, p_event.index, value); + Input::get_singleton()->joy_axis(p_event.device, p_event.index, value); break; case JOY_EVENT_HAT: - InputFilter::get_singleton()->joy_hat(p_event.device, p_event.hat); + Input::get_singleton()->joy_hat(p_event.device, p_event.hat); break; default: return; @@ -484,7 +484,7 @@ void DisplayServerAndroid::process_key_event(int p_keycode, int p_scancode, int OS_Android::get_singleton()->main_loop_request_go_back(); } - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); } void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector<DisplayServerAndroid::TouchPos> &p_points) { @@ -499,7 +499,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); } } @@ -517,7 +517,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(touch[i].id); ev->set_pressed(true); ev->set_position(touch[i].pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); } } break; @@ -545,7 +545,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(touch[i].id); ev->set_position(p_points[idx].pos); ev->set_relative(p_points[idx].pos - touch[i].pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); touch.write[i].pos = p_points[idx].pos; } @@ -560,7 +560,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); } touch.clear(); } @@ -577,7 +577,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(tp.id); ev->set_pressed(true); ev->set_position(tp.pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); break; } @@ -592,7 +592,7 @@ void DisplayServerAndroid::process_touch(int p_what, int p_pointer, const Vector ev->set_index(touch[i].id); ev->set_pressed(false); ev->set_position(touch[i].pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); touch.remove(i); break; @@ -613,7 +613,7 @@ void DisplayServerAndroid::process_hover(int p_type, Point2 p_pos) { ev->set_position(p_pos); ev->set_global_position(p_pos); ev->set_relative(p_pos - hover_prev_pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); hover_prev_pos = p_pos; } break; } @@ -626,7 +626,7 @@ void DisplayServerAndroid::process_double_tap(Point2 p_pos) { ev->set_global_position(p_pos); ev->set_pressed(false); ev->set_doubleclick(true); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); } void DisplayServerAndroid::process_scroll(Point2 p_pos) { @@ -634,22 +634,22 @@ void DisplayServerAndroid::process_scroll(Point2 p_pos) { ev.instance(); ev->set_position(p_pos); ev->set_delta(p_pos - scroll_prev_pos); - InputFilter::get_singleton()->parse_input_event(ev); + Input::get_singleton()->parse_input_event(ev); scroll_prev_pos = p_pos; } void DisplayServerAndroid::process_accelerometer(const Vector3 &p_accelerometer) { - InputFilter::get_singleton()->set_accelerometer(p_accelerometer); + Input::get_singleton()->set_accelerometer(p_accelerometer); } void DisplayServerAndroid::process_gravity(const Vector3 &p_gravity) { - InputFilter::get_singleton()->set_gravity(p_gravity); + Input::get_singleton()->set_gravity(p_gravity); } void DisplayServerAndroid::process_magnetometer(const Vector3 &p_magnetometer) { - InputFilter::get_singleton()->set_magnetometer(p_magnetometer); + Input::get_singleton()->set_magnetometer(p_magnetometer); } void DisplayServerAndroid::process_gyroscope(const Vector3 &p_gyroscope) { - InputFilter::get_singleton()->set_gyroscope(p_gyroscope); + Input::get_singleton()->set_gyroscope(p_gyroscope); } diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 8b38113e09..a6730903cc 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -38,7 +38,7 @@ #include "api/jni_singleton.h" #include "audio_driver_jandroid.h" #include "core/engine.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/project_settings.h" #include "dir_access_jandroid.h" #include "display_server_android.h" @@ -311,15 +311,15 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j int hat = 0; if (p_hat_x != 0) { if (p_hat_x < 0) - hat |= InputFilter::HAT_MASK_LEFT; + hat |= Input::HAT_MASK_LEFT; else - hat |= InputFilter::HAT_MASK_RIGHT; + hat |= Input::HAT_MASK_RIGHT; } if (p_hat_y != 0) { if (p_hat_y < 0) - hat |= InputFilter::HAT_MASK_UP; + hat |= Input::HAT_MASK_UP; else - hat |= InputFilter::HAT_MASK_DOWN; + hat |= Input::HAT_MASK_DOWN; } jevent.hat = hat; @@ -329,7 +329,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name) { if (os_android) { String name = jstring_to_string(p_name, env); - InputFilter::get_singleton()->joy_connection_changed(p_device, p_connected, name); + Input::get_singleton()->joy_connection_changed(p_device, p_connected, name); } } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 760157595c..9ae18415ba 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -88,7 +88,7 @@ void OS_Android::initialize() { } void OS_Android::initialize_joypads() { - InputFilter::get_singleton()->set_fallback_mapping(godot_java->get_input_fallback_mapping()); + Input::get_singleton()->set_fallback_mapping(godot_java->get_input_fallback_mapping()); // This queries/updates the currently connected devices/joypads. godot_java->init_input_devices(); diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 925bb9ac5d..4817abbb7a 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -35,7 +35,7 @@ #include <DirectWindow.h> -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/os/os.h" #include "haiku_gl_view.h" diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index 64f5690dd1..d3ef9400d4 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -33,7 +33,7 @@ #include "audio_driver_media_kit.h" #include "context_gl_haiku.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "drivers/unix/os_unix.h" #include "haiku_application.h" #include "haiku_direct_window.h" diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 96cf041c37..eb94e1d69b 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -33,7 +33,7 @@ #ifndef OS_IPHONE_H #define OS_IPHONE_H -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/unix/os_unix.h" #include "game_center.h" diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 81fe4cf0cc..feb0f0651a 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -32,7 +32,7 @@ #define OS_JAVASCRIPT_H #include "audio_driver_javascript.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "drivers/unix/os_unix.h" #include "servers/audio_server.h" #include "servers/rendering/rasterizer.h" diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 78ddef5ff6..22790a3fe5 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -208,7 +208,7 @@ void DisplayServerX11::_update_real_mouse_position(const WindowData &wd) { last_mouse_pos.x = win_x; last_mouse_pos.y = win_y; last_mouse_pos_valid = true; - InputFilter::get_singleton()->set_mouse_position(last_mouse_pos); + Input::get_singleton()->set_mouse_position(last_mouse_pos); } } } @@ -392,7 +392,7 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) { XWarpPointer(x11_display, None, main_window.x11_window, 0, 0, 0, 0, (int)center.x, (int)center.y); - InputFilter::get_singleton()->set_mouse_position(center); + Input::get_singleton()->set_mouse_position(center); } } else { do_mouse_warp = false; @@ -2077,7 +2077,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, k->set_shift(true); } - InputFilter::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->accumulate_input_event(k); } memfree(utf8string); return; @@ -2220,14 +2220,14 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, k->set_metakey(false); } - bool last_is_pressed = InputFilter::get_singleton()->is_key_pressed(k->get_keycode()); + bool last_is_pressed = Input::get_singleton()->is_key_pressed(k->get_keycode()); if (k->is_pressed()) { if (last_is_pressed) { k->set_echo(true); } } - InputFilter::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->accumulate_input_event(k); } void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data, @@ -2486,12 +2486,12 @@ void DisplayServerX11::process_events() { // 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; } - InputFilter::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->accumulate_input_event(st); } else { if (!xi.state.has(index)) // Defensive break; xi.state.erase(index); - InputFilter::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->accumulate_input_event(st); } } break; @@ -2510,7 +2510,7 @@ void DisplayServerX11::process_events() { sd->set_index(index); sd->set_position(pos); sd->set_relative(pos - curr_pos_elem->value()); - InputFilter::get_singleton()->accumulate_input_event(sd); + Input::get_singleton()->accumulate_input_event(sd); curr_pos_elem->value() = pos; } @@ -2580,7 +2580,7 @@ void DisplayServerX11::process_events() { case FocusOut: window_has_focus = false; - InputFilter::get_singleton()->release_pressed_events(); + Input::get_singleton()->release_pressed_events(); _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_OUT); window_focused = false; @@ -2609,7 +2609,7 @@ void DisplayServerX11::process_events() { st->set_index(E->key()); st->set_window_id(window_id); st->set_position(E->get()); - InputFilter::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->accumulate_input_event(st); } xi.state.clear(); #endif @@ -2671,7 +2671,7 @@ void DisplayServerX11::process_events() { } } - InputFilter::get_singleton()->accumulate_input_event(mb); + Input::get_singleton()->accumulate_input_event(mb); } break; case MotionNotify: { @@ -2773,8 +2773,8 @@ void DisplayServerX11::process_events() { mm->set_button_mask(mouse_get_button_state()); mm->set_position(posi); mm->set_global_position(posi); - InputFilter::get_singleton()->set_mouse_position(posi); - mm->set_speed(InputFilter::get_singleton()->get_last_mouse_speed()); + Input::get_singleton()->set_mouse_position(posi); + mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); mm->set_relative(rel); @@ -2785,7 +2785,7 @@ void DisplayServerX11::process_events() { // this is so that the relative motion doesn't get messed up // after we regain focus. if (window_has_focus || !mouse_mode_grab) - InputFilter::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->accumulate_input_event(mm); } break; case KeyPress: @@ -2978,7 +2978,7 @@ void DisplayServerX11::process_events() { */ } - InputFilter::get_singleton()->flush_accumulated_events(); + Input::get_singleton()->flush_accumulated_events(); } void DisplayServerX11::release_rendering_thread() { @@ -3373,7 +3373,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) { - InputFilter::get_singleton()->set_event_dispatch_function(_dispatch_input_events); + Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events); r_error = OK; diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index 113e504e9b..8f090d3fad 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -35,7 +35,7 @@ #include "servers/display_server.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/alsamidi/midi_driver_alsamidi.h" diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 381eb909ba..5ceea788e0 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -71,7 +71,7 @@ void JoypadLinux::Joypad::reset() { dpad = 0; fd = -1; - InputFilter::JoyAxis jx; + Input::JoyAxis jx; jx.min = -1; jx.value = 0.0f; for (int i = 0; i < MAX_ABS; i++) { @@ -80,7 +80,7 @@ void JoypadLinux::Joypad::reset() { } } -JoypadLinux::JoypadLinux(InputFilter *in) { +JoypadLinux::JoypadLinux(Input *in) { exit_udev = false; input = in; joy_thread = Thread::create(joy_thread_func, this); @@ -436,11 +436,11 @@ void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp) { joy.ff_effect_timestamp = p_timestamp; } -InputFilter::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const { +Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const { int min = p_abs->minimum; int max = p_abs->maximum; - InputFilter::JoyAxis jx; + Input::JoyAxis jx; if (min < 0) { jx.min = -1; @@ -492,11 +492,11 @@ void JoypadLinux::process_joypads() { case ABS_HAT0X: if (ev.value != 0) { if (ev.value < 0) - joy->dpad |= InputFilter::HAT_MASK_LEFT; + joy->dpad |= Input::HAT_MASK_LEFT; else - joy->dpad |= InputFilter::HAT_MASK_RIGHT; + joy->dpad |= Input::HAT_MASK_RIGHT; } else - joy->dpad &= ~(InputFilter::HAT_MASK_LEFT | InputFilter::HAT_MASK_RIGHT); + joy->dpad &= ~(Input::HAT_MASK_LEFT | Input::HAT_MASK_RIGHT); input->joy_hat(i, joy->dpad); break; @@ -504,11 +504,11 @@ void JoypadLinux::process_joypads() { case ABS_HAT0Y: if (ev.value != 0) { if (ev.value < 0) - joy->dpad |= InputFilter::HAT_MASK_UP; + joy->dpad |= Input::HAT_MASK_UP; else - joy->dpad |= InputFilter::HAT_MASK_DOWN; + joy->dpad |= Input::HAT_MASK_DOWN; } else - joy->dpad &= ~(InputFilter::HAT_MASK_UP | InputFilter::HAT_MASK_DOWN); + joy->dpad &= ~(Input::HAT_MASK_UP | Input::HAT_MASK_DOWN); input->joy_hat(i, joy->dpad); break; @@ -517,7 +517,7 @@ void JoypadLinux::process_joypads() { if (ev.code >= MAX_ABS) return; if (joy->abs_map[ev.code] != -1 && joy->abs_info[ev.code]) { - InputFilter::JoyAxis value = axis_correct(joy->abs_info[ev.code], ev.value); + Input::JoyAxis value = axis_correct(joy->abs_info[ev.code], ev.value); joy->curr_axis[joy->abs_map[ev.code]] = value; } break; diff --git a/platform/linuxbsd/joypad_linux.h b/platform/linuxbsd/joypad_linux.h index 1d2ed5bbc1..0d175193a5 100644 --- a/platform/linuxbsd/joypad_linux.h +++ b/platform/linuxbsd/joypad_linux.h @@ -33,7 +33,7 @@ #define JOYPAD_LINUX_H #ifdef JOYDEV_ENABLED -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/os/mutex.h" #include "core/os/thread.h" @@ -41,7 +41,7 @@ struct input_absinfo; class JoypadLinux { public: - JoypadLinux(InputFilter *in); + JoypadLinux(Input *in); ~JoypadLinux(); void process_joypads(); @@ -53,7 +53,7 @@ private: }; struct Joypad { - InputFilter::JoyAxis curr_axis[MAX_ABS]; + Input::JoyAxis curr_axis[MAX_ABS]; int key_map[MAX_KEY]; int abs_map[MAX_ABS]; int dpad; @@ -74,7 +74,7 @@ private: bool exit_udev; Mutex joy_mutex; Thread *joy_thread; - InputFilter *input; + Input *input; Joypad joypads[JOYPADS_MAX]; Vector<String> attached_devices; @@ -95,7 +95,7 @@ private: void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop(int p_id, uint64_t p_timestamp); - InputFilter::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const; + Input::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const; }; #endif diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 5b9a25bd8b..7b76f7394b 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -64,7 +64,7 @@ void OS_LinuxBSD::initialize() { void OS_LinuxBSD::initialize_joypads() { #ifdef JOYDEV_ENABLED - joypad = memnew(JoypadLinux(InputFilter::get_singleton())); + joypad = memnew(JoypadLinux(Input::get_singleton())); #endif } diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index 100cb53ba3..391f29e8a3 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -31,7 +31,7 @@ #ifndef OS_LINUXBSD_H #define OS_LINUXBSD_H -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "crash_handler_linuxbsd.h" #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/alsamidi/midi_driver_alsamidi.h" diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h index 86ceb51763..8133dfe2c4 100644 --- a/platform/osx/display_server_osx.h +++ b/platform/osx/display_server_osx.h @@ -33,7 +33,7 @@ #define BitMap _QDBitMap // Suppress deprecated QuickDraw definition. -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "servers/display_server.h" #if defined(OPENGL_ENABLED) diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index fd14ec1f1d..a44bfef94c 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -74,7 +74,7 @@ static Vector2i _get_mouse_pos(DisplayServerOSX::WindowData &p_wd, NSPoint p_loc p_wd.mouse_pos.x = p.x * p_backingScaleFactor; p_wd.mouse_pos.y = (contentRect.size.height - p.y) * p_backingScaleFactor; DS_OSX->last_mouse_pos = p_wd.mouse_pos; - InputFilter::get_singleton()->set_mouse_position(p_wd.mouse_pos); + Input::get_singleton()->set_mouse_position(p_wd.mouse_pos); return p_wd.mouse_pos; } @@ -124,7 +124,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { k->set_physical_keycode(KEY_PERIOD); k->set_echo([event isARepeat]); - InputFilter::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->accumulate_input_event(k); } } @@ -433,7 +433,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { const CGFloat backingScaleFactor = (OS::get_singleton()->is_hidpi_allowed()) ? [wd.window_view backingScaleFactor] : 1.0; _get_mouse_pos(wd, [wd.window_object mouseLocationOutsideOfEventStream], backingScaleFactor); - InputFilter::get_singleton()->set_mouse_position(wd.mouse_pos); + Input::get_singleton()->set_mouse_position(wd.mouse_pos); DS_OSX->window_focused = true; DS_OSX->_send_window_event(wd, DisplayServerOSX::WINDOW_EVENT_FOCUS_IN); @@ -759,7 +759,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i mb->set_doubleclick([event clickCount] == 2); } - InputFilter::get_singleton()->accumulate_input_event(mb); + Input::get_singleton()->accumulate_input_event(mb); } - (void)mouseDown:(NSEvent *)event { @@ -808,15 +808,15 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i mm->set_tilt(Vector2(p.x, p.y)); } mm->set_global_position(pos); - mm->set_speed(InputFilter::get_singleton()->get_last_mouse_speed()); + mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); Vector2i relativeMotion = Vector2i(); relativeMotion.x = [event deltaX] * backingScaleFactor; relativeMotion.y = [event deltaY] * backingScaleFactor; mm->set_relative(relativeMotion); _get_key_modifier_state([event modifierFlags], mm); - InputFilter::get_singleton()->set_mouse_position(wd.mouse_pos); - InputFilter::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->set_mouse_position(wd.mouse_pos); + Input::get_singleton()->accumulate_input_event(mm); } - (void)rightMouseDown:(NSEvent *)event { @@ -891,7 +891,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i ev->set_position(_get_mouse_pos(wd, [event locationInWindow], backingScaleFactor)); ev->set_factor([event magnification] + 1.0); - InputFilter::get_singleton()->accumulate_input_event(ev); + Input::get_singleton()->accumulate_input_event(ev); } - (void)viewDidChangeBackingProperties { @@ -1357,7 +1357,7 @@ inline void sendScrollEvent(DisplayServer::WindowID window_id, int button, doubl DS_OSX->last_button_state |= mask; sc->set_button_mask(DS_OSX->last_button_state); - InputFilter::get_singleton()->accumulate_input_event(sc); + Input::get_singleton()->accumulate_input_event(sc); sc.instance(); sc->set_window_id(window_id); @@ -1369,7 +1369,7 @@ inline void sendScrollEvent(DisplayServer::WindowID window_id, int button, doubl DS_OSX->last_button_state &= ~mask; sc->set_button_mask(DS_OSX->last_button_state); - InputFilter::get_singleton()->accumulate_input_event(sc); + Input::get_singleton()->accumulate_input_event(sc); } inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy, int modifierFlags) { @@ -1384,7 +1384,7 @@ inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy pg->set_position(wd.mouse_pos); pg->set_delta(Vector2(-dx, -dy)); - InputFilter::get_singleton()->accumulate_input_event(pg); + Input::get_singleton()->accumulate_input_event(pg); } - (void)scrollWheel:(NSEvent *)event { @@ -3006,13 +3006,13 @@ DisplayServerOSX::LatinKeyboardVariant DisplayServerOSX::get_latin_keyboard_vari void DisplayServerOSX::_push_input(const Ref<InputEvent> &p_event) { Ref<InputEvent> ev = p_event; - InputFilter::get_singleton()->accumulate_input_event(ev); + Input::get_singleton()->accumulate_input_event(ev); } void DisplayServerOSX::_release_pressed_events() { _THREAD_SAFE_METHOD_ - if (InputFilter::get_singleton()) { - InputFilter::get_singleton()->release_pressed_events(); + if (Input::get_singleton()) { + Input::get_singleton()->release_pressed_events(); } } @@ -3088,7 +3088,7 @@ void DisplayServerOSX::process_events() { if (!drop_events) { _process_key_events(); - InputFilter::get_singleton()->flush_accumulated_events(); + Input::get_singleton()->flush_accumulated_events(); } [autoreleasePool drain]; @@ -3397,7 +3397,7 @@ bool DisplayServerOSX::is_console_visible() const { } DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) { - InputFilter::get_singleton()->set_event_dispatch_function(_dispatch_input_events); + Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events); r_error = OK; drop_events = false; diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 643acd8944..7f5ec05967 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -395,38 +395,38 @@ bool joypad::check_ff_features() { static int process_hat_value(int p_min, int p_max, int p_value) { int range = (p_max - p_min + 1); int value = p_value - p_min; - int hat_value = InputFilter::HAT_MASK_CENTER; + int hat_value = Input::HAT_MASK_CENTER; if (range == 4) { value *= 2; } switch (value) { case 0: - hat_value = InputFilter::HAT_MASK_UP; + hat_value = Input::HAT_MASK_UP; break; case 1: - hat_value = InputFilter::HAT_MASK_UP | InputFilter::HAT_MASK_RIGHT; + hat_value = Input::HAT_MASK_UP | Input::HAT_MASK_RIGHT; break; case 2: - hat_value = InputFilter::HAT_MASK_RIGHT; + hat_value = Input::HAT_MASK_RIGHT; break; case 3: - hat_value = InputFilter::HAT_MASK_DOWN | InputFilter::HAT_MASK_RIGHT; + hat_value = Input::HAT_MASK_DOWN | Input::HAT_MASK_RIGHT; break; case 4: - hat_value = InputFilter::HAT_MASK_DOWN; + hat_value = Input::HAT_MASK_DOWN; break; case 5: - hat_value = InputFilter::HAT_MASK_DOWN | InputFilter::HAT_MASK_LEFT; + hat_value = Input::HAT_MASK_DOWN | Input::HAT_MASK_LEFT; break; case 6: - hat_value = InputFilter::HAT_MASK_LEFT; + hat_value = Input::HAT_MASK_LEFT; break; case 7: - hat_value = InputFilter::HAT_MASK_UP | InputFilter::HAT_MASK_LEFT; + hat_value = Input::HAT_MASK_UP | Input::HAT_MASK_LEFT; break; default: - hat_value = InputFilter::HAT_MASK_CENTER; + hat_value = Input::HAT_MASK_CENTER; break; } return hat_value; @@ -438,8 +438,8 @@ void JoypadOSX::poll_joypads() const { } } -static const InputFilter::JoyAxis axis_correct(int p_value, int p_min, int p_max) { - InputFilter::JoyAxis jx; +static const Input::JoyAxis axis_correct(int p_value, int p_min, int p_max) { + Input::JoyAxis jx; if (p_min < 0) { jx.min = -1; if (p_value < 0) { @@ -571,7 +571,7 @@ void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const { } } -JoypadOSX::JoypadOSX(InputFilter *in) { +JoypadOSX::JoypadOSX(Input *in) { self = this; input = in; diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index 62027c6a30..fc176b0990 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -40,7 +40,7 @@ #include <ForceFeedback/ForceFeedbackConstants.h> #include <IOKit/hid/IOHIDLib.h> -#include "core/input/input_filter.h" +#include "core/input/input.h" struct rec_element { IOHIDElementRef ref; @@ -94,7 +94,7 @@ class JoypadOSX { }; private: - InputFilter *input; + Input *input; IOHIDManagerRef hid_manager; Vector<joypad> device_list; @@ -118,7 +118,7 @@ public: void _device_added(IOReturn p_res, IOHIDDeviceRef p_device); void _device_removed(IOReturn p_res, IOHIDDeviceRef p_device); - JoypadOSX(InputFilter *in); + JoypadOSX(Input *in); ~JoypadOSX(); }; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index d2c67cff9f..9204a145bf 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -31,7 +31,7 @@ #ifndef OS_OSX_H #define OS_OSX_H -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "crash_handler_osx.h" #include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/coremidi/midi_driver_coremidi.h" diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index a1c4cf8270..f132ed9514 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -128,7 +128,7 @@ void OS_OSX::initialize_core() { } void OS_OSX::initialize_joypads() { - joypad_osx = memnew(JoypadOSX(InputFilter::get_singleton())); + joypad_osx = memnew(JoypadOSX(Input::get_singleton())); } void OS_OSX::initialize() { diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 62028b26e4..b273e8d4e4 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -31,7 +31,7 @@ #ifndef OS_SERVER_H #define OS_SERVER_H -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "drivers/dummy/texture_loader_dummy.h" #include "drivers/unix/os_unix.h" #ifdef __APPLE__ diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 054b67ddc8..69431052e5 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -31,7 +31,7 @@ #ifndef JOYPAD_UWP_H #define JOYPAD_UWP_H -#include "core/input/input_filter.h" +#include "core/input/input.h" ref class JoypadUWP sealed { diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index ad0efa1d03..2233f6a413 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -32,7 +32,7 @@ #define OS_UWP_H #include "context_egl_uwp.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/math/transform_2d.h" #include "core/os/os.h" #include "core/ustring.h" diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index ebe9a7d27a..4d4273a073 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -666,7 +666,7 @@ void DisplayServerWindows::_update_real_mouse_position(WindowID p_window) { old_x = mouse_pos.x; old_y = mouse_pos.y; old_invalid = false; - InputFilter::get_singleton()->set_mouse_position(Point2i(mouse_pos.x, mouse_pos.y)); + Input::get_singleton()->set_mouse_position(Point2i(mouse_pos.x, mouse_pos.y)); } } } @@ -1511,7 +1511,7 @@ void DisplayServerWindows::process_events() { if (!drop_events) { _process_key_events(); - InputFilter::get_singleton()->flush_accumulated_events(); + Input::get_singleton()->flush_accumulated_events(); } } @@ -1715,7 +1715,7 @@ void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float event->set_pressed(p_pressed); event->set_position(Vector2(p_x, p_y)); - InputFilter::get_singleton()->accumulate_input_event(event); + Input::get_singleton()->accumulate_input_event(event); } void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, int idx) { @@ -1735,7 +1735,7 @@ void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, event->set_position(Vector2(p_x, p_y)); event->set_relative(Vector2(p_x, p_y) - curr->get()); - InputFilter::get_singleton()->accumulate_input_event(event); + Input::get_singleton()->accumulate_input_event(event); curr->get() = Vector2(p_x, p_y); } @@ -1843,7 +1843,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA control_mem = false; shift_mem = false; } else { // WM_INACTIVE - InputFilter::get_singleton()->release_pressed_events(); + Input::get_singleton()->release_pressed_events(); _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_OUT); windows[window_id].window_focused = false; alt_mem = false; @@ -1940,7 +1940,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA mm->set_position(c); mm->set_global_position(c); - InputFilter::get_singleton()->set_mouse_position(c); + Input::get_singleton()->set_mouse_position(c); mm->set_speed(Vector2(0, 0)); if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) { @@ -1973,7 +1973,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } if (windows[window_id].window_has_focus && mm->get_relative() != Vector2()) - InputFilter::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->accumulate_input_event(mm); } delete[] lpb; } break; @@ -2001,7 +2001,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA break; } - if (InputFilter::get_singleton()->is_emulating_mouse_from_touch()) { + if (Input::get_singleton()->is_emulating_mouse_from_touch()) { // Universal translation enabled; ignore OS translation LPARAM extra = GetMessageExtraInfo(); if (IsTouchEvent(extra)) { @@ -2074,8 +2074,8 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA SetCursorPos(pos.x, pos.y); } - InputFilter::get_singleton()->set_mouse_position(mm->get_position()); - mm->set_speed(InputFilter::get_singleton()->get_last_mouse_speed()); + Input::get_singleton()->set_mouse_position(mm->get_position()); + mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); if (old_invalid) { @@ -2088,7 +2088,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA old_x = mm->get_position().x; old_y = mm->get_position().y; if (windows[window_id].window_has_focus) { - InputFilter::get_singleton()->parse_input_event(mm); + Input::get_singleton()->parse_input_event(mm); } return 0; //Pointer event handled return 0 to avoid duplicate WM_MOUSEMOVE event @@ -2098,7 +2098,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA break; } - if (InputFilter::get_singleton()->is_emulating_mouse_from_touch()) { + if (Input::get_singleton()->is_emulating_mouse_from_touch()) { // Universal translation enabled; ignore OS translation LPARAM extra = GetMessageExtraInfo(); if (IsTouchEvent(extra)) { @@ -2161,8 +2161,8 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA SetCursorPos(pos.x, pos.y); } - InputFilter::get_singleton()->set_mouse_position(mm->get_position()); - mm->set_speed(InputFilter::get_singleton()->get_last_mouse_speed()); + Input::get_singleton()->set_mouse_position(mm->get_position()); + mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); if (old_invalid) { @@ -2175,12 +2175,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA old_x = mm->get_position().x; old_y = mm->get_position().y; if (windows[window_id].window_has_focus) - InputFilter::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->accumulate_input_event(mm); } break; case WM_LBUTTONDOWN: case WM_LBUTTONUP: - if (InputFilter::get_singleton()->is_emulating_mouse_from_touch()) { + if (Input::get_singleton()->is_emulating_mouse_from_touch()) { // Universal translation enabled; ignore OS translations for left button LPARAM extra = GetMessageExtraInfo(); if (IsTouchEvent(extra)) { @@ -2347,7 +2347,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA mb->set_global_position(mb->get_position()); - InputFilter::get_singleton()->accumulate_input_event(mb); + Input::get_singleton()->accumulate_input_event(mb); if (mb->is_pressed() && mb->get_button_index() > 3 && mb->get_button_index() < 8) { //send release for mouse wheel Ref<InputEventMouseButton> mbd = mb->duplicate(); @@ -2355,7 +2355,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA last_button_state &= ~(1 << (mbd->get_button_index() - 1)); mbd->set_button_mask(last_button_state); mbd->set_pressed(false); - InputFilter::get_singleton()->accumulate_input_event(mbd); + Input::get_singleton()->accumulate_input_event(mbd); } } break; @@ -2444,7 +2444,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } break; case WM_ENTERSIZEMOVE: { - InputFilter::get_singleton()->release_pressed_events(); + Input::get_singleton()->release_pressed_events(); move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr); } break; case WM_EXITSIZEMOVE: { @@ -2652,7 +2652,7 @@ void DisplayServerWindows::_process_key_events() { if (k->get_unicode() < 32) k->set_unicode(0); - InputFilter::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->accumulate_input_event(k); } //do nothing @@ -2693,7 +2693,7 @@ void DisplayServerWindows::_process_key_events() { k->set_echo((ke.uMsg == WM_KEYDOWN && (ke.lParam & (1 << 30)))); - InputFilter::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->accumulate_input_event(k); } break; } @@ -2945,7 +2945,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win r_error = OK; ((OS_Windows *)OS::get_singleton())->set_main_window(windows[MAIN_WINDOW_ID].hWnd); - InputFilter::get_singleton()->set_event_dispatch_function(_dispatch_input_events); + Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events); } Vector<String> DisplayServerWindows::get_rendering_drivers_func() { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index 5cd240ffb0..6243f54cfa 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -33,7 +33,7 @@ #include "servers/display_server.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/os/os.h" #include "core/project_settings.h" #include "crash_handler_windows.h" diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 437c3b733d..2adf2a8652 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -54,7 +54,7 @@ JoypadWindows::JoypadWindows() { JoypadWindows::JoypadWindows(HWND *hwnd) { - input = InputFilter::get_singleton(); + input = Input::get_singleton(); hWnd = hwnd; joypad_count = 0; dinput = nullptr; @@ -436,46 +436,46 @@ void JoypadWindows::post_hat(int p_device, DWORD p_dpad) { // BOOL POVCentered = (LOWORD(dwPOV) == 0xFFFF);" // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee416628(v%3Dvs.85)#remarks if (LOWORD(p_dpad) == 0xFFFF) { - dpad_val = InputFilter::HAT_MASK_CENTER; + dpad_val = Input::HAT_MASK_CENTER; } if (p_dpad == 0) { - dpad_val = InputFilter::HAT_MASK_UP; + dpad_val = Input::HAT_MASK_UP; } else if (p_dpad == 4500) { - dpad_val = (InputFilter::HAT_MASK_UP | InputFilter::HAT_MASK_RIGHT); + dpad_val = (Input::HAT_MASK_UP | Input::HAT_MASK_RIGHT); } else if (p_dpad == 9000) { - dpad_val = InputFilter::HAT_MASK_RIGHT; + dpad_val = Input::HAT_MASK_RIGHT; } else if (p_dpad == 13500) { - dpad_val = (InputFilter::HAT_MASK_RIGHT | InputFilter::HAT_MASK_DOWN); + dpad_val = (Input::HAT_MASK_RIGHT | Input::HAT_MASK_DOWN); } else if (p_dpad == 18000) { - dpad_val = InputFilter::HAT_MASK_DOWN; + dpad_val = Input::HAT_MASK_DOWN; } else if (p_dpad == 22500) { - dpad_val = (InputFilter::HAT_MASK_DOWN | InputFilter::HAT_MASK_LEFT); + dpad_val = (Input::HAT_MASK_DOWN | Input::HAT_MASK_LEFT); } else if (p_dpad == 27000) { - dpad_val = InputFilter::HAT_MASK_LEFT; + dpad_val = Input::HAT_MASK_LEFT; } else if (p_dpad == 31500) { - dpad_val = (InputFilter::HAT_MASK_LEFT | InputFilter::HAT_MASK_UP); + dpad_val = (Input::HAT_MASK_LEFT | Input::HAT_MASK_UP); } input->joy_hat(p_device, dpad_val); }; -InputFilter::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const { +Input::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const { - InputFilter::JoyAxis jx; + Input::JoyAxis jx; if (Math::abs(p_val) < MIN_JOY_AXIS) { jx.min = p_trigger ? 0 : -1; jx.value = 0.0f; diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h index 0db789c335..fefdcf1673 100644 --- a/platform/windows/joypad_windows.h +++ b/platform/windows/joypad_windows.h @@ -117,7 +117,7 @@ private: HWND *hWnd; HANDLE xinput_dll; LPDIRECTINPUT8 dinput; - InputFilter *input; + Input *input; int id_to_change; int joypad_count; @@ -141,7 +141,7 @@ private: void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp); - InputFilter::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const; + Input::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const; XInputGetState_t xinput_get_state; XInputSetState_t xinput_set_state; }; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6bdfc75ebb..7226109e57 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -31,7 +31,7 @@ #ifndef OS_WINDOWS_H #define OS_WINDOWS_H -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/os/os.h" #include "core/project_settings.h" #include "crash_handler_windows.h" |