screen_share_window_buffers()

Updated: April 19, 2023

Cause a window to display content produced in another window

Synopsis:

#include <screen/screen.h>
int screen_share_window_buffers(screen_window_t win,
                                screen_window_t share)

Arguments:

win
The handle of the window that's sharing the buffer(s) owned by another window.
share
The handle of the window whose buffer(s) is to be displayed.

Library:

libscreen

Description:

Function Type: Flushing Execution

This function is used when a window needs to share the content of another window. For this operation to be successful, the window that is the owner of the buffer(s) to be shared must have at least one buffer that was created with screen_create_window_buffers(), or attached with screen_attach_window_buffers(). Updates can only be posted using the window that is the owner of the buffers (i.e. the window whose handle is identified as share). You can use the screen_share_window_buffers() function to improve performance by reducing the amount of blending on the screen. For example, a window might be entirely transparent except for a watermark that needs to be blended in a corner. Blending the entire window is costly and can be avoided by setting the transparency of this window to SCREEN_TRANSPARENCY_DISCARD. To keep the watermark visible, another window can be created and made to share buffers with the main window. This way, most of the window is discarded and a much smaller area is actually blended.

The following properties of the window are ignored if you set them prior to calling this function:

Returns:

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