static void win_shutdown(void) { ALLEGRO_SYSTEM *s; ALLEGRO_DISPLAY_INTERFACE *display_driver; ASSERT(vt); /* Close all open displays. */ s = al_get_system_driver(); while (_al_vector_size(&s->displays) > 0) { ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); ALLEGRO_DISPLAY *d = *dptr; _al_destroy_display_bitmaps(d); al_destroy_display(d); } _al_vector_free(&s->displays); display_driver = vt->get_display_driver(); if (display_driver && display_driver->shutdown) { display_driver->shutdown(); } _al_win_shutdown_time(); if (using_higher_res_timer) { timeEndPeriod(1); } al_free(vt); vt = NULL; ASSERT(_al_win_system); al_free(_al_win_system); }
static void xglx_shutdown_system(void) { ALLEGRO_SYSTEM *s = al_get_system_driver(); ALLEGRO_SYSTEM_XGLX *sx = (void *)s; ALLEGRO_INFO("shutting down.\n"); if (sx->x11display) { /* Events thread only runs if we are connected to an X server. */ _al_thread_join(&sx->thread); } /* Close all open displays. */ while (_al_vector_size(&s->displays) > 0) { ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); ALLEGRO_DISPLAY *d = *dptr; _al_destroy_display_bitmaps(d); al_destroy_display(d); } _al_vector_free(&s->displays); // Makes sure we wait for any commands sent to the X server when destroying the displays. // Should make sure we don't shutdown before modes are restored. if (sx->x11display) { XSync(sx->x11display, False); } _al_xsys_mmon_exit(sx); if (sx->x11display) { XCloseDisplay(sx->x11display); sx->x11display = None; ALLEGRO_DEBUG("xsys: close x11display.\n"); } if (sx->gfxdisplay) { /* XXX for some reason, crashes if both XCloseDisplay calls are made */ /* XCloseDisplay(sx->gfxdisplay); */ sx->gfxdisplay = None; } al_free(sx); }
static void xglx_shutdown_system(void) { /* Close all open displays. */ ALLEGRO_SYSTEM *s = al_get_system_driver(); ALLEGRO_SYSTEM_XGLX *sx = (void *)s; ALLEGRO_INFO("shutting down.\n"); _al_thread_join(&sx->thread); while (_al_vector_size(&s->displays) > 0) { ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); ALLEGRO_DISPLAY *d = *dptr; _al_destroy_display_bitmaps(d); al_destroy_display(d); } _al_vector_free(&s->displays); _al_xglx_free_mode_infos(sx); #ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA _al_xsys_xinerama_exit(sx); #endif if (sx->x11display) { XCloseDisplay(sx->x11display); sx->x11display = None; } if (sx->gfxdisplay) { /* XXX for some reason, crashes if both XCloseDisplay calls are made */ /* XCloseDisplay(sx->gfxdisplay); */ sx->gfxdisplay = None; } _AL_FREE(sx); }