screen_ref_window()

Updated: April 19, 2023

Create a reference to a window

Synopsis:

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

Arguments:

win
The handle of the window for which the reference is to be created.

Library:

libscreen

Description:

Function Type: Immediate Execution

This function creates a reference to a window. This function can be used by window managers and group parents to prevent a window from disappearing, even when the process that originally created the window terminates abnormally. If this happens, ownership of the window is transferred to the window manager or group parent. The restrictions imposed on buffers still exist. The contents of the buffers can't be changed. The buffers can't be destroyed until the window is unreferenced. When the original process owner is no longer a client of Screen, the window is destroyed when screen_destroy_window() is called by the reference owner.

Returns:

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