summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/input_event.cpp3
-rw-r--r--core/os/input_event.h3
-rw-r--r--core/os/main_loop.h28
-rw-r--r--core/os/midi_driver.cpp5
-rw-r--r--core/os/os.h2
5 files changed, 26 insertions, 15 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 40308f4f7d..25a5c2afeb 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -33,6 +33,9 @@
#include "core/input_map.h"
#include "core/os/keyboard.h"
+const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
+const int InputEvent::DEVICE_ID_INTERNAL = -2;
+
void InputEvent::set_device(int p_device) {
device = p_device;
}
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 47f9293a7f..ba01516519 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -165,6 +165,9 @@ protected:
static void _bind_methods();
public:
+ static const int DEVICE_ID_TOUCH_MOUSE;
+ static const int DEVICE_ID_INTERNAL;
+
void set_device(int p_device);
int get_device() const;
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index bfdf92acfa..ad734d3fc8 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -51,21 +51,19 @@ protected:
public:
enum {
- NOTIFICATION_WM_MOUSE_ENTER = 2,
- NOTIFICATION_WM_MOUSE_EXIT = 3,
- NOTIFICATION_WM_FOCUS_IN = 4,
- NOTIFICATION_WM_FOCUS_OUT = 5,
- NOTIFICATION_WM_QUIT_REQUEST = 6,
- NOTIFICATION_WM_GO_BACK_REQUEST = 7,
- NOTIFICATION_WM_UNFOCUS_REQUEST = 8,
- NOTIFICATION_OS_MEMORY_WARNING = 9,
- // Note: NOTIFICATION_TRANSLATION_CHANGED and NOTIFICATION_WM_ABOUT used to have id=10 and id=11 but these
- // conflict with NOTIFICATION_ENTER_TREE (id=10) and NOTIFICATION_EXIT_TREE (id=11), so id=90 and id=91
- // fixes this issue.
- NOTIFICATION_TRANSLATION_CHANGED = 90,
- NOTIFICATION_WM_ABOUT = 91,
- NOTIFICATION_CRASH = 92,
- NOTIFICATION_OS_IME_UPDATE = 93,
+ //make sure these are replicated in Node
+ NOTIFICATION_WM_MOUSE_ENTER = 1002,
+ NOTIFICATION_WM_MOUSE_EXIT = 1003,
+ NOTIFICATION_WM_FOCUS_IN = 1004,
+ NOTIFICATION_WM_FOCUS_OUT = 1005,
+ NOTIFICATION_WM_QUIT_REQUEST = 1006,
+ NOTIFICATION_WM_GO_BACK_REQUEST = 1007,
+ NOTIFICATION_WM_UNFOCUS_REQUEST = 1008,
+ NOTIFICATION_OS_MEMORY_WARNING = 1009,
+ NOTIFICATION_TRANSLATION_CHANGED = 1010,
+ NOTIFICATION_WM_ABOUT = 1011,
+ NOTIFICATION_CRASH = 1012,
+ NOTIFICATION_OS_IME_UPDATE = 1013,
};
virtual void input_event(const Ref<InputEvent> &p_event);
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index 0d7ad23d68..7cb7ae130f 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -75,6 +75,11 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
if (length >= 3) {
event->set_pitch(data[1]);
event->set_velocity(data[2]);
+
+ if (event->get_message() == MIDI_MESSAGE_NOTE_ON && event->get_velocity() == 0) {
+ // https://www.midi.org/forum/228-writing-midi-software-send-note-off,-or-zero-velocity-note-on
+ event->set_message(MIDI_MESSAGE_NOTE_OFF);
+ }
}
break;
diff --git a/core/os/os.h b/core/os/os.h
index ebfe7d20dc..d02d5a2c84 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -518,6 +518,8 @@ public:
bool is_restart_on_exit_set() const;
List<String> get_restart_on_exit_arguments() const;
+ virtual bool request_permission(const String &p_name) { return true; }
+
virtual void process_and_drop_events() {}
OS();
virtual ~OS();