@@ -1185,17 +1185,26 @@ static void IN_ProcessEvents( void )
11851185 {
11861186 case SDL_WINDOWEVENT_RESIZED :
11871187 {
1188- char width [32 ], height [32 ];
1189- Com_sprintf ( width , sizeof ( width ), "%d" , e .window .data1 );
1190- Com_sprintf ( height , sizeof ( height ), "%d" , e .window .data2 );
1191- Cvar_Set ( "r_customwidth" , width );
1192- Cvar_Set ( "r_customheight" , height );
1193- Cvar_Set ( "r_mode" , "-1" );
1194-
1195- // Wait until user stops dragging for 1 second, so
1196- // we aren't constantly recreating the GL context while
1197- // he tries to drag...
1198- vidRestartTime = Sys_Milliseconds ( ) + 1000 ;
1188+ int newWidth = e .window .data1 ;
1189+ int newHeight = e .window .data2 ;
1190+
1191+ // Ignore spurious resize events fired when the window is
1192+ // recreated at the same size (e.g. after vid_restart on macOS).
1193+ if ( newWidth != Cvar_VariableIntegerValue ( "r_customwidth" ) ||
1194+ newHeight != Cvar_VariableIntegerValue ( "r_customheight" ) )
1195+ {
1196+ char width [32 ], height [32 ];
1197+ Com_sprintf ( width , sizeof ( width ), "%d" , newWidth );
1198+ Com_sprintf ( height , sizeof ( height ), "%d" , newHeight );
1199+ Cvar_Set ( "r_customwidth" , width );
1200+ Cvar_Set ( "r_customheight" , height );
1201+ Cvar_Set ( "r_mode" , "-1" );
1202+
1203+ // Wait until user stops dragging for 1 second, so
1204+ // we aren't constantly recreating the GL context while
1205+ // he tries to drag...
1206+ vidRestartTime = Sys_Milliseconds ( ) + 1000 ;
1207+ }
11991208 }
12001209 break ;
12011210
0 commit comments