From 9633359e79d5347d5667d2f2b5b46c720c559601 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Mon, 30 Jul 2018 17:18:44 +0200 Subject: [PATCH] fix VREvent_Data_t union in c header and add pragma pack( push, 4) v2: pop pragma pack after VrEvent_t --- headers/openvr_capi.h | 56 ++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/headers/openvr_capi.h b/headers/openvr_capi.h index 1ee5a36..74c0fa6 100644 --- a/headers/openvr_capi.h +++ b/headers/openvr_capi.h @@ -1966,25 +1966,41 @@ typedef struct COpenVRContext intptr_t m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors * } COpenVRContext; + typedef union + { + VREvent_Reserved_t reserved; + VREvent_Controller_t controller; + VREvent_Mouse_t mouse; + VREvent_Scroll_t scroll; + VREvent_Process_t process; + VREvent_Notification_t notification; + VREvent_Overlay_t overlay; + VREvent_Status_t status; + VREvent_Keyboard_t keyboard; + VREvent_Ipd_t ipd; + VREvent_Chaperone_t chaperone; + VREvent_PerformanceTest_t performanceTest; + VREvent_TouchPadMove_t touchPadMove; + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + VREvent_Screenshot_t screenshot; + VREvent_ScreenshotProgress_t screenshotProgress; + VREvent_ApplicationLaunch_t applicationLaunch; + VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; + VREvent_Property_t property; + VREvent_DualAnalog_t dualAnalog; + VREvent_HapticVibration_t hapticVibration; + VREvent_WebConsole_t webConsole; + VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; +} VREvent_Data_t; -typedef union -{ - VREvent_Reserved_t reserved; - VREvent_Controller_t controller; - VREvent_Mouse_t mouse; - VREvent_Scroll_t scroll; - VREvent_Process_t process; - VREvent_Notification_t notification; - VREvent_Overlay_t overlay; - VREvent_Status_t status; - VREvent_Keyboard_t keyboard; - VREvent_Ipd_t ipd; - VREvent_Chaperone_t chaperone; - VREvent_PerformanceTest_t performanceTest; - VREvent_TouchPadMove_t touchPadMove; - VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; -} VREvent_Data_t; - +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif /** An event posted by the server to all running applications */ struct VREvent_t { @@ -1994,7 +2010,9 @@ struct VREvent_t // event data must be the end of the struct as its size is variable VREvent_Data_t data; }; - +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif typedef union { -- 2.18.0