示例#1
0
文件: window.c 项目: jetlive/xynth
void s_window_uninit (s_window_t *window)
{
	if (window == NULL) {
		return;
	}

        window->event->type = EVENT_TYPE_QUIT;
        s_event_changed(window);
	s_thread_join(window->eventq->tid, NULL);

	s_childs_uninit(window);
        if (window->type & (WINDOW_TYPE_TEMP | WINDOW_TYPE_CHILD)) {
		if (s_child_del(window->parent, window) == 0) {
			s_thread_detach(window->tid);
		}
	} else if (window->type & WINDOW_TYPE_POPUP) {
		s_thread_detach(window->tid);
	}

	debugf(DCLI, "[%d] Exiting (%s%s)", window->id, (window->type & WINDOW_TYPE_MAIN) ? "WINDOW_TYPE_MAIN" :
	                                                 ((window->type & WINDOW_TYPE_CHILD) ? "WINDOW_TYPE_CHILD" :
	                                                 ((window->type & WINDOW_TYPE_TEMP) ? "WINDOW_TYPE_TEMP" :
	                                                 ((window->type & WINDOW_TYPE_POPUP) ? "WINDOW_TYPE_POPUP" :
	                                                 ((window->type & WINDOW_TYPE_DESKTOP) ? "WINDOW_TYPE_DESKTOP" : "WINDOW_UNKNOWN")))),
	                                                (window->type & WINDOW_TYPE_NOFORM) ? " | WINDOW_TYPE_NOFORM" : "");

	/* andrei
	 * call atexit only after we have released all children
	 * the idea is to let the children access their parent's data attribute
	 */
	if (window->atexit != NULL) {
		window->atexit(window);
	}

	s_timers_uninit(window);
	s_pollfds_uninit(window);
	s_handlers_uninit(window);
	s_eventq_uninit(window);
	s_surface_uninit(window);
	s_event_uninit(window->event);
	s_free(window->title);

	s_free(window);
	window = NULL;
}
示例#2
0
文件: window.c 项目: d33tah/whitix
void s_window_uninit (s_window_t *window)
{
    if (window == NULL) {
        return;
    }

    window->event->type = QUIT_EVENT;
    s_event_changed(window);
    s_thread_join(window->eventq->tid, NULL);

    s_timers_uninit(window);
    s_pollfds_uninit(window);
    s_handlers_uninit(window);

    if (window->atexit != NULL) {
        window->atexit(window);
    }

    s_childs_uninit(window);

    if (window->type & (WINDOW_TEMP | WINDOW_CHILD)) {
        if (s_child_del(window->parent, window) == 0) {
            s_free(window->tid);
        }
    }

    debugf(DCLI, "[%d] Exiting (%s%s)", window->id, (window->type & WINDOW_MAIN) ? "WINDOW_MAIN" :
           ((window->type & WINDOW_CHILD) ? "WINDOW_CHILD" :
            ((window->type & WINDOW_TEMP) ? "WINDOW_TEMP" :
             ((window->type & WINDOW_DESKTOP) ? "WINDOW_DESKTOP" : "WINDOW_UNKNOWN"))),
           (window->type & WINDOW_NOFORM) ? " | WINDOW_NOFORM" : "");

    s_eventq_uninit(window);

    s_surface_uninit(window);
    s_event_uninit(window->event);
    s_gettext_uninit(window);

    s_free(window->title);
    s_free(window);
    window = NULL;
}