GdkMonitor: GDK 3 Reference Manual

## GdkMonitor GdkMonitor — Object representing an output |

## Functions

GdkDisplay * | gdk_monitor_get_display ()
void | gdk_monitor_get_geometry ()
void | gdk_monitor_get_workarea ()
int | gdk_monitor_get_width_mm ()
int | gdk_monitor_get_height_mm ()
const char * | gdk_monitor_get_manufacturer ()
const char * | gdk_monitor_get_model ()
int | gdk_monitor_get_scale_factor ()
int | gdk_monitor_get_refresh_rate ()
GdkSubpixelLayout | gdk_monitor_get_subpixel_layout ()
gboolean | gdk_monitor_is_primary ()

## Properties

GdkDisplay * | display | Read / Write / Construct Only
GdkRectangle * | geometry | Read
gint | height-mm | Read
gchar * | manufacturer | Read
gchar * | model | Read
gint | refresh-rate | Read
gint | scale-factor | Read
GdkSubpixelLayout | subpixel-layout | Read
gint | width-mm | Read
GdkRectangle * | workarea | Read

## Signals

void | invalidate | Run First

## Types and Values

| GdkMonitor
enum | GdkSubpixelLayout

## Object Hierarchy

        GObject
        ╰── GdkMonitor

## Includes

    #include <gdk/gdk.h>

## Description

GdkMonitor objects represent the individual outputs that are associated with a GdkDisplay. GdkDisplay has APIs to enumerate monitors with `gdk_display_get_monitors()` and to find particular monitors with `gdk_display_get_primary_monitor()` or `gdk_display_get_monitor_at_window()`.

GdkMonitor was introduced in GTK+ 3.22 and supersedes earlier APIs in GdkScreen to obtain monitor-related information.

## Functions

### gdk_monitor_get_display ()

    GdkDisplay *
    gdk_monitor_get_display (GdkMonitor *monitor);

Gets the display that this monitor belongs to.

#### Parameters

monitor | a GdkMonitor |

#### Returns

the display.

[transfer none]

Since: 3.22

### gdk_monitor_get_geometry ()

    void
    gdk_monitor_get_geometry (GdkMonitor *monitor,
                              GdkRectangle *geometry);

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 `gdk_monitor_get_scale_factor()`).

#### Parameters

monitor | a GdkMonitor |
geometry | a GdkRectangle to be filled wiht the monitor geometry. | [out]

Since: 3.22

### gdk_monitor_get_workarea ()

    void
    gdk_monitor_get_workarea (GdkMonitor *monitor,
                              GdkRectangle *workarea);

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 `gdk_monitor_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.

#### Parameters

monitor | a GdkMonitor |
workarea | a GdkRectangle to be filled with the monitor workarea. | [out]

Since: 3.22

### gdk_monitor_get_width_mm ()

    int
    gdk_monitor_get_width_mm (GdkMonitor *monitor);

Gets the width in millimeters of the monitor.

#### Parameters

monitor | a GdkMonitor |

#### Returns

the physical width of the monitor

Since: 3.22

### gdk_monitor_get_height_mm ()

    int
    gdk_monitor_get_height_mm (GdkMonitor *monitor);

Gets the height in millimeters of the monitor.

#### Parameters

monitor | a GdkMonitor |

#### Returns

the physical height of the monitor

Since: 3.22

### gdk_monitor_get_manufacturer ()

    const char *
    gdk_monitor_get_manufacturer (GdkMonitor *monitor);

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

#### Parameters

monitor | a GdkMonitor |

#### Returns

the name of the manufacturer, or `NULL`.

[transfer none][nullable]

### gdk_monitor_get_model ()

    const char *
    gdk_monitor_get_model (GdkMonitor *monitor);

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

#### Parameters

monitor | a GdkMonitor |

#### Returns

the monitor model, or `NULL`.

[transfer none][nullable]

### gdk_monitor_get_scale_factor ()

    int
    gdk_monitor_get_scale_factor (GdkMonitor *monitor);

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.

#### Parameters

monitor | a GdkMonitor |

#### Returns

the scale factor

Since: 3.22

### gdk_monitor_get_refresh_rate ()

    int
    gdk_monitor_get_refresh_rate (GdkMonitor *monitor);

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.

#### Parameters

monitor | a GdkMonitor |

#### Returns

the refresh rate in milli-Hertz, or 0

Since: 3.22

### gdk_monitor_get_subpixel_layout ()

    GdkSubpixelLayout
    gdk_monitor_get_subpixel_layout (GdkMonitor *monitor);

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

#### Parameters

monitor | a GdkMonitor |

#### Returns

the subpixel layout

Since: 3.22

### gdk_monitor_is_primary ()

    gboolean
    gdk_monitor_is_primary (GdkMonitor *monitor);

Gets whether this monitor should be considered primary (see `gdk_display_get_primary_monitor()`).

#### Parameters

monitor | a GdkMonitor |

#### Returns

`TRUE` if `monitor` is primary

Since: 3.22

## Types and Values

### GdkMonitor

    typedef struct _GdkMonitor GdkMonitor;

### enum GdkSubpixelLayout

This enumeration describes how the red, green and blue components of physical pixels on an output device are laid out.

#### Members

GDK_SUBPIXEL_LAYOUT_UNKNOWN | The layout is not known |
GDK_SUBPIXEL_LAYOUT_NONE | Not organized in this way |
GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB | The layout is horizontal, the order is RGB |
GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR | The layout is horizontal, the order is BGR |
GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB | The layout is vertical, the order is RGB |
GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR | The layout is vertical, the order is BGR |

Since: 3.22

## Property Details

### The `“display”` property

      “display”                  GdkDisplay *

The display of the monitor.

Flags: Read / Write / Construct Only

### The `“geometry”` property

      “geometry”                 GdkRectangle *

The geometry of the monitor.

Flags: Read

### The `“height-mm”` property

      “height-mm”                gint

The height of the monitor, in millimeters.

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“manufacturer”` property

      “manufacturer”             gchar *

The manufacturer name.

Flags: Read

Default value: NULL

### The `“model”` property

      “model”                    gchar *

The model name.

Flags: Read

Default value: NULL

### The `“refresh-rate”` property

      “refresh-rate”             gint

The refresh rate, in millihertz.

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“scale-factor”` property

      “scale-factor”             gint

The scale factor.

Flags: Read

Allowed values: >= 0

Default value: 1

### The `“subpixel-layout”` property

      “subpixel-layout”          GdkSubpixelLayout

The subpixel layout.

Flags: Read

Default value: GDK_SUBPIXEL_LAYOUT_UNKNOWN

### The `“width-mm”` property

      “width-mm”                 gint

The width of the monitor, in millimeters.

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“workarea”` property

      “workarea”                 GdkRectangle *

The workarea of the monitor.

Flags: Read

## Signal Details

### The `“invalidate”` signal

    void
    user_function (GdkMonitor *gdkmonitor,
                   gpointer    user_data)

Flags: Run First