summaryrefslogtreecommitdiff
path: root/platform/osx
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/osx
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/osx')
-rw-r--r--platform/osx/display_server_osx.h2
-rw-r--r--platform/osx/display_server_osx.mm32
-rw-r--r--platform/osx/joypad_osx.cpp26
-rw-r--r--platform/osx/joypad_osx.h6
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm2
6 files changed, 35 insertions, 35 deletions
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() {