gnome-rr: GNOME Desktop Library Reference Manual

## gnome-rr gnome-rr |

## Functions

GQuark | gnome_rr_error_quark ()
GnomeRRScreen * | gnome_rr_screen_new ()
void | gnome_rr_screen_new_async ()
GnomeRRScreen * | gnome_rr_screen_new_finish ()
GnomeRROutput ** | gnome_rr_screen_list_outputs ()
GnomeRRCrtc ** | gnome_rr_screen_list_crtcs ()
GnomeRRMode ** | gnome_rr_screen_list_modes ()
GnomeRRMode ** | gnome_rr_screen_list_clone_modes ()
GnomeRRCrtc * | gnome_rr_screen_get_crtc_by_id ()
gboolean | gnome_rr_screen_refresh ()
GnomeRROutput * | gnome_rr_screen_get_output_by_id ()
GnomeRROutput * | gnome_rr_screen_get_output_by_name ()
void | gnome_rr_screen_get_ranges ()
gboolean | gnome_rr_screen_get_dpms_mode ()
gboolean | gnome_rr_screen_set_dpms_mode ()
guint32 | gnome_rr_output_get_id ()
const char * | gnome_rr_output_get_name ()
const guint8 * | gnome_rr_output_get_edid_data ()
GnomeRRCrtc ** | gnome_rr_output_get_possible_crtcs ()
GnomeRRMode * | gnome_rr_output_get_current_mode ()
GnomeRRCrtc * | gnome_rr_output_get_crtc ()
gboolean | gnome_rr_output_is_builtin_display ()
void | gnome_rr_output_get_position ()
gboolean | gnome_rr_output_can_clone ()
GnomeRRMode ** | gnome_rr_output_list_modes ()
GnomeRRMode * | gnome_rr_output_get_preferred_mode ()
gboolean | gnome_rr_output_supports_mode ()
gboolean | gnome_rr_output_supports_underscanning ()
gboolean | gnome_rr_output_supports_color_transform ()
gboolean | gnome_rr_output_get_is_primary ()
gboolean | gnome_rr_output_get_is_underscanning ()
gint | gnome_rr_output_get_backlight ()
gboolean | gnome_rr_output_set_backlight ()
gboolean | gnome_rr_output_set_color_transform ()
const char * | gnome_rr_output_get_display_name ()
void | gnome_rr_output_get_ids_from_edid ()
gint | gnome_rr_output_get_min_backlight_step ()
void | gnome_rr_output_get_physical_size ()
guint32 | gnome_rr_mode_get_id ()
gboolean | gnome_rr_mode_get_is_tiled ()
guint | gnome_rr_mode_get_width ()
guint | gnome_rr_mode_get_height ()
int | gnome_rr_mode_get_freq ()
guint32 | gnome_rr_crtc_get_id ()
gboolean | gnome_rr_crtc_can_drive_output ()
GnomeRRMode * | gnome_rr_crtc_get_current_mode ()
void | gnome_rr_crtc_get_position ()
GnomeRRRotation | gnome_rr_crtc_get_current_rotation ()
GnomeRRRotation | gnome_rr_crtc_get_rotations ()
gboolean | gnome_rr_crtc_supports_rotation ()
gboolean | gnome_rr_crtc_get_gamma ()
gboolean | gnome_rr_crtc_set_gamma ()

## Types and Values

| GnomeRRScreen
| GnomeRRScreenClass
typedef | GnomeRROutput
typedef | GnomeRRCrtc
enum | GnomeRRDpmsMode
typedef | GnomeRRMode
enum | GnomeRRRotation
#define | GNOME_RR_ERROR
enum | GnomeRRError
#define | GNOME_RR_CONNECTOR_TYPE_PANEL

## Description

## Functions

### gnome_rr_error_quark ()

    GQuark
    gnome_rr_error_quark (void);

Returns the error domain used by the GnomeRR API.

#### Returns

the GnomeRR error domain

### gnome_rr_screen_new ()

    GnomeRRScreen *
    gnome_rr_screen_new (GdkScreen *screen,
                         GError **error);

Creates a unique GnomeRRScreen instance for the specified `display` .

#### Parameters

display | the windowing system connection used to query the display data |
error | will be set if XRandR is not supported |

#### Returns

a unique GnomeRRScreen instance, specific to the `screen` , or `NULL` if this could not be created, for instance if the driver does not support Xrandr 1.2. Each GdkDisplay thus has a single instance of GnomeRRScreen.

### gnome_rr_screen_new_async ()

    void
    gnome_rr_screen_new_async (GdkScreen *screen,
                               GAsyncReadyCallback callback,
                               gpointer user_data);

Asynchronously creates a new GnomeRRScreen instance.

On both success and error, `callback` will be invoked. You should use `gnome_rr_screen_new_finish()` to retrieve the newly created GnomeRRScreen instance.

#### Parameters

display | the windowing system connection used to query the display |
callback | the function to call when the GnomeRRScreen is ready, or on error |
user_data | data to pass to the `callback` |

### gnome_rr_screen_new_finish ()

    GnomeRRScreen *
    gnome_rr_screen_new_finish (GAsyncResult *result,
                                GError **error);

Finishes the asynchronous creation of a new GnomeRRScreen instance.

#### Parameters

result | the result of the asynchronous operation |
error | return location for an error |

#### Returns

the newly created instance; on error, this function will return `NULL` and set the given GError.

[transfer full]

### gnome_rr_screen_list_outputs ()

    GnomeRROutput **
    gnome_rr_screen_list_outputs (GnomeRRScreen *screen);

List all outputs of the given screen.

#### Parameters

screen | the screen to query |

#### Returns

the available outputs.

[array zero-terminated=1][transfer none]

### gnome_rr_screen_list_crtcs ()

    GnomeRRCrtc **
    gnome_rr_screen_list_crtcs (GnomeRRScreen *screen);

List all CRTCs of the given screen.

#### Parameters

screen | the screen to query |

#### Returns

the available CRTCs.

[array zero-terminated=1][transfer none]

### gnome_rr_screen_list_modes ()

    GnomeRRMode **
    gnome_rr_screen_list_modes (GnomeRRScreen *screen);

Lists all available XRandR modes.

#### Parameters

screen | the screen to query |

#### Returns

the available XRandR modes.

[array zero-terminated=1][transfer none]

### gnome_rr_screen_list_clone_modes ()

    GnomeRRMode **
    gnome_rr_screen_list_clone_modes (GnomeRRScreen *screen);

Lists all available XRandR clone modes.

#### Parameters

screen | the screen to query |

#### Returns

the available XRandR clone modes.

[array zero-terminated=1][transfer none]

### gnome_rr_screen_get_crtc_by_id ()

    GnomeRRCrtc *
    gnome_rr_screen_get_crtc_by_id (GnomeRRScreen *screen,
                                    guint32 id);

Retrieves the CRTC of the screen using the given identifier.

#### Parameters

screen | the screen to query |
id | the identifier of a CRTC |

#### Returns

the CRTC identified by `id` .

[transfer none]

### gnome_rr_screen_refresh ()

    gboolean
    gnome_rr_screen_refresh (GnomeRRScreen *screen,
                             GError **error);

Refreshes the screen configuration, and calls the screen's callback if it exists and if the screen's configuration changed.

#### Parameters

screen | a GnomeRRScreen |
error | location to store error, or `NULL` |

#### Returns

TRUE if the screen's configuration changed; otherwise, the function returns FALSE and a NULL error if the configuration didn't change, or FALSE and a non-NULL error if there was an error while refreshing the configuration.

### gnome_rr_screen_get_output_by_id ()

    GnomeRROutput *
    gnome_rr_screen_get_output_by_id (GnomeRRScreen *screen,
                                      guint32 id);

Retrieves the output of a screen using the given identifier.

#### Parameters

screen | the screen to query |
id | the identifier of an output |

#### Returns

the output identified by `id` .

[transfer none]

### gnome_rr_screen_get_output_by_name ()

    GnomeRROutput *
    gnome_rr_screen_get_output_by_name (GnomeRRScreen *screen,
                                        const char *name);

Retrieves the output for the given name.

#### Parameters

screen | the screen to query |

#### Returns

the output identified by `name` .

[transfer none]

### gnome_rr_screen_get_ranges ()

    void
    gnome_rr_screen_get_ranges (GnomeRRScreen *screen,
                                int *min_width,
                                int *max_width,
                                int *min_height,
                                int *max_height);

Get the ranges of the screen

#### Parameters

screen | a GnomeRRScreen |
min_width | the minimum width. | [out]
max_width | the maximum width. | [out]
min_height | the minimum height. | [out]
max_height | the maximum height. | [out]

### gnome_rr_screen_get_dpms_mode ()

    gboolean
    gnome_rr_screen_get_dpms_mode (GnomeRRScreen *screen,
                                   GnomeRRDpmsMode *mode,
                                   GError **error);

#### Parameters

mode | The current GnomeRRDpmsMode of this screen. | [out]

### gnome_rr_screen_set_dpms_mode ()

    gboolean
    gnome_rr_screen_set_dpms_mode (GnomeRRScreen *screen,
                                   GnomeRRDpmsMode mode,
                                   GError **error);

This method also disables the DPMS timeouts.

### gnome_rr_output_get_id ()

    guint32
    gnome_rr_output_get_id (GnomeRROutput *output);

### gnome_rr_output_get_name ()

    const char *
    gnome_rr_output_get_name (GnomeRROutput *output);

Retrieves the name of the given output.

#### Parameters

output | the output to query |

#### Returns

the name of the output.

[transfer none]

### gnome_rr_output_get_edid_data ()

    const guint8 *
    gnome_rr_output_get_edid_data (GnomeRROutput *output,
                                   gsize *size);

### gnome_rr_output_get_possible_crtcs ()

    GnomeRRCrtc **
    gnome_rr_output_get_possible_crtcs (GnomeRROutput *output);

Retrieves all the possible CRTC for the given output.

#### Parameters

output | the output to query |

#### Returns

the list of possible CRTC.

[array zero-terminated=1][transfer none]

### gnome_rr_output_get_current_mode ()

    GnomeRRMode *
    gnome_rr_output_get_current_mode (GnomeRROutput *output);

Retrieves the current mode of the given output.

#### Parameters

output | the output to query |

#### Returns

the current mode of this output.

[transfer none]

### gnome_rr_output_get_crtc ()

    GnomeRRCrtc *
    gnome_rr_output_get_crtc (GnomeRROutput *output);

Retrieves the CRTC of the given output.

#### Parameters

output | the output to query |

#### Returns

the CRTC of the output.

[transfer none]

### gnome_rr_output_is_builtin_display ()

    gboolean
    gnome_rr_output_is_builtin_display (GnomeRROutput *output);

Checks whether the given output is a built-in display.

#### Parameters

output | the output to query |

#### Returns

`TRUE` if the output is a built-in display

### gnome_rr_output_get_position ()

    void
    gnome_rr_output_get_position (GnomeRROutput *output,
                                  int *x,
                                  int *y);

#### Parameters

output | the output to query |
x | the X coordinate of the output. | [out][optional]
y | the Y coordinate of the output. | [out][optional]

### gnome_rr_output_can_clone ()

    gboolean
    gnome_rr_output_can_clone (GnomeRROutput *output,
                               GnomeRROutput *clone);

Checks whether the given output can clone another output.

#### Parameters

output | the output to query |
clone | the output to compare |

#### Returns

`TRUE` if the output can clone another output

### gnome_rr_output_list_modes ()

    GnomeRRMode **
    gnome_rr_output_list_modes (GnomeRROutput *output);

Retrieves all available modes of the given output.

#### Parameters

output | the output to query |

#### Returns

a list of modes.

[array zero-terminated=1][transfer none]

### gnome_rr_output_get_preferred_mode ()

    GnomeRRMode *
    gnome_rr_output_get_preferred_mode (GnomeRROutput *output);

Retrieves the preferred mode of the given output.

#### Parameters

output | the output to query |

#### Returns

the preferred mode of the output.

[transfer none]

### gnome_rr_output_supports_mode ()

    gboolean
    gnome_rr_output_supports_mode (GnomeRROutput *output,
                                   GnomeRRMode *mode);

Checks whether the given output supports a mode.

#### Parameters

output | the output to query |
mode | the mode to compare |

#### Returns

`TRUE` if the mode is supported

### gnome_rr_output_supports_underscanning ()

    gboolean
    gnome_rr_output_supports_underscanning
                                   (GnomeRROutput *output);

### gnome_rr_output_supports_color_transform ()

    gboolean
    gnome_rr_output_supports_color_transform
                                   (const GnomeRROutput *output);

### gnome_rr_output_get_is_primary ()

    gboolean
    gnome_rr_output_get_is_primary (GnomeRROutput *output);

Checks whether the given output is the primary output.

#### Parameters

output | the output to query |

#### Returns

`TRUE` if the output is the primary one

### gnome_rr_output_get_is_underscanning ()

    gboolean
    gnome_rr_output_get_is_underscanning (GnomeRROutput *output);

### gnome_rr_output_get_backlight ()

    gint
    gnome_rr_output_get_backlight (GnomeRROutput *output);

Retrieves the backlight brightness of the given output.

#### Parameters

output | the output to query |

#### Returns

The currently set backlight brightness

### gnome_rr_output_set_backlight ()

    gboolean
    gnome_rr_output_set_backlight (GnomeRROutput *output,
                                   gint value,
                                   GError **error);

Sets the backlight level for the given output.

The value is a percentage, with a range of [0, 100].

#### Parameters

output | the output to set |
value | the absolute value of the backlight |

#### Returns

`TRUE` for success

### gnome_rr_output_set_color_transform ()

    gboolean
    gnome_rr_output_set_color_transform (GnomeRROutput *output,
                                         GnomeRRCTM value,
                                         GError **error);

Sets the color transformation matrix for the given output.

#### Parameters

output | the output to set |
ctm | the color transformation matrix |
error | return location for an error |

#### Returns

`TRUE` on success

### gnome_rr_output_get_display_name ()

    const char *
    gnome_rr_output_get_display_name (GnomeRROutput *output);

Retrieves the display name of the given output.

#### Parameters

output | the output to query |

#### Returns

the display name.

[transfer none]

### gnome_rr_output_get_ids_from_edid ()

    void
    gnome_rr_output_get_ids_from_edid (GnomeRROutput *output,
                                       char **vendor,
                                       char **product,
                                       char **serial);

Retrieves the model identifiers from the EDID of the given output.

#### Parameters

output | the output to query |
vendor | the output's vendor string. | [out][optional][transfer full]
product | the output's product string. | [out][optional][transfer full]
serial | the output's serial string. | [out][optional][transfer full]

### gnome_rr_output_get_min_backlight_step ()

    gint
    gnome_rr_output_get_min_backlight_step
                                   (GnomeRROutput *output);

Retrieves the value of the minimum backlight step for the given output, as a percentage.

#### Parameters

output | the output to query |

#### Returns

The minimum backlight step available in percent

### gnome_rr_output_get_physical_size ()

    void
    gnome_rr_output_get_physical_size (GnomeRROutput *output,
                                       int *width_mm,
                                       int *height_mm);

Retrieves the physical size of the given output.

#### Parameters

output | the output to query |
width_mm | the width of the output, in millimeters. | [out][optional]
height_mm | the height of the output, in millimeters. | [out][optional]

### gnome_rr_mode_get_id ()

    guint32
    gnome_rr_mode_get_id (GnomeRRMode *mode);

### gnome_rr_mode_get_is_tiled ()

    gboolean
    gnome_rr_mode_get_is_tiled (GnomeRRMode *mode);

Returns TRUE if this mode is a tiled mode created for span a tiled monitor.

#### Parameters

mode | a GnomeRRMode |

### gnome_rr_mode_get_width ()

    guint
    gnome_rr_mode_get_width (GnomeRRMode *mode);

### gnome_rr_mode_get_height ()

    guint
    gnome_rr_mode_get_height (GnomeRRMode *mode);

### gnome_rr_mode_get_freq ()

    int
    gnome_rr_mode_get_freq (GnomeRRMode *mode);

### gnome_rr_crtc_get_id ()

    guint32
    gnome_rr_crtc_get_id (GnomeRRCrtc *crtc);

### gnome_rr_crtc_can_drive_output ()

    gboolean
    gnome_rr_crtc_can_drive_output (GnomeRRCrtc *crtc,
                                    GnomeRROutput *output);

### gnome_rr_crtc_get_current_mode ()

    GnomeRRMode *
    gnome_rr_crtc_get_current_mode (GnomeRRCrtc *crtc);

#### Parameters

crtc | a GnomeRRCrtc |

#### Returns

the current mode of this crtc.

[transfer none]

### gnome_rr_crtc_get_position ()

    void
    gnome_rr_crtc_get_position (GnomeRRCrtc *crtc,
                                int *x,
                                int *y);

#### Parameters

crtc | a GnomeRRCrtc |
x | . | [out][allow-none]
y | . | [out][allow-none]

### gnome_rr_crtc_get_current_rotation ()

    GnomeRRRotation
    gnome_rr_crtc_get_current_rotation (GnomeRRCrtc *crtc);

### gnome_rr_crtc_get_rotations ()

    GnomeRRRotation
    gnome_rr_crtc_get_rotations (GnomeRRCrtc *crtc);

### gnome_rr_crtc_supports_rotation ()

    gboolean
    gnome_rr_crtc_supports_rotation (GnomeRRCrtc *crtc,
                                     GnomeRRRotation rotation);

### gnome_rr_crtc_get_gamma ()

    gboolean
    gnome_rr_crtc_get_gamma (GnomeRRCrtc *crtc,
                             int *size,
                             unsigned short **red,
                             unsigned short **green,
                             unsigned short **blue);

#### Parameters

crtc | a GnomeRRCrtc |
red | the minimum width. | [out]
green | the maximum width. | [out]
blue | the minimum height. | [out]

#### Returns

`TRUE` for success

### gnome_rr_crtc_set_gamma ()

    gboolean
    gnome_rr_crtc_set_gamma (GnomeRRCrtc *crtc,
                             int size,
                             unsigned short *red,
                             unsigned short *green,
                             unsigned short *blue);

## Types and Values

### GnomeRRScreen

    typedef struct {
    	GObject parent;

    	GnomeRRScreenPrivate* priv;
    } GnomeRRScreen;

### GnomeRRScreenClass

    typedef struct {
    	GObjectClass parent_class;

            void (*changed)                (GnomeRRScreen *screen);
            void (*output_connected)       (GnomeRRScreen *screen, GnomeRROutput *output);
            void (*output_disconnected)    (GnomeRRScreen *screen, GnomeRROutput *output);
    } GnomeRRScreenClass;

### GnomeRROutput

    typedef struct GnomeRROutput GnomeRROutput;

### GnomeRRCrtc

    typedef struct GnomeRRCrtc GnomeRRCrtc;

### enum GnomeRRDpmsMode

#### Members

GNOME_RR_DPMS_ON |  |
GNOME_RR_DPMS_STANDBY |  |
GNOME_RR_DPMS_SUSPEND |  |
GNOME_RR_DPMS_OFF |  |
GNOME_RR_DPMS_UNKNOWN |  |

### GnomeRRMode

    typedef struct GnomeRRMode GnomeRRMode;

### enum GnomeRRRotation

#### Members

GNOME_RR_ROTATION_NEXT |  |
GNOME_RR_ROTATION_0 |  |
GNOME_RR_ROTATION_90 |  |
GNOME_RR_ROTATION_180 |  |
GNOME_RR_ROTATION_270 |  |
GNOME_RR_REFLECT_X |  |
GNOME_RR_REFLECT_Y |  |

### GNOME_RR_ERROR

    #define             GNOME_RR_ERROR

### enum GnomeRRError

#### Members

GNOME_RR_ERROR_UNKNOWN |  |
GNOME_RR_ERROR_NO_RANDR_EXTENSION |  |
GNOME_RR_ERROR_RANDR_ERROR |  |
GNOME_RR_ERROR_BOUNDS_ERROR |  |
GNOME_RR_ERROR_CRTC_ASSIGNMENT |  |
GNOME_RR_ERROR_NO_MATCHING_CONFIG |  |
GNOME_RR_ERROR_NO_DPMS_EXTENSION |  |

### GNOME_RR_CONNECTOR_TYPE_PANEL

    #define             GNOME_RR_CONNECTOR_TYPE_PANEL