gtkmm: Gdk::Screen Class Reference

# Gdk::Screen Class Reference

Object representing a physical screen Gdk::Screen objects are the GDK representation of a physical screen. More...

Inherits Glib::Object.

Collaboration diagram for Gdk::Screen:
[legend]

List of all members.

## Public Member Functions
virtual | ~Screen ()
GdkScreen* | gobj ()
| Provides access to the underlying C GObject.
const GdkScreen* | gobj () const
| Provides access to the underlying C GObject.
GdkScreen* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Colormap > | get_default_colormap ()
| Gets the default colormap for screen.
Glib::RefPtr< const Colormap > | get_default_colormap () const
| Gets the default colormap for screen.
void | set_default_colormap (const Glib::RefPtr< const Colormap >& colormap)
| Sets the default colormap for screen.
Glib::RefPtr< Colormap > | get_system_colormap ()
| Gets the system's default colormap for screen.
Glib::RefPtr< const Colormap > | get_system_colormap () const
| Gets the system's default colormap for screen.
Glib::RefPtr< Visual > | get_system_visual ()
| Get the system's default visual for screen.
Glib::RefPtr< const Visual > | get_system_visual () const
| Get the system's default visual for screen.
Glib::RefPtr< Colormap > | get_rgb_colormap ()
| Gets the preferred colormap for rendering image data on screen.
Glib::RefPtr< const Colormap > | get_rgb_colormap () const
| Gets the preferred colormap for rendering image data on screen.
Glib::RefPtr< Visual > | get_rgb_visual ()
| Gets a "preferred visual" chosen by GdkRGB for rendering image data on screen.
Glib::RefPtr< const Visual > | get_rgb_visual () const
| Gets a "preferred visual" chosen by GdkRGB for rendering image data on screen.
Glib::RefPtr< Colormap > | get_rgba_colormap ()
| Gets a colormap to use for creating windows or pixmaps with an alpha channel.
Glib::RefPtr< const Colormap > | get_rgba_colormap () const
| Gets a colormap to use for creating windows or pixmaps with an alpha channel.
Glib::RefPtr< Visual > | get_rgba_visual ()
| Gets a visual to use for creating windows or pixmaps with an alpha channel.
Glib::RefPtr< const Visual > | get_rgba_visual () const
| Gets a visual to use for creating windows or pixmaps with an alpha channel.
bool | is_composited () const
| Returns whether windows with an RGBA visual can reasonably be expected to have their alpha channel drawn correctly on the screen.
Glib::RefPtr< Window > | get_root_window ()
| Gets the root window of screen.
Glib::RefPtr< const Window > | get_root_window () const
| Gets the root window of screen.
Glib::RefPtr< Display > | get_display ()
| Gets the display to which the screen belongs.
Glib::RefPtr< const Display > | get_display () const
| Gets the display to which the screen belongs.
int | get_number () const
| Gets the index of screen among the screens in the display to which it belongs.
int | get_width () const
| Gets the width of screen in pixels.
int | get_height () const
| Gets the height of screen in pixels.
int | get_width_mm () const
| Gets the width of screen in millimeters.
int | get_height_mm () const
| Returns the height of screen in millimeters.
Glib::ListHandle< Glib::RefPtr < Visual > > | list_visuals ()
| Lists the available visuals for the specified screen.
Glib::ListHandle< Glib::RefPtr < Window > > | get_toplevel_windows ()
| Obtains a list of all toplevel windows known to GDK on the screen screen.
Glib::ustring | make_display_name ()
| Determines the name to pass to Gdk::Display::open() to get a Gdk::Display with this screen as the default screen.
int | get_n_monitors () const
| Returns the number of monitors which screen consists of.
int | get_primary_monitor () const
| Gets the primary monitor for screen.
void | get_monitor_geometry (int monitor_num, Rectangle& dest) const
| Retrieves the Gdk::Rectangle representing the size and position of the individual monitor within the entire screen area.
int | get_monitor_at_point (int x, int y) const
| Returns the monitor number in which the point ( x, y) is located.
int | get_monitor_at_window (const Glib::RefPtr< Window >& window) const
| Returns the number of the monitor in which the largest area of the bounding rectangle of window resides.
int | get_monitor_width_mm (int monitor_num) const
| Gets the width in millimeters of the specified monitor, if available.
int | get_monitor_height_mm (int monitor_num) const
| Gets the height in millimeters of the specified monitor.
Glib::ustring | get_monitor_plug_name (int monitor_num) const
| Returns the output name of the specified monitor.
void | broadcast_client_message (GdkEvent* event)
| On X11, sends an X ClientMessage event to all toplevel windows on screen.
template<class ValueType >
bool | get_setting (const Glib::ustring& name, ValueType&value) const
void | set_font_options (const Cairo::FontOptions& options)
| Sets the default font options for the screen.
Cairo::FontOptions | get_font_options () const
| Gets any options previously set with set_font_options().
void | set_resolution (double dpi)
| Sets the resolution for font handling on the screen.
double | get_resolution () const
| Gets the resolution for font handling on the screen; see set_resolution() for full details.
Glib::RefPtr< Gdk::Window > | get_active_window ()
| Returns the screen's currently active window.
Glib::RefPtr< const Gdk::Window > | get_active_window () const
| Returns the screen's currently active window.
Glib::ListHandle< Glib::RefPtr < Window > > | get_window_stack ()
| Returns a List of Gdk::Windows representing the current window stack.
Glib::SignalProxy0< void > | signal_size_changed ()
| The size_changed signal is emitted when the pixel width or height of a screen changes.
## Static Public Member Functions
static Glib::RefPtr< Screen > | get_default ()
| Gets the default screen for the default display.
## Protected Member Functions
virtual void | on_size_changed ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gdk::Screen > | wrap (GdkScreen* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Object representing a physical screen Gdk::Screen objects are the GDK representation of a physical screen.

It is used throughout GDK and GTK+ to specify which screen the top level windows are to be displayed on. It is also used to query the screen specification and default settings such as the default colormap (get_default_colormap()), the screen width (get_width()), etc. Note that a screen may consist of multiple monitors which are merged to form a large screen area.

## Constructor & Destructor Documentation

virtual Gdk::Screen::~Screen | ( |  | ) | `[virtual]`

## Member Function Documentation

void Gdk::Screen::broadcast_client_message | ( | GdkEvent * | event | ) |

On X11, sends an X ClientMessage event to all toplevel windows on screen.

Toplevel windows are determined by checking for the WM_STATE property, as described in the Inter-Client Communication Conventions Manual (ICCCM). If no windows are found with the WM_STATE property set, the message is sent to all children of the root window.

On Windows, broadcasts a message registered with the name GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of data is limited to one long, i.e. four bytes.

Since gtkmm 2.2:

Parameters:

  | event | The Gdk::Event.

Glib::RefPtr<const Gdk::Window> Gdk::Screen::get_active_window | ( |  | ) | const

Returns the screen's currently active window.

On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property on the root window, as described in the <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended Window Manager Hints</ulink>. If there is no currently currently active window, or the window manager does not support the _NET_ACTIVE_WINDOW hint, this function returns `0`.

On other platforms, this function may return `0`, depending on whether it is implementable on that platform.

The returned window should be unrefed using Glib::object_unref() when no longer needed.

Since gtkmm 2.10:

Returns:
  The currently active window, or `0`.

Glib::RefPtr<Gdk::Window> Gdk::Screen::get_active_window | ( |  | ) |

Returns the screen's currently active window.

On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property on the root window, as described in the <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended Window Manager Hints</ulink>. If there is no currently currently active window, or the window manager does not support the _NET_ACTIVE_WINDOW hint, this function returns `0`.

On other platforms, this function may return `0`, depending on whether it is implementable on that platform.

The returned window should be unrefed using Glib::object_unref() when no longer needed.

Since gtkmm 2.10:

Returns:
  The currently active window, or `0`.

static Glib::RefPtr<Screen> Gdk::Screen::get_default | ( |  | ) | `[static]`

Gets the default screen for the default display.

(See Gdk::Display::get_default()).

Since gtkmm 2.2:

Returns:
  A Gdk::Screen, or `0` if there is no default display.

Glib::RefPtr<const Colormap> Gdk::Screen::get_default_colormap | ( |  | ) | const

Gets the default colormap for screen.

Since gtkmm 2.2:

Returns:
  The default Gdk::Colormap.

Glib::RefPtr<Colormap> Gdk::Screen::get_default_colormap | ( |  | ) |

Gets the default colormap for screen.

Since gtkmm 2.2:

Returns:
  The default Gdk::Colormap.

Glib::RefPtr<const Display> Gdk::Screen::get_display | ( |  | ) | const

Gets the display to which the screen belongs.

Since gtkmm 2.2:

Returns:
  The display to which screen belongs.

Glib::RefPtr<Display> Gdk::Screen::get_display | ( |  | ) |

Gets the display to which the screen belongs.

Since gtkmm 2.2:

Returns:
  The display to which screen belongs.

Cairo::FontOptions Gdk::Screen::get_font_options | ( |  | ) | const

Gets any options previously set with set_font_options().

Since gtkmm 2.10:

Returns:
  The current font options, or `0` if no default font options have been set.

int Gdk::Screen::get_height | ( |  | ) | const

Gets the height of screen in pixels.

Since gtkmm 2.2:

Returns:
  The height of screen in pixels.

int Gdk::Screen::get_height_mm | ( |  | ) | const

Returns the height of screen in millimeters.

Note that on some X servers this value will not be correct.

Since gtkmm 2.2:

Returns:
  The heigth of screen in millimeters.

int Gdk::Screen::get_monitor_at_point | ( | int | x,
|  | int | y |
| ) |  |  | const

Returns the monitor number in which the point ( x, y) is located.

Since gtkmm 2.2:

Parameters:

  | x | The x coordinate in the virtual screen.
  | y | The y coordinate in the virtual screen.

Returns:
  The monitor number in which the point ( x, y) lies, or a monitor close to ( x, y) if the point is not in any monitor.

int Gdk::Screen::get_monitor_at_window | ( | const Glib::RefPtr< Window >& | window | ) | const

Returns the number of the monitor in which the largest area of the bounding rectangle of window resides.

Since gtkmm 2.2:

Parameters:

  | window | A Gdk::Window.

Returns:
  The monitor number in which most of window is located, or if window does not intersect any monitors, a monitor, close to window.

void Gdk::Screen::get_monitor_geometry | ( | int | monitor_num,
|  | Rectangle& | dest |
| ) |  |  | const

Retrieves the Gdk::Rectangle representing the size and position of the individual monitor within the entire screen area.

Note that the size of the entire screen area can be retrieved via get_width() and get_height().

Since gtkmm 2.2:

Parameters:

  | monitor_num | The monitor number, between 0 and gdk_screen_get_n_monitors (screen).
  | dest | A Gdk::Rectangle to be filled with the monitor geometry.

int Gdk::Screen::get_monitor_height_mm | ( | int | monitor_num | ) | const

Gets the height in millimeters of the specified monitor.

Since gtkmm 2.14:

Parameters:

  | monitor_num | Number of the monitor, between 0 and gdk_screen_get_n_monitors (screen).

Returns:
  The height of the monitor, or -1 if not available.

Glib::ustring Gdk::Screen::get_monitor_plug_name | ( | int | monitor_num | ) | const

Returns the output name of the specified monitor.

Usually something like VGA, DVI, or TV, not the actual product name of the display device.

Since gtkmm 2.14:

Parameters:

  | monitor_num | Number of the monitor, between 0 and gdk_screen_get_n_monitors (screen).

Returns:
  A newly-allocated string containing the name of the monitor, or `0` if the name cannot be determined.

int Gdk::Screen::get_monitor_width_mm | ( | int | monitor_num | ) | const

Gets the width in millimeters of the specified monitor, if available.

Since gtkmm 2.14:

Parameters:

  | monitor_num | Number of the monitor, between 0 and gdk_screen_get_n_monitors (screen).

Returns:
  The width of the monitor, or -1 if not available.

int Gdk::Screen::get_n_monitors | ( |  | ) | const

Returns the number of monitors which screen consists of.

Since gtkmm 2.2:

Returns:
  Number of monitors which screen consists of.

int Gdk::Screen::get_number | ( |  | ) | const

Gets the index of screen among the screens in the display to which it belongs.

(See get_display())

Since gtkmm 2.2:

Returns:
  The index.

int Gdk::Screen::get_primary_monitor | ( |  | ) | const

Gets the primary monitor for screen.

The primary monitor is considered the monitor where the 'main desktop' lives. While normal application windows typically allow the window manager to place the windows, specialized desktop applications such as panels should place themselves on the primary monitor.

If no primary monitor is configured by the user, the return value will be 0, defaulting to the first monitor.

Since gtkmm 2.20:

Returns:
  An integer index for the primary monitor, or 0 if none is configured.

double Gdk::Screen::get_resolution | ( |  | ) | const

Gets the resolution for font handling on the screen; see set_resolution() for full details.

Since gtkmm 2.10:

Returns:
  The current resolution, or -1 if no resolution has been set.

Glib::RefPtr<const Colormap> Gdk::Screen::get_rgb_colormap | ( |  | ) | const

Gets the preferred colormap for rendering image data on screen.

Not a very useful function; historically, GDK could only render RGB image data to one colormap and visual, but in the current version it can render to any colormap and visual. So there's no need to call this function.

Since gtkmm 2.2:

Returns:
  The preferred colormap.

Glib::RefPtr<Colormap> Gdk::Screen::get_rgb_colormap | ( |  | ) |

Gets the preferred colormap for rendering image data on screen.

Not a very useful function; historically, GDK could only render RGB image data to one colormap and visual, but in the current version it can render to any colormap and visual. So there's no need to call this function.

Since gtkmm 2.2:

Returns:
  The preferred colormap.

Glib::RefPtr<const Visual> Gdk::Screen::get_rgb_visual | ( |  | ) | const

Gets a "preferred visual" chosen by GdkRGB for rendering image data on screen.

In previous versions of GDK, this was the only visual GdkRGB could use for rendering. In current versions, it's simply the visual GdkRGB would have chosen as the optimal one in those previous versions. GdkRGB can now render to drawables with any visual.

Since gtkmm 2.2:

Returns:
  The Gdk::Visual chosen by GdkRGB.

Glib::RefPtr<Visual> Gdk::Screen::get_rgb_visual | ( |  | ) |

Gets a "preferred visual" chosen by GdkRGB for rendering image data on screen.

In previous versions of GDK, this was the only visual GdkRGB could use for rendering. In current versions, it's simply the visual GdkRGB would have chosen as the optimal one in those previous versions. GdkRGB can now render to drawables with any visual.

Since gtkmm 2.2:

Returns:
  The Gdk::Visual chosen by GdkRGB.

Glib::RefPtr<const Colormap> Gdk::Screen::get_rgba_colormap | ( |  | ) | const

Gets a colormap to use for creating windows or pixmaps with an alpha channel.

The windowing system on which GTK+ is running may not support this capability, in which case `0` will be returned. Even if a non-`0` value is returned, its possible that the window's alpha channel won't be honored when displaying the window on the screen: in particular, for X an appropriate windowing manager and compositing manager must be running to provide appropriate display.

This functionality is not implemented in the Windows backend.

For setting an overall opacity for a top-level window, see gdk_window_set_opacity().

Since gtkmm 2.8:

Returns:
  A colormap to use for windows with an alpha channel or `0` if the capability is not available.

Glib::RefPtr<Colormap> Gdk::Screen::get_rgba_colormap | ( |  | ) |

Gets a colormap to use for creating windows or pixmaps with an alpha channel.

The windowing system on which GTK+ is running may not support this capability, in which case `0` will be returned. Even if a non-`0` value is returned, its possible that the window's alpha channel won't be honored when displaying the window on the screen: in particular, for X an appropriate windowing manager and compositing manager must be running to provide appropriate display.

This functionality is not implemented in the Windows backend.

For setting an overall opacity for a top-level window, see gdk_window_set_opacity().

Since gtkmm 2.8:

Returns:
  A colormap to use for windows with an alpha channel or `0` if the capability is not available.

Glib::RefPtr<const Visual> Gdk::Screen::get_rgba_visual | ( |  | ) | const

Gets a visual to use for creating windows or pixmaps with an alpha channel.

See the docs for get_rgba_colormap() for caveats.

Since gtkmm 2.8:

Returns:
  A visual to use for windows with an alpha channel or `0` if the capability is not available.

Glib::RefPtr<Visual> Gdk::Screen::get_rgba_visual | ( |  | ) |

Gets a visual to use for creating windows or pixmaps with an alpha channel.

See the docs for get_rgba_colormap() for caveats.

Since gtkmm 2.8:

Returns:
  A visual to use for windows with an alpha channel or `0` if the capability is not available.

Glib::RefPtr<const Window> Gdk::Screen::get_root_window | ( |  | ) | const

Gets the root window of screen.

Since gtkmm 2.2:

Returns:
  The root window.

Glib::RefPtr<Window> Gdk::Screen::get_root_window | ( |  | ) |

Gets the root window of screen.

Since gtkmm 2.2:

Returns:
  The root window.

template <class ValueType >

bool Gdk::Screen::get_setting | ( | const Glib::ustring & | name,
|  | ValueType & | value |
| ) |  |  | const`[inline]`

Glib::RefPtr<const Colormap> Gdk::Screen::get_system_colormap | ( |  | ) | const

Gets the system's default colormap for screen.

Since gtkmm 2.2:

Returns:
  The default colormap for screen.

Glib::RefPtr<Colormap> Gdk::Screen::get_system_colormap | ( |  | ) |

Gets the system's default colormap for screen.

Since gtkmm 2.2:

Returns:
  The default colormap for screen.

Glib::RefPtr<const Visual> Gdk::Screen::get_system_visual | ( |  | ) | const

Get the system's default visual for screen.

This is the visual for the root window of the display. The return value should not be freed.

Since gtkmm 2.2:

Returns:
  The system visual.

Glib::RefPtr<Visual> Gdk::Screen::get_system_visual | ( |  | ) |

Get the system's default visual for screen.

This is the visual for the root window of the display. The return value should not be freed.

Since gtkmm 2.2:

Returns:
  The system visual.

Glib::ListHandle< Glib::RefPtr<Window> > Gdk::Screen::get_toplevel_windows | ( |  | ) |

Obtains a list of all toplevel windows known to GDK on the screen screen.

A toplevel window is a child of the root window (see gdk_get_default_root_window()).

Since gtkmm 2.2:

Returns:
  List of toplevel windows.

int Gdk::Screen::get_width | ( |  | ) | const

Gets the width of screen in pixels.

Since gtkmm 2.2:

Returns:
  The width of screen in pixels.

int Gdk::Screen::get_width_mm | ( |  | ) | const

Gets the width of screen in millimeters.

Note that on some X servers this value will not be correct.

Since gtkmm 2.2:

Returns:
  The width of screen in millimeters.

Glib::ListHandle< Glib::RefPtr<Window> > Gdk::Screen::get_window_stack | ( |  | ) |

Returns a List of Gdk::Windows representing the current window stack.

On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING property on the root window, as described in the <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended Window Manager Hints</ulink>. If the window manager does not support the _NET_CLIENT_LIST_STACKING hint, this function returns `0`.

On other platforms, this function may return `0`, depending on whether it is implementable on that platform.

The returned list is newly allocated and owns references to the windows it contains, so it should be freed using Glib::list_free() and its windows unrefed using Glib::object_unref() when no longer needed.

Since gtkmm 2.10:

Returns:
  A list of Gdk::Windows for the current window stack, or `0`.

const GdkScreen* Gdk::Screen::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdkScreen* Gdk::Screen::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdkScreen* Gdk::Screen::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gdk::Screen::is_composited | ( |  | ) | const

Returns whether windows with an RGBA visual can reasonably be expected to have their alpha channel drawn correctly on the screen.

On X11 this function returns whether a compositing manager is compositing screen.

Since gtkmm 2.10:

Returns:
  Whether windows with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.

Glib::ListHandle< Glib::RefPtr<Visual> > Gdk::Screen::list_visuals | ( |  | ) |

Lists the available visuals for the specified screen.

A visual describes a hardware image data format. For example, a visual might support 24-bit color, or 8-bit color, and might expect pixels to be in a certain format.

Since gtkmm 2.2:

Returns:
  A list of visuals.

Glib::ustring Gdk::Screen::make_display_name | ( |  | ) |

Determines the name to pass to Gdk::Display::open() to get a Gdk::Display with this screen as the default screen.

Since gtkmm 2.2:

Returns:
  The name.

virtual void Gdk::Screen::on_size_changed | ( |  | ) | `[protected, virtual]`

void Gdk::Screen::set_default_colormap | ( | const Glib::RefPtr< const Colormap >& | colormap | ) |

Sets the default colormap for screen.

Since gtkmm 2.2:

Parameters:

  | colormap | A Gdk::Colormap.

void Gdk::Screen::set_font_options | ( | const Cairo::FontOptions & | options | ) |

Sets the default font options for the screen.

These options will be set on any Pango::Context's newly created with gdk_pango_context_get_for_screen(). Changing the default set of font options does not affect contexts that have already been created.

Since gtkmm 2.10:

Parameters:

  | options | A cairo_font_options_t, or `0` to unset any previously set default font options.

void Gdk::Screen::set_resolution | ( | double | dpi | ) |

Sets the resolution for font handling on the screen.

This is a scale factor between points specified in a Pango::FontDescription and cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

Since gtkmm 2.10:

Parameters:

  | dpi | The resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.).

Glib::SignalProxy0< void > Gdk::Screen::signal_size_changed | ( |  | ) |

The size_changed signal is emitted when the pixel width or height of a screen changes.

Prototype:
  `void on_my_size_changed()`

## Friends And Related Function Documentation

Glib::RefPtr< Gdk::Screen > wrap | ( | GdkScreen * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gdkmm/screen.h