Gdk::Monitor Class Reference

Object representing an output. More...

`#include <gdkmm/monitor.h>`

Inheritance diagram for Gdk::Monitor:
[legend]

## Public Member Functions

| Monitor (Monitor && src) noexcept
Monitor & | operator= (Monitor && src) noexcept
| ~Monitor () noexcept override
GdkMonitor * | gobj ()
| Provides access to the underlying C GObject.
const GdkMonitor * | gobj () const
| Provides access to the underlying C GObject.
GdkMonitor * | 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< Display > | get_display ()
| Gets the display that this monitor belongs to.
Glib::RefPtr< const Display > | get_display () const
| Gets the display that this monitor belongs to.
void | get_geometry (Rectangle & geometry) const
| Retrieves the size and position of an individual monitor within the display coordinate space.
void | get_workarea (Rectangle & workarea) const
| Retrieves the size and position of the “work area” on a monitor within the display coordinate space.
int | get_width_mm () const
| Gets the width in millimeters of the monitor.
int | get_height_mm () const
| Gets the height in millimeters of the monitor.
Glib::ustring | get_manufacturer () const
| Gets the name of the monitor's manufacturer, if available.
Glib::ustring | get_model () const
| Gets the a string identifying the monitor model, if available.
int | get_scale_factor () const
| Gets the internal scale factor that maps from monitor coordinates to the actual device pixels.
int | get_refresh_rate () const
| Gets the refresh rate of the monitor, if available.
SubpixelLayout | get_subpixel_layout () const
| Gets information about the layout of red, green and blue primaries for each pixel in this monitor, if available.
bool | is_primary () const
| Gets whether this monitor should be considered primary (see Gdk::Display::get_primary_monitor()).
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const
| The display of the monitor.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_manufacturer () const
| The manufacturer name.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_model () const
| The model name.
Glib::PropertyProxy_ReadOnly< int > | property_scale_factor () const
| The scale factor.
Glib::PropertyProxy_ReadOnly< Gdk::Rectangle > | property_geometry () const
| The geometry of the monitor.
Glib::PropertyProxy_ReadOnly< Gdk::Rectangle > | property_workarea () const
| The workarea of the monitor.
Glib::PropertyProxy_ReadOnly< int > | property_width_mm () const
| The width of the monitor, in millimeters.
Glib::PropertyProxy_ReadOnly< int > | property_height_mm () const
| The height of the monitor, in millimeters.
Glib::PropertyProxy_ReadOnly< int > | property_refresh_rate () const
| The refresh rate, in millihertz.
Glib::PropertyProxy_ReadOnly< SubpixelLayout > | property_subpixel_layout () const
| The subpixel layout.

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions

| Monitor ()

## Related Symbols

(Note that these are not member symbols.)
Glib::RefPtr< Gdk::Monitor > | wrap (GdkMonitor * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Object representing an output.

Gdk::Monitor objects represent the individual outputs that are associated with a Gdk::Display. Display has APIs to enumerate monitors with Display::get_n_monitors() and Display::get_monitor() and to find particular monitors with Display::get_primary_monitor(), Display::get_monitor_at_point() or Display::get_monitor_at_window().

Monitor was introduced in gtkmm 3.22 and supersedes earlier APIs in Gdk::Screen to obtain monitor-related information.

Since gtkmm 3.22:

## Constructor & Destructor Documentation

## Monitor() [1/2]

Gdk::Monitor::Monitor | ( | Monitor && | src | ) |

noexcept

## ~Monitor()

Gdk::Monitor::~Monitor | ( |  | ) |

override noexcept

## Monitor() [2/2]

Gdk::Monitor::Monitor | ( |  | ) |

protected

## Member Function Documentation

## get_display() [1/2]

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

Gets the display that this monitor belongs to.

Since gtkmm 3.22:

Returns
  The display.

## get_display() [2/2]

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

Gets the display that this monitor belongs to.

Since gtkmm 3.22:

Returns
  The display.

## get_geometry()

void Gdk::Monitor::get_geometry | ( | Rectangle & | geometry | ) | const

Retrieves the size and position of an individual monitor within the display coordinate space.

The returned geometry is in ”application pixels”, not in ”device pixels” (see get_scale_factor()).

Since gtkmm 3.22:

Parameters

  geometry | A Gdk::Rectangle to be filled with the monitor geometry.

## get_height_mm()

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

Gets the height in millimeters of the monitor.

Since gtkmm 3.22:

Returns
  The physical height of the monitor.

## get_manufacturer()

Glib::ustring Gdk::Monitor::get_manufacturer | ( |  | ) | const

Gets the name of the monitor's manufacturer, if available.

Returns
  The name of the manufacturer, or `nullptr`.

## get_model()

Glib::ustring Gdk::Monitor::get_model | ( |  | ) | const

Gets the a string identifying the monitor model, if available.

Returns
  The monitor model, or `nullptr`.

## get_refresh_rate()

int Gdk::Monitor::get_refresh_rate | ( |  | ) | const

Gets the refresh rate of the monitor, if available.

The value is in milli-Hertz, so a refresh rate of 60Hz is returned as 60000.

Since gtkmm 3.22:

Returns
  The refresh rate in milli-Hertz, or 0.

## get_scale_factor()

int Gdk::Monitor::get_scale_factor | ( |  | ) | const

Gets the internal scale factor that maps from monitor coordinates to the actual device pixels.

On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).

This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a window where it is better to use Gdk::Window::get_scale_factor() instead.

Since gtkmm 3.22:

Returns
  The scale factor.

## get_subpixel_layout()

SubpixelLayout Gdk::Monitor::get_subpixel_layout | ( |  | ) | const

Gets information about the layout of red, green and blue primaries for each pixel in this monitor, if available.

Since gtkmm 3.22:

Returns
  The subpixel layout.

## get_type()

static GType Gdk::Monitor::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

## get_width_mm()

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

Gets the width in millimeters of the monitor.

Since gtkmm 3.22:

Returns
  The physical width of the monitor.

## get_workarea()

void Gdk::Monitor::get_workarea | ( | Rectangle & | workarea | ) | const

Retrieves the size and position of the “work area” on a monitor within the display coordinate space.

The returned geometry is in ”application pixels”, not in ”device pixels” (see get_scale_factor()).

The work area should be considered when positioning menus and similar popups, to avoid placing them below panels, docks or other desktop components.

Note that not all backends may have a concept of workarea. This function will return the monitor geometry if a workarea is not available, or does not apply.

Since gtkmm 3.22:

Parameters

  workarea | A Gdk::Rectangle to be filled with the monitor workarea.

## gobj() [1/2]

GdkMonitor * Gdk::Monitor::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

## gobj() [2/2]

const GdkMonitor * Gdk::Monitor::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

## gobj_copy()

GdkMonitor * Gdk::Monitor::gobj_copy | ( |  | ) |

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

## is_primary()

bool Gdk::Monitor::is_primary | ( |  | ) | const

Gets whether this monitor should be considered primary (see Gdk::Display::get_primary_monitor()).

Since gtkmm 3.22:

Returns
  `true` if monitor is primary.

## operator=()

Monitor & Gdk::Monitor::operator= | ( | Monitor && | src | ) |

noexcept

## property_display()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Monitor::property_display | ( |  | ) | const

The display of the monitor.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_geometry()

Glib::PropertyProxy_ReadOnly< Gdk::Rectangle > Gdk::Monitor::property_geometry | ( |  | ) | const

The geometry of the monitor.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_height_mm()

Glib::PropertyProxy_ReadOnly< int > Gdk::Monitor::property_height_mm | ( |  | ) | const

The height of the monitor, in millimeters.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_manufacturer()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Monitor::property_manufacturer | ( |  | ) | const

The manufacturer name.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_model()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Monitor::property_model | ( |  | ) | const

The model name.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_refresh_rate()

Glib::PropertyProxy_ReadOnly< int > Gdk::Monitor::property_refresh_rate | ( |  | ) | const

The refresh rate, in millihertz.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_scale_factor()

Glib::PropertyProxy_ReadOnly< int > Gdk::Monitor::property_scale_factor | ( |  | ) | const

The scale factor.

Default value: 1

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_subpixel_layout()

Glib::PropertyProxy_ReadOnly< SubpixelLayout > Gdk::Monitor::property_subpixel_layout | ( |  | ) | const

The subpixel layout.

Default value: Gdk::SUBPIXEL_LAYOUT_UNKNOWN

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_width_mm()

Glib::PropertyProxy_ReadOnly< int > Gdk::Monitor::property_width_mm | ( |  | ) | const

The width of the monitor, in millimeters.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## property_workarea()

Glib::PropertyProxy_ReadOnly< Gdk::Rectangle > Gdk::Monitor::property_workarea | ( |  | ) | const

The workarea of the monitor.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## Friends And Related Symbol Documentation

## wrap()

Glib::RefPtr< Gdk::Monitor > wrap | ( | GdkMonitor * | 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.