CdkMonitor

CdkMonitor — Object representing an output

Functions

Properties

CdkDisplay * display Read / Write / Construct Only
CdkRectangle * geometry Read
int height-mm Read
char * manufacturer Read
char * model Read
int refresh-rate Read
int scale-factor Read
CdkSubpixelLayout subpixel-layout Read
int width-mm Read
CdkRectangle * workarea Read

Signals

void invalidate Run First

Types and Values

Object Hierarchy

    GObject
    ╰── CdkMonitor

Includes

#include <cdk/cdkwayland.h>

Description

CdkMonitor objects represent the individual outputs that are associated with a CdkDisplay. CdkDisplay has APIs to enumerate monitors with cdk_display_get_n_monitors() and cdk_display_get_monitor(), and to find particular monitors with cdk_display_get_primary_monitor() or cdk_display_get_monitor_at_window().

CdkMonitor was introduced in CTK+ 3.22 and supersedes earlier APIs in CdkScreen to obtain monitor-related information.

Functions

cdk_monitor_get_display ()

CdkDisplay *
cdk_monitor_get_display (CdkMonitor *monitor);

Gets the display that this monitor belongs to.

Parameters

monitor

a CdkMonitor

 

Returns

the display.

[transfer none]

Since: 3.22


cdk_monitor_get_geometry ()

void
cdk_monitor_get_geometry (CdkMonitor *monitor,
                          CdkRectangle *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 cdk_monitor_get_scale_factor()).

Parameters

monitor

a CdkMonitor

 

geometry

a CdkRectangle to be filled with the monitor geometry.

[out]

Since: 3.22


cdk_monitor_get_workarea ()

void
cdk_monitor_get_workarea (CdkMonitor *monitor,
                          CdkRectangle *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 cdk_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 CdkMonitor

 

workarea

a CdkRectangle to be filled with the monitor workarea.

[out]

Since: 3.22


cdk_monitor_get_width_mm ()

int
cdk_monitor_get_width_mm (CdkMonitor *monitor);

Gets the width in millimeters of the monitor.

Parameters

monitor

a CdkMonitor

 

Returns

the physical width of the monitor

Since: 3.22


cdk_monitor_get_height_mm ()

int
cdk_monitor_get_height_mm (CdkMonitor *monitor);

Gets the height in millimeters of the monitor.

Parameters

monitor

a CdkMonitor

 

Returns

the physical height of the monitor

Since: 3.22


cdk_monitor_get_manufacturer ()

const char *
cdk_monitor_get_manufacturer (CdkMonitor *monitor);

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

Note that this value might also vary depending on actual display backend.

PNP ID registry is located at https://uefi.org/pnp_id_list

Parameters

monitor

a CdkMonitor

 

Returns

the name of the manufacturer, or NULL.

[transfer none][nullable]


cdk_monitor_get_model ()

const char *
cdk_monitor_get_model (CdkMonitor *monitor);

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

Parameters

monitor

a CdkMonitor

 

Returns

the monitor model, or NULL.

[transfer none][nullable]


cdk_monitor_get_scale_factor ()

int
cdk_monitor_get_scale_factor (CdkMonitor *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 cdk_window_get_scale_factor() instead.

Parameters

monitor

a CdkMonitor

 

Returns

the scale factor

Since: 3.22


cdk_monitor_get_refresh_rate ()

int
cdk_monitor_get_refresh_rate (CdkMonitor *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 CdkMonitor

 

Returns

the refresh rate in milli-Hertz, or 0

Since: 3.22


cdk_monitor_get_subpixel_layout ()

CdkSubpixelLayout
cdk_monitor_get_subpixel_layout (CdkMonitor *monitor);

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

Parameters

monitor

a CdkMonitor

 

Returns

the subpixel layout

Since: 3.22


cdk_monitor_is_primary ()

gboolean
cdk_monitor_is_primary (CdkMonitor *monitor);

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

Parameters

monitor

a CdkMonitor

 

Returns

TRUE if monitor is primary

Since: 3.22

Types and Values

CdkMonitor

typedef struct _CdkMonitor CdkMonitor;

enum CdkSubpixelLayout

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

Members

CDK_SUBPIXEL_LAYOUT_UNKNOWN

The layout is not known

 

CDK_SUBPIXEL_LAYOUT_NONE

Not organized in this way

 

CDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB

The layout is horizontal, the order is RGB

 

CDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR

The layout is horizontal, the order is BGR

 

CDK_SUBPIXEL_LAYOUT_VERTICAL_RGB

The layout is vertical, the order is RGB

 

CDK_SUBPIXEL_LAYOUT_VERTICAL_BGR

The layout is vertical, the order is BGR

 

Since: 3.22

Property Details

The “display” property

  “display”                  CdkDisplay *

The display of the monitor.

Owner: CdkMonitor

Flags: Read / Write / Construct Only


The “geometry” property

  “geometry”                 CdkRectangle *

The geometry of the monitor.

Owner: CdkMonitor

Flags: Read


The “height-mm” property

  “height-mm”                int

The height of the monitor, in millimeters.

Owner: CdkMonitor

Flags: Read

Allowed values: >= 0

Default value: 0


The “manufacturer” property

  “manufacturer”             char *

The manufacturer name.

Owner: CdkMonitor

Flags: Read

Default value: NULL


The “model” property

  “model”                    char *

The model name.

Owner: CdkMonitor

Flags: Read

Default value: NULL


The “refresh-rate” property

  “refresh-rate”             int

The refresh rate, in millihertz.

Owner: CdkMonitor

Flags: Read

Allowed values: >= 0

Default value: 0


The “scale-factor” property

  “scale-factor”             int

The scale factor.

Owner: CdkMonitor

Flags: Read

Allowed values: >= 0

Default value: 1


The “subpixel-layout” property

  “subpixel-layout”          CdkSubpixelLayout

The subpixel layout.

Owner: CdkMonitor

Flags: Read

Default value: CDK_SUBPIXEL_LAYOUT_UNKNOWN


The “width-mm” property

  “width-mm”                 int

The width of the monitor, in millimeters.

Owner: CdkMonitor

Flags: Read

Allowed values: >= 0

Default value: 0


The “workarea” property

  “workarea”                 CdkRectangle *

The workarea of the monitor.

Owner: CdkMonitor

Flags: Read

Signal Details

The “invalidate” signal

void
user_function (CdkMonitor *cdkmonitor,
               gpointer    user_data)

Flags: Run First