Learn how to evaluate and integrate the VNC SDK

We're here if you need help.

Displays.h

Manages the list of displays (that is, monitors) currently attached to the Server computer. (more...)

Data structures

Modifier and Type Name and Description
struct

vnc_DisplayManager_Callback

Callback receiving display changes.

Functions

Modifier and Type Name and Description
function int

vnc_DisplayManager_getDisplayCount(vnc_DisplayManager *displayManager)

Returns the number of displays.

function vnc_status_t

vnc_DisplayManager_setCallback(vnc_DisplayManager *displayManager, const vnc_DisplayManager_Callback *callback, void *userData)

Registers a callback notifying when displays are added or removed, or the resolution of an existing display changes.

function vnc_status_t

vnc_DisplayManager_selectDisplay(vnc_DisplayManager *displayManager, int index)

Chooses a particular display to remote to connected Viewer app users.

function const char *

vnc_DisplayManager_getId(vnc_DisplayManager *displayManager, int index)

Gets the ID of the display (typically a short string).

function const char *

vnc_DisplayManager_getName(vnc_DisplayManager *displayManager, int index)

Gets the name of the display (typically a human-readable string).

function vnc_bool_t

vnc_DisplayManager_isPrimary(vnc_DisplayManager *displayManager, int index)

Returns whether this is the primary (or main) display.

function int

vnc_DisplayManager_getResolutionX(vnc_DisplayManager *displayManager, int index)

Gets the horizontal resolution of the display in pixels.

function int

vnc_DisplayManager_getResolutionY(vnc_DisplayManager *displayManager, int index)

Gets the vertical resolution of the display in pixels.

function int

vnc_DisplayManager_getOriginX(vnc_DisplayManager *displayManager, int index)

Gets the horizontal origin of the display in pixels.

function int

vnc_DisplayManager_getOriginY(vnc_DisplayManager *displayManager, int index)

Gets the vertical origin of the display in pixels.

Detailed description

Manages the list of displays (that is, monitors) currently attached to the Server computer.

To obtain the current list, call vnc_Server_getDisplayManager to obtain a vnc_DisplayManager object (a list with a 0-based index). Call vnc_DisplayManager_selectDisplay with a particular index to remote just that monitor to connected Viewer app users. Specify -1 to remote all monitors (this is the default behavior).

To detect monitor changes while the current session is in progress, call vnc_DisplayManager_setCallback. If a monitor is added or removed, or the resolution of an existing monitor changes, vnc_DisplayManager_Callback::displaysChanged returns a new vnc_DisplayManager object. Call vnc_DisplayManager_selectDisplay again to remote a monitor from the new list.

Note that functions taking an index argument return undefined if the given value is out of range. In this circumstance, a call to vnc_getLastError() returns InvalidArgument.

Since
1.5

Functions

int vnc_DisplayManager_getDisplayCount(vnc_DisplayManager *displayManager)

Returns the number of displays.

vnc_status_t vnc_DisplayManager_setCallback(vnc_DisplayManager *displayManager, const vnc_DisplayManager_Callback *callback, void *userData)

Registers a callback notifying when displays are added or removed, or the resolution of an existing display changes.

Return
vnc_success or vnc_failure, in which case call vnc_getLastError() to get the error code.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • callback -

    The callback.

  • userData -

    Optional custom data to pass to the callback.

vnc_status_t vnc_DisplayManager_selectDisplay(vnc_DisplayManager *displayManager, int index)

Chooses a particular display to remote to connected Viewer app users.

This replaces any previous selection, so either a single display is remoted or all are.

If the selected display is removed, connected Viewers will cease to receive framebuffer updates until the display is replaced or a new display is selected.

Return
vnc_success or vnc_failure, in which case call vnc_getLastError() to get the error code.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the display to remote, or -1 to remote all displays.

Return Value
  • InvalidArgument -

    index is invalid.

const char *vnc_DisplayManager_getId(vnc_DisplayManager *displayManager, int index)

Gets the ID of the display (typically a short string).

Return
A unique identifier.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

const char *vnc_DisplayManager_getName(vnc_DisplayManager *displayManager, int index)

Gets the name of the display (typically a human-readable string).

Return
A friendly name.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

vnc_bool_t vnc_DisplayManager_isPrimary(vnc_DisplayManager *displayManager, int index)

Returns whether this is the primary (or main) display.

On Windows, the main display acts as the active desktop, showing the taskbar and sign in and lock screens. Most applications open on the main display by default.

Return
vnc_true if this is the primary display, otherwise vnc_false.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

int vnc_DisplayManager_getResolutionX(vnc_DisplayManager *displayManager, int index)

Gets the horizontal resolution of the display in pixels.

Return
A width in pixels.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

int vnc_DisplayManager_getResolutionY(vnc_DisplayManager *displayManager, int index)

Gets the vertical resolution of the display in pixels.

Return
A height in pixels.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

int vnc_DisplayManager_getOriginX(vnc_DisplayManager *displayManager, int index)

Gets the horizontal origin of the display in pixels.

Return
The X coordinate of the top left corner of the display relative to the operating system’s virtual map of all the displays.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

int vnc_DisplayManager_getOriginY(vnc_DisplayManager *displayManager, int index)

Gets the vertical origin of the display in pixels.

Return
The Y coordinate of the top left corner of the display relative to the operating system’s virtual map of all the displays.
Since
1.5
Parameters
  • displayManager -

    The display manager.

  • index -

    The 0-based index of the required display.

struct vnc_DisplayManager_Callback
#include <Displays.h>

Callback receiving display changes.

See
vnc_DisplayManager_setCallback

Public Members

void(* vnc_DisplayManager_Callback::displaysChanged)(void *userData, vnc_DisplayManager *displayManager)

Notification that a display has been added or removed, or the resolution of an existing display has changed.

Since
1.5
Parameters
  • displayManager -

    A displayManager object containing a new list of all the displays.

×