@@ -331,11 +331,11 @@ void CRenderDevice::message_loop()
331331 return ;
332332 }
333333
334- SDL_PumpEvents ();
335-
336334 SDL_Event event;
337335
336+ SDL_PumpEvents ();
338337 SDL_PeepEvents (&event, 1 , SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_SYSWMEVENT);
338+
339339 while (SDL_QUIT != event.type )
340340 {
341341 if (SDL_PeepEvents (&event, 1 , SDL_GETEVENT, SDL_FIRSTEVENT, SDL_SYSWMEVENT))
@@ -347,49 +347,42 @@ void CRenderDevice::message_loop()
347347 {
348348 case SDL_WINDOWEVENT_MOVED:
349349 SDL_Log (" Window %d moved to %d,%d" , event.window .windowID , event.window .data1 , event.window .data2 );
350- continue ;
350+ break ;
351351 case SDL_WINDOWEVENT_SIZE_CHANGED:
352- SDL_Log (" Window %d resized to %d,%d" , event.window .windowID , event.window .data1 , event.window .data2 );
353- continue ;
354- case SDL_WINDOWEVENT_CLOSE:
355- event.type = SDL_QUIT;
352+ SDL_Log (
353+ " Window %d resized to %d,%d" , event.window .windowID , event.window .data1 , event.window .data2 );
356354 break ;
357- # if SDL_VERSION_ATLEAST(2, 0, 5)
355+ case SDL_WINDOWEVENT_CLOSE: event. type = SDL_QUIT; break ;
358356 case SDL_WINDOWEVENT_SHOWN:
359- case SDL_WINDOWEVENT_FOCUS_GAINED:
357+ SDL_Log (" Window %d has been shown" , event.window .windowID );
358+
360359 if (editor ())
361360 {
362361 Device.b_is_Active = TRUE ;
363- continue ;
362+ break ;
364363 }
365364 OnWM_Activate (1 , event.window .data2 );
366- SDL_Log (" Window %d is offered a focus" , event.window .windowID );
367- continue ;
365+ break ;
368366 case SDL_WINDOWEVENT_HIDDEN:
369- case SDL_WINDOWEVENT_FOCUS_LOST:
370367 OnWM_Activate (0 , event.window .data2 );
371- SDL_Log (" Window %d is lost a focus" , event.window .windowID );
372- continue ;
373- #endif
368+ SDL_Log (" Window %d has been hidden" , event.window .windowID );
369+ break ;
374370 default :
375371 SDL_Log (" Window %d got unknown event %d with %d %d" , event.window .windowID , event.window .event ,
376372 event.window .data1 , event.window .data2 );
377- continue ;
373+ break ;
378374 }
379- continue ;
380- default :
381- SDL_Log (" Window event %d to %d,%d" , event.type , event.window .data1 , event.window .data2 );
382- continue ;
375+ break ;
376+ case SDL_QUIT:
377+ SDL_DestroyWindow (m_sdlWnd);
378+ SDL_Quit ();
379+ break ;
380+ default : SDL_Log (" Window event %d to %d,%d" , event.type , event.window .data1 , event.window .data2 ); break ;
383381 }
384382 }
385383
386384 on_idle ();
387385 }
388-
389- /*
390- while (true)
391- on_idle();
392- */
393386}
394387
395388void CRenderDevice::Run ()
0 commit comments