summaryrefslogtreecommitdiff
path: root/platform/linuxbsd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-04-28 15:19:37 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-04-28 15:19:49 +0200
commitfdf58a585839804c89798392dd93025dbe8654e4 (patch)
tree7e5fa3980a90d34d2f89f2b6c9adc392e890eeb6 /platform/linuxbsd
parent39f7a4092533a600eeada6638016af8bd4bd2271 (diff)
Rename InputFilter back to Input
It changed name as part of the DisplayServer and input refactoring in #37317, with the rationale that input no longer goes through the main loop, so the previous Input singleton now only does filtering. But the gains in consistency are quite limited in the renaming, and it breaks compatibility for all scripts and tutorials that access the Input singleton via the scripting language. A temporary option was suggested to keep the scripting singleton named `Input` even if its type is `InputFilter`, but that adds inconsistency and breaks C#. Fixes godotengine/godot-proposals#639. Fixes #37319. Fixes #37690.
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp32
-rw-r--r--platform/linuxbsd/display_server_x11.h2
-rw-r--r--platform/linuxbsd/joypad_linux.cpp22
-rw-r--r--platform/linuxbsd/joypad_linux.h10
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp2
-rw-r--r--platform/linuxbsd/os_linuxbsd.h2
6 files changed, 35 insertions, 35 deletions
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"