## GdkDisplayManager

GdkDisplayManager — Maintains a list of all open GdkDisplays

## Synopsis

    #include <gdk/gdk.h>

                        GdkDisplayManager;
    GdkDisplayManager * gdk_display_manager_get             (void);
    GdkDisplay *        gdk_display_manager_get_default_display
                                                            (GdkDisplayManager *manager);
    void                gdk_display_manager_set_default_display
                                                            (GdkDisplayManager *manager,
                                                             GdkDisplay *display);
    GSList *            gdk_display_manager_list_displays   (GdkDisplayManager *manager);
    GdkDisplay *        gdk_display_manager_open_display    (GdkDisplayManager *manager,
                                                             const gchar *name);

## Object Hierarchy

      GObject
       +----GdkDisplayManager

## Properties

      "default-display"          GdkDisplay*           : Read / Write

## Signals

      "display-opened"                                 : Run Last

## Description

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

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

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

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

Example 2. Backend-specific code

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    #ifdef GDK_WINDOWING_X11
      if (GDK_IS_X11_DISPLAY (display))
        {
          /* make X11-specific calls here */
        }
      else
    #endif
    #ifdef GDK_WINDOWING_QUARTZ
      if (GDK_IS_QUARTZ_DISPLAY (display))
        {
          /* make Quartz-specific calls here */
        }
      else
    #endif
      g_error ("Unsupported GDK backend");

## Details

### GdkDisplayManager

    typedef struct _GdkDisplayManager GdkDisplayManager;

### gdk_display_manager_get ()

    GdkDisplayManager * gdk_display_manager_get             (void);

Gets the singleton GdkDisplayManager object.

When called for the first time, this function consults the `GDK_BACKEND` environment variable to find out which of the supported GDK backends to use (in case GDK has been compiled with multiple backends).

Returns : | The global GdkDisplayManager singleton; `gdk_parse_args()`, `gdk_init()`, or `gdk_init_check()` must have been called first. [transfer none]

Since 2.2

### gdk_display_manager_get_default_display ()

    GdkDisplay *        gdk_display_manager_get_default_display
                                                            (GdkDisplayManager *manager);

Gets the default GdkDisplay.

`manager` : | a GdkDisplayManager
Returns : | a GdkDisplay, or `NULL` if there is no default display. [transfer none]

Since 2.2

### gdk_display_manager_set_default_display ()

    void                gdk_display_manager_set_default_display
                                                            (GdkDisplayManager *manager,
                                                             GdkDisplay *display);

Sets `display` as the default display.

`manager` : | a GdkDisplayManager
`display` : | a GdkDisplay

Since 2.2

### gdk_display_manager_list_displays ()

    GSList *            gdk_display_manager_list_displays   (GdkDisplayManager *manager);

List all currently open displays.

`manager` : | a GdkDisplayManager
Returns : | a newly allocated GSList of GdkDisplay objects. Free with `g_slist_free()` when you are done with it. [transfer container][element-type GdkDisplay]

Since 2.2

### gdk_display_manager_open_display ()

    GdkDisplay *        gdk_display_manager_open_display    (GdkDisplayManager *manager,
                                                             const gchar *name);

Opens a display.

`manager` : | a GdkDisplayManager
`name` : | the name of the display to open
Returns : | a GdkDisplay, or `NULL` if the display could not be opened. [transfer none]

Since 3.0

## Property Details

### The `"default-display"` property

      "default-display"          GdkDisplay*           : Read / Write

The default display for GDK.

## Signal Details

### The `"display-opened"` signal

    void                user_function                      (GdkDisplayManager *manager,
                                                            GdkDisplay        *display,
                                                            gpointer           user_data)      : Run Last

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

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

Since 2.2