summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-03-27 08:52:58 +0200
committerGitHub <noreply@github.com>2017-03-27 08:52:58 +0200
commit9d28a5e7d99e3f089e11a929829443d0a922d030 (patch)
tree54ac80623482ce2c6d2cce11d251f9de825c1185 /platform/windows
parentfbebd32b5f47b0f8c357bbda3f657c58cdf3e3da (diff)
parentc0b67568757ccc22811e16348713ef3119e18f3e (diff)
Merge pull request #8159 from Hinsbart/last_id
Input: Remove usage of platform dependent event IDs.
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/joypad.cpp30
-rw-r--r--platform/windows/joypad.h4
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h1
4 files changed, 18 insertions, 27 deletions
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index 2472940ef3..86f7033d40 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -319,7 +319,7 @@ void JoypadWindows::probe_joypads() {
}
}
-unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
+void JoypadWindows::process_joypads() {
HRESULT hr;
@@ -337,16 +337,16 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
int button_mask = XINPUT_GAMEPAD_DPAD_UP;
for (int i = 0; i <= 16; i++) {
- p_last_id = input->joy_button(p_last_id, joy.id, i, joy.state.Gamepad.wButtons & button_mask);
+ input->joy_button(joy.id, i, joy.state.Gamepad.wButtons & button_mask);
button_mask = button_mask * 2;
}
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_0, axis_correct(joy.state.Gamepad.sThumbLX, true));
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_1, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_2, axis_correct(joy.state.Gamepad.sThumbRX, true));
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_3, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_4, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
- p_last_id = input->joy_axis(p_last_id, joy.id, JOY_AXIS_5, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
+ input->joy_axis(joy.id, JOY_AXIS_0, axis_correct(joy.state.Gamepad.sThumbLX, true));
+ input->joy_axis(joy.id, JOY_AXIS_1, axis_correct(joy.state.Gamepad.sThumbLY, true, false, true));
+ input->joy_axis(joy.id, JOY_AXIS_2, axis_correct(joy.state.Gamepad.sThumbRX, true));
+ input->joy_axis(joy.id, JOY_AXIS_3, axis_correct(joy.state.Gamepad.sThumbRY, true, false, true));
+ input->joy_axis(joy.id, JOY_AXIS_4, axis_correct(joy.state.Gamepad.bLeftTrigger, true, true));
+ input->joy_axis(joy.id, JOY_AXIS_5, axis_correct(joy.state.Gamepad.bRightTrigger, true, true));
joy.last_packet = joy.state.dwPacketNumber;
}
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
@@ -384,7 +384,7 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
continue;
}
- p_last_id = post_hat(p_last_id, joy->id, js.rgdwPOV[0]);
+ post_hat(joy->id, js.rgdwPOV[0]);
for (int j = 0; j < 128; j++) {
@@ -392,14 +392,14 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
if (!joy->last_buttons[j]) {
- p_last_id = input->joy_button(p_last_id, joy->id, j, true);
+ input->joy_button(joy->id, j, true);
joy->last_buttons[j] = true;
}
} else {
if (joy->last_buttons[j]) {
- p_last_id = input->joy_button(p_last_id, joy->id, j, false);
+ input->joy_button(joy->id, j, false);
joy->last_buttons[j] = false;
}
}
@@ -414,16 +414,16 @@ unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
for (int k = 0; k < count; k++) {
if (joy->joy_axis[j] == axes[k]) {
- p_last_id = input->joy_axis(p_last_id, joy->id, j, axis_correct(values[k]));
+ input->joy_axis(joy->id, j, axis_correct(values[k]));
break;
};
};
};
}
- return p_last_id;
+ return;
}
-unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
+void JoypadWindows::post_hat(int p_device, DWORD p_dpad) {
int dpad_val = 0;
@@ -462,7 +462,7 @@ unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD
dpad_val = (InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_UP);
}
- return input->joy_hat(p_last_id, p_device, dpad_val);
+ input->joy_hat(p_device, dpad_val);
};
InputDefault::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
diff --git a/platform/windows/joypad.h b/platform/windows/joypad.h
index 7e4f6ff328..9e6aa41a34 100644
--- a/platform/windows/joypad.h
+++ b/platform/windows/joypad.h
@@ -53,7 +53,7 @@ public:
~JoypadWindows();
void probe_joypads();
- unsigned int process_joypads(unsigned int p_last_id);
+ void process_joypads();
private:
enum {
@@ -130,7 +130,7 @@ private:
void load_xinput();
void unload_xinput();
- unsigned int post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad);
+ void post_hat(int p_device, DWORD p_dpad);
bool have_device(const GUID &p_guid);
bool is_xinput_device(const GUID *p_guid);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 2046ae9f44..f1a9ba5598 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -216,7 +216,6 @@ void OS_Windows::_touch_event(bool p_pressed, int p_x, int p_y, int idx) {
InputEvent event;
event.type = InputEvent::SCREEN_TOUCH;
- event.ID = ++last_id;
event.screen_touch.index = idx;
event.screen_touch.pressed = p_pressed;
@@ -233,7 +232,6 @@ void OS_Windows::_drag_event(int p_x, int p_y, int idx) {
InputEvent event;
event.type = InputEvent::SCREEN_DRAG;
- event.ID = ++last_id;
event.screen_drag.index = idx;
event.screen_drag.x = p_x;
@@ -370,7 +368,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
InputEvent event;
event.type = InputEvent::MOUSE_MOTION;
- event.ID = ++last_id;
InputEventMouseMotion &mm = event.mouse_motion;
mm.mod.control = (wParam & MK_CONTROL) != 0;
@@ -451,7 +448,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
InputEvent event;
event.type = InputEvent::MOUSE_BUTTON;
- event.ID = ++last_id;
InputEventMouseButton &mb = event.mouse_button;
switch (uMsg) {
@@ -582,7 +578,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (mb.pressed && mb.button_index > 3) {
//send release for mouse wheel
mb.pressed = false;
- event.ID = ++last_id;
input->parse_input_event(event);
}
}
@@ -780,7 +775,6 @@ void OS_Windows::process_key_events() {
if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
InputEvent event;
event.type = InputEvent::KEY;
- event.ID = ++last_id;
InputEventKey &k = event.key;
k.mod = ke.mod_state;
@@ -805,7 +799,6 @@ void OS_Windows::process_key_events() {
InputEvent event;
event.type = InputEvent::KEY;
- event.ID = ++last_id;
InputEventKey &k = event.key;
k.mod = ke.mod_state;
@@ -1819,7 +1812,7 @@ void OS_Windows::process_events() {
MSG msg;
- last_id = joypad->process_joypads(last_id);
+ joypad->process_joypads();
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
@@ -2303,7 +2296,6 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
hInstance = _hInstance;
pressrc = 0;
old_invalid = true;
- last_id = 0;
mouse_mode = MOUSE_MODE_VISIBLE;
#ifdef STDOUT_FILE
stdo = fopen("stdout.txt", "wb");
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e7376d6800..25c3102ee6 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -83,7 +83,6 @@ class OS_Windows : public OS {
bool outside;
int old_x, old_y;
Point2i center;
- unsigned int last_id;
#if defined(OPENGL_ENABLED)
ContextGL_Win *gl_context;
#endif