@@ -14,135 +14,135 @@ private static extern int GetDisplayConfigBufferSizes(
1414 private static extern int QueryDisplayConfig (
1515 uint flags ,
1616 ref uint numPathArrayElements ,
17- [ In , Out ] DISPLAYCONFIG_PATH_INFO [ ] pathArray ,
17+ [ In , Out ] DisplayconfigPathInfo [ ] pathArray ,
1818 ref uint numModeInfoArrayElements ,
19- [ In , Out ] DISPLAYCONFIG_MODE_INFO [ ] modeInfoArray ,
19+ [ In , Out ] DisplayconfigModeInfo [ ] modeInfoArray ,
2020 IntPtr currentTopologyId ) ;
2121
2222 [ DllImport ( "user32.dll" ) ]
23- private static extern int DisplayConfigGetDeviceInfo ( ref DISPLAYCONFIG_SDR_WHITE_LEVEL requestPacket ) ;
23+ private static extern int DisplayConfigGetDeviceInfo ( ref DisplayconfigSdrWhiteLevel requestPacket ) ;
2424
25- private const uint QDC_ONLY_ACTIVE_PATHS = 0x00000002 ;
26- private const int ERROR_SUCCESS = 0 ;
27- private const uint DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11 ;
25+ private const uint QdcOnlyActivePaths = 0x00000002 ;
26+ private const int ErrorSuccess = 0 ;
27+ private const uint DisplayconfigDeviceInfoGetSdrWhiteLevel = 11 ;
2828
2929 [ StructLayout ( LayoutKind . Sequential ) ]
30- private struct DISPLAYCONFIG_PATH_INFO
30+ private struct DisplayconfigPathInfo
3131 {
32- public DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo ;
33- public DISPLAYCONFIG_PATH_TARGET_INFO targetInfo ;
32+ public DisplayconfigPathSourceInfo sourceInfo ;
33+ public DisplayconfigPathTargetInfo targetInfo ;
3434 public uint flags ;
3535 }
3636
3737 [ StructLayout ( LayoutKind . Sequential ) ]
38- private struct DISPLAYCONFIG_PATH_SOURCE_INFO
38+ private struct DisplayconfigPathSourceInfo
3939 {
40- public LUID adapterId ;
40+ public Luid adapterId ;
4141 public uint id ;
4242 public uint modeInfoIdx ;
4343 public uint statusFlags ;
4444 }
4545
4646 [ StructLayout ( LayoutKind . Sequential ) ]
47- private struct DISPLAYCONFIG_PATH_TARGET_INFO
47+ private struct DisplayconfigPathTargetInfo
4848 {
49- public LUID adapterId ;
49+ public Luid adapterId ;
5050 public uint id ;
5151 public uint modeInfoIdx ;
5252 public uint outputTechnology ;
5353 public uint rotation ;
5454 public uint scaling ;
55- public DISPLAYCONFIG_RATIONAL refreshRate ;
55+ public DisplayconfigRational refreshRate ;
5656 public uint scanLineOrdering ;
5757 public bool targetAvailable ;
5858 public uint statusFlags ;
5959 }
6060
6161 [ StructLayout ( LayoutKind . Sequential ) ]
62- private struct DISPLAYCONFIG_RATIONAL
62+ private struct DisplayconfigRational
6363 {
6464 public uint Numerator ;
6565 public uint Denominator ;
6666 }
6767
6868 [ StructLayout ( LayoutKind . Sequential ) ]
69- private struct DISPLAYCONFIG_MODE_INFO
69+ private struct DisplayconfigModeInfo
7070 {
7171 public uint infoType ;
7272 public uint id ;
73- public LUID adapterId ;
74- public DISPLAYCONFIG_TARGET_MODE mode ;
73+ public Luid adapterId ;
74+ public DisplayconfigTargetMode mode ;
7575 }
7676
7777 [ StructLayout ( LayoutKind . Sequential ) ]
78- private struct DISPLAYCONFIG_TARGET_MODE
78+ private struct DisplayconfigTargetMode
7979 {
80- public DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo ;
80+ public DisplayconfigVideoSignalInfo targetVideoSignalInfo ;
8181 }
8282
8383 [ StructLayout ( LayoutKind . Sequential ) ]
84- private struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO
84+ private struct DisplayconfigVideoSignalInfo
8585 {
8686 public ulong pixelRate ;
87- public DISPLAYCONFIG_RATIONAL hSyncFreq ;
88- public DISPLAYCONFIG_RATIONAL vSyncFreq ;
89- public DISPLAYCONFIG_2DREGION activeSize ;
90- public DISPLAYCONFIG_2DREGION totalSize ;
87+ public DisplayconfigRational hSyncFreq ;
88+ public DisplayconfigRational vSyncFreq ;
89+ public Displayconfig2Dregion activeSize ;
90+ public Displayconfig2Dregion totalSize ;
9191 public uint videoStandard ;
9292 public uint scanLineOrdering ;
9393 }
9494
9595 [ StructLayout ( LayoutKind . Sequential ) ]
96- private struct DISPLAYCONFIG_2DREGION
96+ private struct Displayconfig2Dregion
9797 {
9898 public uint cx ;
9999 public uint cy ;
100100 }
101101
102102 [ StructLayout ( LayoutKind . Sequential ) ]
103- private struct LUID
103+ private struct Luid
104104 {
105105 public uint LowPart ;
106106 public int HighPart ;
107107 }
108108
109109 [ StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
110- private struct DISPLAYCONFIG_DEVICE_INFO_HEADER
110+ private struct DisplayconfigDeviceInfoHeader
111111 {
112112 public uint type ;
113113 public uint size ;
114- public LUID adapterId ;
114+ public Luid adapterId ;
115115 public uint id ;
116116 }
117117
118118 [ StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
119- private struct DISPLAYCONFIG_SDR_WHITE_LEVEL
119+ private struct DisplayconfigSdrWhiteLevel
120120 {
121- public DISPLAYCONFIG_DEVICE_INFO_HEADER header ;
121+ public DisplayconfigDeviceInfoHeader header ;
122122 public uint SDRWhiteLevel ;
123123 }
124124
125125 [ DllImport ( "user32.dll" , CharSet = CharSet . Auto ) ]
126- private static extern bool GetMonitorInfo ( IntPtr hMonitor , ref MONITORINFOEX lpmi ) ;
126+ private static extern bool GetMonitorInfo ( IntPtr hMonitor , ref Monitorinfoex lpmi ) ;
127127
128128 [ DllImport ( "user32.dll" ) ]
129- private static extern int DisplayConfigGetDeviceInfo ( ref DISPLAYCONFIG_SOURCE_DEVICE_NAME requestPacket ) ;
129+ private static extern int DisplayConfigGetDeviceInfo ( ref DisplayconfigSourceDeviceName requestPacket ) ;
130130
131- private const uint DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1 ;
131+ private const uint DisplayconfigDeviceInfoGetSourceName = 1 ;
132132
133133 [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Auto ) ]
134- private struct MONITORINFOEX
134+ private struct Monitorinfoex
135135 {
136136 public int cbSize ;
137- public RECT rcMonitor ;
138- public RECT rcWork ;
137+ public Rect rcMonitor ;
138+ public Rect rcWork ;
139139 public uint dwFlags ;
140140 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 32 ) ]
141141 public string szDevice ;
142142 }
143143
144144 [ StructLayout ( LayoutKind . Sequential ) ]
145- public struct RECT
145+ public struct Rect
146146 {
147147 public int left ;
148148 public int top ;
@@ -151,9 +151,9 @@ public struct RECT
151151 }
152152
153153 [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode , Pack = 4 ) ]
154- private struct DISPLAYCONFIG_SOURCE_DEVICE_NAME
154+ private struct DisplayconfigSourceDeviceName
155155 {
156- public DISPLAYCONFIG_DEVICE_INFO_HEADER header ;
156+ public DisplayconfigDeviceInfoHeader header ;
157157 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 32 ) ]
158158 public string viewGdiDeviceName ;
159159 }
@@ -162,46 +162,46 @@ public static float GetSdrWhiteLevel(IntPtr hMonitor)
162162 {
163163 if ( hMonitor == IntPtr . Zero ) return 1.0f ;
164164
165- var mi = new MONITORINFOEX ( ) ;
165+ var mi = new Monitorinfoex ( ) ;
166166 mi . cbSize = Marshal . SizeOf ( mi ) ;
167167 if ( ! GetMonitorInfo ( hMonitor , ref mi ) ) return 1.0f ;
168168
169- var ret = GetDisplayConfigBufferSizes ( QDC_ONLY_ACTIVE_PATHS , out var numPathArrayElements , out var numModeInfoArrayElements ) ;
170- if ( ret != ERROR_SUCCESS ) return 1.0f ;
169+ var ret = GetDisplayConfigBufferSizes ( QdcOnlyActivePaths , out var numPathArrayElements , out var numModeInfoArrayElements ) ;
170+ if ( ret != ErrorSuccess ) return 1.0f ;
171171
172- var pathArray = new DISPLAYCONFIG_PATH_INFO [ numPathArrayElements ] ;
173- var modeInfoArray = new DISPLAYCONFIG_MODE_INFO [ numModeInfoArrayElements ] ;
172+ var pathArray = new DisplayconfigPathInfo [ numPathArrayElements ] ;
173+ var modeInfoArray = new DisplayconfigModeInfo [ numModeInfoArrayElements ] ;
174174
175- ret = QueryDisplayConfig ( QDC_ONLY_ACTIVE_PATHS , ref numPathArrayElements , pathArray , ref numModeInfoArrayElements , modeInfoArray , IntPtr . Zero ) ;
176- if ( ret != ERROR_SUCCESS ) return 1.0f ;
175+ ret = QueryDisplayConfig ( QdcOnlyActivePaths , ref numPathArrayElements , pathArray , ref numModeInfoArrayElements , modeInfoArray , IntPtr . Zero ) ;
176+ if ( ret != ErrorSuccess ) return 1.0f ;
177177
178178 for ( int i = 0 ; i < numPathArrayElements ; i ++ )
179179 {
180180 var path = pathArray [ i ] ;
181181
182- var sourceName = new DISPLAYCONFIG_SOURCE_DEVICE_NAME ( ) ;
183- sourceName . header . type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME ;
184- sourceName . header . size = ( uint ) Marshal . SizeOf ( typeof ( DISPLAYCONFIG_SOURCE_DEVICE_NAME ) ) ;
182+ var sourceName = new DisplayconfigSourceDeviceName ( ) ;
183+ sourceName . header . type = DisplayconfigDeviceInfoGetSourceName ;
184+ sourceName . header . size = ( uint ) Marshal . SizeOf ( typeof ( DisplayconfigSourceDeviceName ) ) ;
185185 sourceName . header . adapterId = path . sourceInfo . adapterId ;
186186 sourceName . header . id = path . sourceInfo . id ;
187187
188- if ( DisplayConfigGetDeviceInfo ( ref sourceName ) == ERROR_SUCCESS )
188+ if ( DisplayConfigGetDeviceInfo ( ref sourceName ) == ErrorSuccess )
189189 {
190190 if ( sourceName . viewGdiDeviceName == mi . szDevice )
191191 {
192192 // Found the path matching our monitor
193- var request = new DISPLAYCONFIG_SDR_WHITE_LEVEL
193+ var request = new DisplayconfigSdrWhiteLevel
194194 {
195- header = new DISPLAYCONFIG_DEVICE_INFO_HEADER
195+ header = new DisplayconfigDeviceInfoHeader
196196 {
197- type = DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL ,
198- size = ( uint ) Marshal . SizeOf ( typeof ( DISPLAYCONFIG_SDR_WHITE_LEVEL ) ) ,
197+ type = DisplayconfigDeviceInfoGetSdrWhiteLevel ,
198+ size = ( uint ) Marshal . SizeOf ( typeof ( DisplayconfigSdrWhiteLevel ) ) ,
199199 adapterId = path . targetInfo . adapterId ,
200200 id = path . targetInfo . id
201201 }
202202 } ;
203203
204- if ( DisplayConfigGetDeviceInfo ( ref request ) == ERROR_SUCCESS )
204+ if ( DisplayConfigGetDeviceInfo ( ref request ) == ErrorSuccess )
205205 {
206206 if ( request . SDRWhiteLevel > 0 )
207207 {
0 commit comments