static void lxynth_shutdown_device (struct graphics_device *dev) { int acc = 0; int pos = 0; lxynth_device_t *wd; struct graphics_device *gd; DEBUGF ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); s_thread_mutex_lock(lxynth_root->gd->mut); while (!s_list_eol(lxynth_root->gd->list, pos)) { gd = (struct graphics_device *) s_list_get(lxynth_root->gd->list, pos); if (gd == dev) { s_list_remove(lxynth_root->gd->list, pos); if (lxynth_root->gd->list->nb_elt > 0) { lxynth_root->gd->active = (struct graphics_device *) s_list_get(lxynth_root->gd->list, 0); acc = 1; } else { lxynth_root->gd->active = NULL; } break; } pos++; } unregister_bottom_half(lxynth_surface_register_update, dev); wd = (lxynth_device_t *) dev->driver_data; s_free(wd->title); s_surface_destroy(wd->surface); s_free(wd); s_free(dev); s_thread_mutex_unlock(lxynth_root->gd->mut); if (acc && lxynth_root->running) { char *title; struct rect r; r.x1 = 0; r.y1 = 0; r.x2 = lxynth_root->window->surface->buf->w; r.y2 = lxynth_root->window->surface->buf->h; title = strdup(((lxynth_device_t *) lxynth_root->gd->active->driver_data)->title); lxynth_set_title(lxynth_root->gd->active, title); lxynth_root->gd->active->resize_handler(lxynth_root->gd->active); lxynth_root->gd->active->redraw_handler(lxynth_root->gd->active, &r); s_free(title); } }
static void directfb_shutdown_device (struct graphics_device *gd) { DFBDeviceData *data; if (!gd) return; data = gd->driver_data; unregister_bottom_half (directfb_flip_surface, data); directfb_remove_from_table (gd); data->surface->Release (data->surface); data->window->Release (data->window); mem_free (data); mem_free (gd); }