Destroy a window and free associated resources


#include <screen/screen.h>
int screen_destroy_window(screen_window_t win)


The handle of the window to be destroyed. This must have been created with screen_create_window().




The function type for screen_destroy_window() is flushing execution in any of the following cases:

Otherwise, this function is of the type immediate execution.

This function destroys the window associated with the given window handle. If the window is visible, it's removed from the display. Any resources or buffers created for this window, both locally and by Screen, are released.

The window handle can no longer be used as argument in subsequent Screen API calls.

Buffers that are not created by Screen and registered with screen_attach_window_buffers() are not freed by this function, screen_destroy_window(). The application is responsible for releasing its own external buffers. Any window that shares buffers with the window is also destroyed.

screen_destroy_window() must be used to free windows that were obtained by querying context or event properties. In this case, the window isn't removed from its display and destroyed. Only the local state associated with the external window is released.


0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).