Class: Gdk::DisplayManager

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

The purpose of the Gdk::DisplayManager 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 Gdk::DisplayManager singleton, but that should be rarely necessary. Typically, initializing GTK+ opens a display that you can work with without ever accessing the Gdk::DisplayManager.

The GDK library can be built with support for multiple backends. The Gdk::DisplayManager 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:

## Backend-specific code ## #backend-specific

#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");

Instance Method Summary collapse

Instance Method Details

#default_displayGdk::Display

Returns default-display.

Returns:

#default_display=(default_display) ⇒ Gdk::Display

Parameters:

Returns:

#list_displaysGLib::SList

List all currently open displays.

Returns:

  • (GLib::SList)

    a newly allocated #GSList of Gdk::Display objects. Free with g_slist_free() when you are done with it.

#open_display(name) ⇒ Gdk::Display

Opens a display.

Parameters:

  • name (String)

    the name of the display to open

Returns:

  • (Gdk::Display)

    a Gdk::Display, or nil if the display could not be opened