summarylogtreecommitdiffstats
path: root/0001-fix-VREvent_Data_t-union-in-c-header-and-add-pragma-.patch
blob: d2d9b88244f5c4884d88d24aa2f3c486c79a17b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 9633359e79d5347d5667d2f2b5b46c720c559601 Mon Sep 17 00:00:00 2001
From: Christoph Haag <christoph.haag@collabora.com>
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