summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:13 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:32 +0200
commitc0b67568757ccc22811e16348713ef3119e18f3e (patch)
treec2f13f324454478a76c623141611f79628d52ce6 /platform/x11
parenta0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (diff)
Input: Remove usage of platform dependent event IDs.
The ID property for InputEvents is set by `SceneTree` when sending the event down the tree. So there's no need for the platform specific code to set this value when it will later be overriden anyway...
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/joypad_linux.cpp15
-rw-r--r--platform/x11/joypad_linux.h2
-rw-r--r--platform/x11/os_x11.cpp7
-rw-r--r--platform/x11/os_x11.h1
4 files changed, 9 insertions, 16 deletions
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 62ece58f58..db4a501b4c 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -454,10 +454,10 @@ InputDefault::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int
return jx;
}
-uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
+void JoypadLinux::process_joypads() {
if (joy_mutex->try_lock() != OK) {
- return p_event_id;
+ return;
}
for (int i = 0; i < JOYPADS_MAX; i++) {
@@ -477,11 +477,11 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
// ev may be tainted and out of MAX_KEY range, which will cause
// joy->key_map[ev.code] to crash
if (ev.code < 0 || ev.code >= MAX_KEY)
- return p_event_id;
+ return;
switch (ev.type) {
case EV_KEY:
- p_event_id = input->joy_button(p_event_id, i, joy->key_map[ev.code], ev.value);
+ input->joy_button(i, joy->key_map[ev.code], ev.value);
break;
case EV_ABS:
@@ -496,7 +496,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
} else
joy->dpad &= ~(InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_RIGHT);
- p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
+ input->joy_hat(i, joy->dpad);
break;
case ABS_HAT0Y:
@@ -508,7 +508,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
} else
joy->dpad &= ~(InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_DOWN);
- p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
+ input->joy_hat(i, joy->dpad);
break;
default:
@@ -525,7 +525,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
for (int j = 0; j < MAX_ABS; j++) {
int index = joy->abs_map[j];
if (index != -1) {
- p_event_id = input->joy_axis(p_event_id, i, index, joy->curr_axis[index]);
+ input->joy_axis(i, index, joy->curr_axis[index]);
}
}
if (len == 0 || (len < 0 && errno != EAGAIN)) {
@@ -546,6 +546,5 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
}
}
joy_mutex->unlock();
- return p_event_id;
}
#endif
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index f90ca9319a..7b8ebf5bc3 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -42,7 +42,7 @@ class JoypadLinux {
public:
JoypadLinux(InputDefault *in);
~JoypadLinux();
- uint32_t process_joypads(uint32_t p_event_id);
+ void process_joypads();
private:
enum {
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index fe162370aa..6aeab21c7f 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -94,7 +94,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
last_button_state = 0;
xmbstring = NULL;
- event_id = 0;
x11_window = 0;
last_click_ms = 0;
args = OS::get_singleton()->get_cmdline_args();
@@ -1143,7 +1142,6 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
/* Phase 7, send event to Window */
InputEvent event;
- event.ID = ++event_id;
event.type = InputEvent::KEY;
event.device = 0;
event.key.mod = state;
@@ -1334,7 +1332,6 @@ void OS_X11::process_xevents() {
}
InputEvent mouse_event;
- mouse_event.ID = ++event_id;
mouse_event.type = InputEvent::MOUSE_BUTTON;
mouse_event.device = 0;
mouse_event.mouse_button.mod = get_key_modifier_state(event.xbutton.state);
@@ -1360,7 +1357,6 @@ void OS_X11::process_xevents() {
last_click_ms = 0;
last_click_pos = Point2(-100, -100);
mouse_event.mouse_button.doubleclick = true;
- mouse_event.ID = ++event_id;
} else {
last_click_ms += diff;
@@ -1447,7 +1443,6 @@ void OS_X11::process_xevents() {
Point2i rel = pos - last_mouse_pos;
InputEvent motion_event;
- motion_event.ID = ++event_id;
motion_event.type = InputEvent::MOUSE_MOTION;
motion_event.device = 0;
@@ -1916,7 +1911,7 @@ void OS_X11::run() {
process_xevents(); // get rid of pending events
#ifdef JOYDEV_ENABLED
- event_id = joypad->process_joypads(event_id);
+ joypad->process_joypads();
#endif
if (Main::iteration() == true)
break;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index cbda18c0bc..b5a74c68b8 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -116,7 +116,6 @@ class OS_X11 : public OS_Unix {
bool last_mouse_pos_valid;
Point2i last_click_pos;
uint64_t last_click_ms;
- unsigned int event_id;
uint32_t last_button_state;
PhysicsServer *physics_server;