GML Weird window behavior

Hello, how do I fix this? Whenever game loses focus, sometimes its shrunken down, so game position and mouse doesnt match or become black at allimage_2021-01-12_003400.png
 
added those lines:
surface_resize(application_surface, RESOLUTION_W, RESOLUTION_H);
display_set_gui_size(RESOLUTION_W,RESOLUTION_H);
 
Top