CdkScreen

CdkScreen — Object representing a physical screen

Functions

Properties

gpointer font-options Read / Write
double resolution Read / Write

Signals

void composited-changed Run Last
void monitors-changed Run Last
void size-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── CdkScreen

Includes

#include <cdk/cdk.h>

Description

CdkScreen objects are the CDK representation of the screen on which windows can be displayed and on which the pointer moves. X originally identified screens with physical screens, but nowadays it is more common to have a single CdkScreen which combines several physical monitors (see cdk_screen_get_n_monitors()).

CdkScreen is used throughout CDK and CTK+ 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 visual (cdk_screen_get_system_visual()), the dimensions of the physical monitors (cdk_screen_get_monitor_geometry()), etc.

Functions

cdk_screen_get_default ()

CdkScreen *
cdk_screen_get_default (void);

Gets the default screen for the default display. (See cdk_display_get_default()).

Returns

a CdkScreen, or NULL if there is no default display.

[nullable][transfer none]

Since: 2.2


cdk_screen_get_system_visual ()

CdkVisual *
cdk_screen_get_system_visual (CdkScreen *screen);

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.

Parameters

screen

a CdkScreen.

 

Returns

the system visual.

[transfer none]

Since: 2.2


cdk_screen_get_rgba_visual ()

CdkVisual *
cdk_screen_get_rgba_visual (CdkScreen *screen);

Gets a visual to use for creating windows with an alpha channel. The windowing system on which CTK+ is running may not support this capability, in which case NULL will be returned. Even if a non-NULL 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 cdk_window_set_opacity().

Parameters

screen

a CdkScreen

 

Returns

a visual to use for windows with an alpha channel or NULL if the capability is not available.

[nullable][transfer none]

Since: 2.8


cdk_screen_is_composited ()

gboolean
cdk_screen_is_composited (CdkScreen *screen);

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 .

Parameters

screen

a CdkScreen

 

Returns

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

Since: 2.10


cdk_screen_get_root_window ()

CdkWindow *
cdk_screen_get_root_window (CdkScreen *screen);

Gets the root window of screen .

Parameters

screen

a CdkScreen

 

Returns

the root window.

[transfer none]

Since: 2.2


cdk_screen_get_display ()

CdkDisplay *
cdk_screen_get_display (CdkScreen *screen);

Gets the display to which the screen belongs.

Parameters

screen

a CdkScreen

 

Returns

the display to which screen belongs.

[transfer none]

Since: 2.2


cdk_screen_get_number ()

gint
cdk_screen_get_number (CdkScreen *screen);

cdk_screen_get_number has been deprecated since version 3.22 and should not be used in newly-written code.

Gets the index of screen among the screens in the display to which it belongs. (See cdk_screen_get_display())

Parameters

screen

a CdkScreen

 

Returns

the index

Since: 2.2


cdk_screen_get_width ()

gint
cdk_screen_get_width (CdkScreen *screen);

cdk_screen_get_width has been deprecated since version 3.22 and should not be used in newly-written code.

Use per-monitor information instead

Gets the width of screen in pixels. The returned size is in ”application pixels”, not in ”device pixels” (see cdk_screen_get_monitor_scale_factor()).

Parameters

screen

a CdkScreen

 

Returns

the width of screen in pixels.

Since: 2.2


cdk_screen_get_height ()

gint
cdk_screen_get_height (CdkScreen *screen);

cdk_screen_get_height has been deprecated since version 3.22 and should not be used in newly-written code.

Use per-monitor information instead

Gets the height of screen in pixels. The returned size is in ”application pixels”, not in ”device pixels” (see cdk_screen_get_monitor_scale_factor()).

Parameters

screen

a CdkScreen

 

Returns

the height of screen in pixels.

Since: 2.2


cdk_screen_get_width_mm ()

gint
cdk_screen_get_width_mm (CdkScreen *screen);

cdk_screen_get_width_mm has been deprecated since version 3.22 and should not be used in newly-written code.

Use per-monitor information instead

Gets the width of screen in millimeters.

Note that this value is somewhat ill-defined when the screen has multiple monitors of different resolution. It is recommended to use the monitor dimensions instead.

Parameters

screen

a CdkScreen

 

Returns

the width of screen in millimeters.

Since: 2.2


cdk_screen_get_height_mm ()

gint
cdk_screen_get_height_mm (CdkScreen *screen);

cdk_screen_get_height_mm has been deprecated since version 3.22 and should not be used in newly-written code.

Use per-monitor information instead

Returns the height of screen in millimeters.

Note that this value is somewhat ill-defined when the screen has multiple monitors of different resolution. It is recommended to use the monitor dimensions instead.

Parameters

screen

a CdkScreen

 

Returns

the heigth of screen in millimeters.

Since: 2.2


cdk_screen_list_visuals ()

GList *
cdk_screen_list_visuals (CdkScreen *screen);

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.

Call g_list_free() on the return value when you’re finished with it.

Parameters

screen

the relevant CdkScreen.

 

Returns

a list of visuals; the list must be freed, but not its contents.

[transfer container][element-type CdkVisual]

Since: 2.2


cdk_screen_get_toplevel_windows ()

GList *
cdk_screen_get_toplevel_windows (CdkScreen *screen);

Obtains a list of all toplevel windows known to CDK on the screen screen . A toplevel window is a child of the root window (see cdk_get_default_root_window()).

The returned list should be freed with g_list_free(), but its elements need not be freed.

Parameters

screen

The CdkScreen where the toplevels are located.

 

Returns

list of toplevel windows, free with g_list_free().

[transfer container][element-type CdkWindow]

Since: 2.2


cdk_screen_make_display_name ()

gchar *
cdk_screen_make_display_name (CdkScreen *screen);

cdk_screen_make_display_name has been deprecated since version 3.22 and should not be used in newly-written code.

Determines the name to pass to cdk_display_open() to get a CdkDisplay with this screen as the default screen.

Parameters

screen

a CdkScreen

 

Returns

a newly allocated string, free with g_free()

Since: 2.2


cdk_screen_get_n_monitors ()

gint
cdk_screen_get_n_monitors (CdkScreen *screen);

cdk_screen_get_n_monitors has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_display_get_n_monitors() instead

Returns the number of monitors which screen consists of.

Parameters

screen

a CdkScreen

 

Returns

number of monitors which screen consists of

Since: 2.2


cdk_screen_get_primary_monitor ()

gint
cdk_screen_get_primary_monitor (CdkScreen *screen);

cdk_screen_get_primary_monitor has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_display_get_primary_monitor() instead

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.

Parameters

screen

a CdkScreen.

 

Returns

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

Since: 2.20


cdk_screen_get_monitor_geometry ()

void
cdk_screen_get_monitor_geometry (CdkScreen *screen,
                                 gint monitor_num,
                                 CdkRectangle *dest);

cdk_screen_get_monitor_geometry has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_geometry() instead

Retrieves the CdkRectangle representing the size and position of the individual monitor within the entire screen area. The returned geometry is in ”application pixels”, not in ”device pixels” (see cdk_screen_get_monitor_scale_factor()).

Monitor numbers start at 0. To obtain the number of monitors of screen , use cdk_screen_get_n_monitors().

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

Parameters

screen

a CdkScreen

 

monitor_num

the monitor number

 

dest

a CdkRectangle to be filled with the monitor geometry.

[out][allow-none]

Since: 2.2


cdk_screen_get_monitor_workarea ()

void
cdk_screen_get_monitor_workarea (CdkScreen *screen,
                                 gint monitor_num,
                                 CdkRectangle *dest);

cdk_screen_get_monitor_workarea has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_workarea() instead

Retrieves the CdkRectangle representing the size and position of the “work area” on a monitor within the entire screen area. The returned geometry is in ”application pixels”, not in ”device pixels” (see cdk_screen_get_monitor_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.

Monitor numbers start at 0. To obtain the number of monitors of screen , use cdk_screen_get_n_monitors().

Parameters

screen

a CdkScreen

 

monitor_num

the monitor number

 

dest

a CdkRectangle to be filled with the monitor workarea.

[out][allow-none]

Since: 3.4


cdk_screen_get_monitor_at_point ()

gint
cdk_screen_get_monitor_at_point (CdkScreen *screen,
                                 gint x,
                                 gint y);

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

Parameters

screen

a CdkScreen.

 

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.

Since: 2.2


cdk_screen_get_monitor_at_window ()

gint
cdk_screen_get_monitor_at_window (CdkScreen *screen,
                                  CdkWindow *window);

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

Parameters

screen

a CdkScreen.

 

window

a CdkWindow

 

Returns

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

Since: 2.2


cdk_screen_get_monitor_height_mm ()

gint
cdk_screen_get_monitor_height_mm (CdkScreen *screen,
                                  gint monitor_num);

cdk_screen_get_monitor_height_mm has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_height_mm() instead

Gets the height in millimeters of the specified monitor.

Parameters

screen

a CdkScreen

 

monitor_num

number of the monitor, between 0 and cdk_screen_get_n_monitors (screen)

 

Returns

the height of the monitor, or -1 if not available

Since: 2.14


cdk_screen_get_monitor_width_mm ()

gint
cdk_screen_get_monitor_width_mm (CdkScreen *screen,
                                 gint monitor_num);

cdk_screen_get_monitor_width_mm has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_width_mm() instead

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

Parameters

screen

a CdkScreen

 

monitor_num

number of the monitor, between 0 and cdk_screen_get_n_monitors (screen)

 

Returns

the width of the monitor, or -1 if not available

Since: 2.14


cdk_screen_get_monitor_plug_name ()

gchar *
cdk_screen_get_monitor_plug_name (CdkScreen *screen,
                                  gint monitor_num);

cdk_screen_get_monitor_plug_name has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_model() instead

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

Parameters

screen

a CdkScreen

 

monitor_num

number of the monitor, between 0 and cdk_screen_get_n_monitors (screen)

 

Returns

a newly-allocated string containing the name of the monitor, or NULL if the name cannot be determined.

[nullable]

Since: 2.14


cdk_screen_get_monitor_scale_factor ()

gint
cdk_screen_get_monitor_scale_factor (CdkScreen *screen,
                                     gint monitor_num);

cdk_screen_get_monitor_scale_factor has been deprecated since version 3.22 and should not be used in newly-written code.

Use cdk_monitor_get_scale_factor() instead

Returns 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

screen

screen to get scale factor for

 

monitor_num

number of the monitor, between 0 and cdk_screen_get_n_monitors (screen)

 

Returns

the scale factor

Since: 3.10


cdk_screen_get_setting ()

gboolean
cdk_screen_get_setting (CdkScreen *screen,
                        const gchar *name,
                        GValue *value);

Retrieves a desktop-wide setting such as double-click time for the CdkScreen screen .

FIXME needs a list of valid settings here, or a link to more information.

Parameters

screen

the CdkScreen where the setting is located

 

name

the name of the setting

 

value

location to store the value of the setting

 

Returns

TRUE if the setting existed and a value was stored in value , FALSE otherwise.

Since: 2.2


cdk_screen_get_font_options ()

const cairo_font_options_t *
cdk_screen_get_font_options (CdkScreen *screen);

Gets any options previously set with cdk_screen_set_font_options().

Parameters

screen

a CdkScreen

 

Returns

the current font options, or NULL if no default font options have been set.

[nullable]

Since: 2.10


cdk_screen_set_font_options ()

void
cdk_screen_set_font_options (CdkScreen *screen,
                             const cairo_font_options_t *options);

Sets the default font options for the screen. These options will be set on any PangoContext’s newly created with cdk_pango_context_get_for_screen(). Changing the default set of font options does not affect contexts that have already been created.

Parameters

screen

a CdkScreen

 

options

a cairo_font_options_t, or NULL to unset any previously set default font options.

[allow-none]

Since: 2.10


cdk_screen_get_resolution ()

gdouble
cdk_screen_get_resolution (CdkScreen *screen);

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

Parameters

screen

a CdkScreen

 

Returns

the current resolution, or -1 if no resolution has been set.

Since: 2.10


cdk_screen_set_resolution ()

void
cdk_screen_set_resolution (CdkScreen *screen,
                           gdouble dpi);

Sets the resolution for font handling on the screen. This is a scale factor between points specified in a PangoFontDescription and cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

Parameters

screen

a CdkScreen

 

dpi

the resolution in “dots per inch”. (Physical inches aren’t actually involved; the terminology is conventional.)

 

Since: 2.10


cdk_screen_get_active_window ()

CdkWindow *
cdk_screen_get_active_window (CdkScreen *screen);

cdk_screen_get_active_window has been deprecated since version 3.22 and should not be used in newly-written code.

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 Extended Window Manager Hints. If there is no currently currently active window, or the window manager does not support the _NET_ACTIVE_WINDOW hint, this function returns NULL.

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

The returned window should be unrefed using g_object_unref() when no longer needed.

Parameters

screen

a CdkScreen

 

Returns

the currently active window, or NULL.

[nullable][transfer full]

Since: 2.10


cdk_screen_get_window_stack ()

GList *
cdk_screen_get_window_stack (CdkScreen *screen);

Returns a GList of CdkWindows 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 Extended Window Manager Hints. If the window manager does not support the _NET_CLIENT_LIST_STACKING hint, this function returns NULL.

On other platforms, this function may return NULL, 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 g_list_free() and its windows unrefed using g_object_unref() when no longer needed.

Parameters

screen

a CdkScreen

 

Returns

a list of CdkWindows for the current window stack, or NULL.

[nullable][transfer full][element-type CdkWindow]

Since: 2.10

Types and Values

CdkScreen

typedef struct _CdkScreen CdkScreen;

Property Details

The “font-options” property

  “font-options”             gpointer

The default font options for the screen.

Owner: CdkScreen

Flags: Read / Write


The “resolution” property

  “resolution”               double

The resolution for fonts on the screen.

Owner: CdkScreen

Flags: Read / Write

Allowed values: [-1,10000]

Default value: -1

Signal Details

The “composited-changed” signal

void
user_function (CdkScreen *screen,
               gpointer   user_data)

The ::composited-changed signal is emitted when the composited status of the screen changes

Parameters

screen

the object on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.10


The “monitors-changed” signal

void
user_function (CdkScreen *screen,
               gpointer   user_data)

The ::monitors-changed signal is emitted when the number, size or position of the monitors attached to the screen change.

Only for X11 and OS X for now. A future implementation for Win32 may be a possibility.

Parameters

screen

the object on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.14


The “size-changed” signal

void
user_function (CdkScreen *screen,
               gpointer   user_data)

The ::size-changed signal is emitted when the pixel width or height of a screen changes.

Parameters

screen

the object on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.2