Gdk.DisplayManager

g GObject.Object GObject.Object Gdk.DisplayManager Gdk.DisplayManager GObject.Object->Gdk.DisplayManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get ()

get_default_display ()

list_displays ()

open_display (name)

set_default_display (display)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

default-display

Gdk.Display

r/w

Signals

Inherited:

GObject.Object (1)

Name

Short Description

display-opened

Emitted when a display is opened.

Fields

Inherited:

GObject.Object (1)

Class Details

class Gdk.DisplayManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

A singleton object that offers notification when displays appear or disappear.

You can use [func`Gdk`.DisplayManager.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.

In the rare case that you need to influence which of the backends is being used, you can use [func`Gdk`.set_allowed_backends]. Note that you need to call this function before initializing GTK.

Backend-specific code

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:

``c #ifdef GDK_WINDOWING_X11

if (GDK_IS_X11_DISPLAY (display))
{

// make X11-specific calls here

}

else

#endif #ifdef GDK_WINDOWING_MACOS

if (GDK_IS_MACOS_DISPLAY (display))
{

// make Quartz-specific calls here

}

else

#endif

g_error (“Unsupported GDK backend”);

``

classmethod get()[source]
Returns:

The global GdkDisplayManager singleton

Return type:

Gdk.DisplayManager

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).

Applications can use [func`set_allowed_backends`] to limit what backends will be used.

get_default_display()[source]
Returns:

a GdkDisplay

Return type:

Gdk.Display or None

Gets the default GdkDisplay.

list_displays()[source]
Returns:

a newly allocated GSList of GdkDisplay objects

Return type:

[Gdk.Display]

List all currently open displays.

open_display(name)[source]
Parameters:

name (str or None) – the name of the display to open

Returns:

a GdkDisplay, or None if the display could not be opened

Return type:

Gdk.Display or None

Opens a display.

set_default_display(display)[source]
Parameters:

display (Gdk.Display) – a GdkDisplay

Sets display as the default display.

Signal Details

Gdk.DisplayManager.signals.display_opened(display_manager, display)
Signal Name:

display-opened

Flags:

RUN_LAST

Parameters:

Emitted when a display is opened.

Property Details

Gdk.DisplayManager.props.default_display
Name:

default-display

Type:

Gdk.Display

Default Value:

None

Flags:

READABLE, WRITABLE

The default display.