Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'origin/Fix-Incorrect-De-macroization-2'

  • Loading branch information...
commit 63952b8fdc1fa66f033a7721f9f16d05a2c3938b 2 parents 735d217 + 298574b
Damian Kowalewski authored
Showing with 17 additions and 12 deletions.
  1. +17 −12 src/device/nyx_keys_impl.c
View
29 src/device/nyx_keys_impl.c
@@ -28,35 +28,40 @@
#include "nyx_keys_impl.h"
-static nyx_event_keys_t* _nyx_event_keys(nyx_event_handle_t handle)
-{
- nyx_event_t* e = (nyx_event_t*)handle;
- CHECK_EVENT(e);
- CHECK_EVENT_TYPE(e, NYX_EVENT_KEYS);
- return (nyx_event_keys_t*)e;
-}
-
+#define EVENT_HANDLE_TO_EVENT_KEYS(handle, event_keys) \
+ nyx_event_t* e = (nyx_event_t*)handle; \
+ CHECK_EVENT(e) \
+ CHECK_EVENT_TYPE(e, NYX_EVENT_KEYS) \
+ event_keys = (nyx_event_keys_t*) e
nyx_error_t nyx_keys_event_get_key(nyx_event_handle_t handle, int32_t* key_out_ptr)
{
- *key_out_ptr = _nyx_event_keys(handle)->key;
+ nyx_event_keys_t *keys_event;
+ EVENT_HANDLE_TO_EVENT_KEYS(handle, keys_event);
+ *key_out_ptr = keys_event->key;
return NYX_ERROR_NONE;
}
nyx_error_t nyx_keys_event_get_key_type(nyx_event_handle_t handle, nyx_key_type_t* key_type_out_ptr)
{
- *key_type_out_ptr = _nyx_event_keys(handle)->key_type;
+ nyx_event_keys_t *keys_event;
+ EVENT_HANDLE_TO_EVENT_KEYS(handle, keys_event);
+ *key_type_out_ptr = keys_event->key_type;
return NYX_ERROR_NONE;
}
nyx_error_t nyx_keys_event_get_key_is_press(nyx_event_handle_t handle, bool* key_is_press_out_ptr)
{
- *key_is_press_out_ptr = _nyx_event_keys(handle)->key_is_press;
+ nyx_event_keys_t *keys_event;
+ EVENT_HANDLE_TO_EVENT_KEYS(handle, keys_event);
+ *key_is_press_out_ptr = keys_event->key_is_press;
return NYX_ERROR_NONE;
}
nyx_error_t nyx_keys_event_get_key_is_auto_repeat(nyx_event_handle_t handle, bool* key_is_auto_repeat_out_ptr)
{
- *key_is_auto_repeat_out_ptr = _nyx_event_keys(handle)->key_is_auto_repeat;
+ nyx_event_keys_t *keys_event;
+ EVENT_HANDLE_TO_EVENT_KEYS(handle, keys_event);
+ *key_is_auto_repeat_out_ptr = keys_event->key_is_auto_repeat;
return NYX_ERROR_NONE;
}
Please sign in to comment.
Something went wrong with that request. Please try again.