@@ -120,24 +120,6 @@ static BOOL ExternalDisplayConnected() {
120120 return FALSE;
121121}
122122
123- static BOOL HasAnyActiveDisplays () {
124- DISPLAY_DEVICE device = { .cb = sizeof (DISPLAY_DEVICE ) };
125- DWORD i = 0 ;
126-
127- while (EnumDisplayDevicesW (NULL , i ++ , & device , 0 ) != 0 ) {
128- DISPLAY_DEVICE device2 = { .cb = sizeof (DISPLAY_DEVICE ) };
129- DWORD j = 0 ;
130-
131- while (EnumDisplayDevicesW (device .DeviceName , j ++ , & device2 , 0 ) != 0 ) {
132- if (device2 .StateFlags & DISPLAY_DEVICE_ACTIVE ) {
133- return TRUE;
134- }
135- }
136- }
137-
138- return FALSE;
139- }
140-
141123static void PopulateDisplayDevices (HWND hComboBox ) {
142124 DISPLAY_DEVICE device = { .cb = sizeof (DISPLAY_DEVICE ) };
143125 DWORD i = 0 ;
@@ -249,7 +231,7 @@ static LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT msg, WPARAM wParam, LPAR
249231 {
250232 break ;
251233 }
252- if (HasAnyActiveDisplays ()) { // if any monitor is active
234+ if (ExternalDisplayConnected ()) { // if any monitor is active
253235 break ;
254236 }
255237 if (lidState != 0 ) { // if lid is not closed
@@ -347,7 +329,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine,
347329{
348330#if NDEBUG == 0
349331 AllocConsole ();
350- FILE * file ;
332+ FILE * file = NULL ;
351333 freopen_s (& file , "CONOUT$" , "w" , stdout );
352334 freopen_s (& file , "CONIN$" , "r" , stdin );
353335 freopen_s (& file , "CONOUT$" , "w" , stderr );
0 commit comments