diff --git a/src/buttonevent/macro_button_event_handler.hpp b/src/buttonevent/macro_button_event_handler.hpp index 2b12ba5..7c13913 100644 --- a/src/buttonevent/macro_button_event_handler.hpp +++ b/src/buttonevent/macro_button_event_handler.hpp @@ -25,26 +25,30 @@ class MacroButtonEventHandler : public ButtonEventHandler { public: private: + struct AbsInfo { + UIEvent event; + int minimum; + int maximum; + int fuzz; + int flat; + }; + + struct Event { + UIEvent event; + int value; + }; + + struct Time { + int msec; + }; + struct MacroEvent { enum { kInitOp, kSendOp, kWaitOp, kNull } type; union { - struct { - UIEvent event; - int minimum; - int maximum; - int fuzz; - int flat; - } init; - - struct { - UIEvent event; - int value; - } send; - - struct { - int msec; - } wait; + AbsInfo init; + Event send; + Time wait; }; }; diff --git a/src/chatpad.hpp b/src/chatpad.hpp index 75aa604..6182cb1 100644 --- a/src/chatpad.hpp +++ b/src/chatpad.hpp @@ -116,21 +116,24 @@ private: { uint8_t type; - union { - struct { - uint8_t unknown1; - uint8_t unknown2; - uint8_t count1; - uint8_t count2; - } __attribute__((__packed__)) clock; + struct ClockData { + uint8_t unknown1; + uint8_t unknown2; + uint8_t count1; + uint8_t count2; + } __attribute__((__packed__)); - struct { - uint8_t zero1; - uint8_t modifier; - uint8_t scancode1; - uint8_t scancode2; - uint8_t zero3; - } __attribute__((__packed__)) key; + struct KeyData { + uint8_t zero1; + uint8_t modifier; + uint8_t scancode1; + uint8_t scancode2; + uint8_t zero3; + } __attribute__((__packed__)); + + union { + ClockData clock; + KeyData key; }; } __attribute__((__packed__));