CdkDisplayManager: CDK 3 Reference Manual

## CdkDisplayManager CdkDisplayManager — Maintains a list of all open CdkDisplays |

## Functions

CdkDisplayManager * | cdk_display_manager_get ()
CdkDisplay * | cdk_display_manager_get_default_display ()
void | cdk_display_manager_set_default_display ()
GSList * | cdk_display_manager_list_displays ()
CdkDisplay * | cdk_display_manager_open_display ()

## Properties

CdkDisplay * | default-display | Read / Write

## Signals

void | display-opened | Run Last

## Types and Values

| CdkDisplayManager

## Object Hierarchy

        GObject
        ╰── CdkDisplayManager

## Includes

    #include <cdk/cdk.h>

## Description

The purpose of the CdkDisplayManager singleton object is to offer notification when displays appear or disappear or the default display changes.

You can use `cdk_display_manager_get()` to obtain the CdkDisplayManager singleton, but that should be rarely necessary. Typically, initializing CTK+ opens a display that you can work with without ever accessing the CdkDisplayManager.

The CDK library can be built with support for multiple backends. The CdkDisplayManager object determines which backend is used at runtime.

When writing backend-specific code that is supposed to work with multiple CDK backends, you have to consider both compile time and runtime. At compile time, use the CDK_WINDOWING_X11, CDK_WINDOWING_WIN32 macros, etc. to find out which backends are present in the CDK library you are building your application against. At runtime, use type-check macros like `CDK_IS_X11_DISPLAY()` to find out which backend is in use:

#### Backend-specific code

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    #ifdef CDK_WINDOWING_X11
      if (CDK_IS_X11_DISPLAY (display))
        {
          // make X11-specific calls here
        }
      else
    #endif
    #ifdef CDK_WINDOWING_QUARTZ
      if (CDK_IS_QUARTZ_DISPLAY (display))
        {
          // make Quartz-specific calls here
        }
      else
    #endif
      g_error ("Unsupported CDK backend");

## Functions

### cdk_display_manager_get ()

    CdkDisplayManager *
    cdk_display_manager_get (void);

Gets the singleton CdkDisplayManager object.

When called for the first time, this function consults the `CDK_BACKEND` environment variable to find out which of the supported CDK backends to use (in case CDK has been compiled with multiple backends). Applications can use `cdk_set_allowed_backends()` to limit what backends can be used.

#### Returns

The global CdkDisplayManager singleton; `cdk_parse_args()`, `cdk_init()`, or `cdk_init_check()` must have been called first.

[transfer none]

Since: 2.2

### cdk_display_manager_get_default_display ()

    CdkDisplay *
    cdk_display_manager_get_default_display
                                   (CdkDisplayManager *manager);

Gets the default CdkDisplay.

#### Parameters

manager | a CdkDisplayManager |

#### Returns

a CdkDisplay, or `NULL` if there is no default display.

[nullable][transfer none]

Since: 2.2

### cdk_display_manager_set_default_display ()

    void
    cdk_display_manager_set_default_display
                                   (CdkDisplayManager *manager,
                                    CdkDisplay *display);

Sets `display` as the default display.

#### Parameters

manager | a CdkDisplayManager |
display | a CdkDisplay |

Since: 2.2

### cdk_display_manager_list_displays ()

    GSList *
    cdk_display_manager_list_displays (CdkDisplayManager *manager);

List all currently open displays.

#### Parameters

manager | a CdkDisplayManager |

#### Returns

a newly allocated GSList of CdkDisplay objects. Free with `g_slist_free()` when you are done with it.

[transfer container][element-type CdkDisplay]

Since: 2.2

### cdk_display_manager_open_display ()

    CdkDisplay *
    cdk_display_manager_open_display (CdkDisplayManager *manager,
                                      const gchar *name);

Opens a display.

#### Parameters

manager | a CdkDisplayManager |
name | the name of the display to open |

#### Returns

a CdkDisplay, or `NULL` if the display could not be opened.

[nullable][transfer none]

Since: 3.0

## Types and Values

### CdkDisplayManager

    typedef struct _CdkDisplayManager CdkDisplayManager;

## Property Details

### The `“default-display”` property

      “default-display”          CdkDisplay *

The default display for CDK.

Owner: CdkDisplayManager

Flags: Read / Write

## Signal Details

### The `“display-opened”` signal

    void
    user_function (CdkDisplayManager *manager,
                   CdkDisplay        *display,
                   gpointer           user_data)

The ::display-opened signal is emitted when a display is opened.

#### Parameters

manager | the object on which the signal is emitted |
display | the opened display |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.2