Struct gdk::Screen[][src]

pub struct Screen(_);
Expand description

Screen objects are the GDK 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 Screen which combines several physical monitors (see n_monitors()).

GdkScreen is used throughout GDK and GTK+ 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 (system_visual()), the dimensions of the physical monitors (monitor_geometry()), etc.

Implementations

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 None.

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

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

Deprecated since 3.22

Returns

the currently active window, or None.

Gets the display to which the self belongs.

Returns

the display to which self belongs

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

Deprecated since 3.22

Use per-monitor information instead

Returns

the height of self in pixels.

Returns the height of self 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.

Deprecated since 3.22

Use per-monitor information instead

Returns

the heigth of self in millimeters.

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

Deprecated since 3.22

Use Display::monitor_at_point() instead

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.

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

Deprecated since 3.22

Use Display::monitor_at_window() instead

window

a Window

Returns

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

Retrieves the Rectangle 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 monitor_scale_factor()).

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

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

Deprecated since 3.22

Use Monitor::geometry() instead

monitor_num

the monitor number

Returns

dest

a Rectangle to be filled with the monitor geometry

Gets the height in millimeters of the specified monitor.

Deprecated since 3.22

Use Monitor::height_mm() instead

monitor_num

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

Returns

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

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

Deprecated since 3.22

Use Monitor::model() instead

monitor_num

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

Returns

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

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 Window::scale_factor() instead.

Deprecated since 3.22

Use Monitor::scale_factor() instead

monitor_num

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

Returns

the scale factor

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

Deprecated since 3.22

Use Monitor::width_mm() instead

monitor_num

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

Returns

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

Retrieves the Rectangle 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 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 self, use n_monitors().

Deprecated since 3.22

Use Monitor::workarea() instead

monitor_num

the monitor number

Returns

dest

a Rectangle to be filled with the monitor workarea

Returns the number of monitors which self consists of.

Deprecated since 3.22

Use Display::n_monitors() instead

Returns

number of monitors which self consists of

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

Deprecated since 3.22

Returns

the index

Gets the primary monitor for self. 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.

Deprecated since 3.22

Use Display::primary_monitor() instead

Returns

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

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

Returns

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

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

Returns

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

Gets the root window of self.

Returns

the root window

Get the system’s default visual for self. This is the visual for the root window of the display. The return value should not be freed.

Returns

the system visual

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

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

Returns

list of toplevel windows, free with g_list_free()

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

Deprecated since 3.22

Use per-monitor information instead

Returns

the width of self in pixels.

Gets the width of self 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.

Deprecated since 3.22

Use per-monitor information instead

Returns

the width of self in millimeters.

Returns a GList of GdkWindows 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 None.

On other platforms, this function may return None, 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.

Returns

a list of GdkWindows for the current window stack, or None.

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 self.

Returns

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

Lists the available visuals for the specified self. 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.

Returns

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

Determines the name to pass to Display::open() to get a Display with this screen as the default screen.

Deprecated since 3.22

Returns

a newly allocated string, free with g_free()

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

options

a cairo::FontOptions, or None to unset any previously set default font options.

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).

dpi

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

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

Returns

a Screen, or None if there is no default display.

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

Deprecated since 3.22

Use per-monitor information

Returns

the height of the default screen in pixels.

Returns the height of the default screen in millimeters. Note that on many X servers this value will not be correct.

Deprecated since 3.22

Use per-monitor information

Returns

the height of the default screen in millimeters, though it is not always correct.

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

Deprecated since 3.22

Use per-monitor information

Returns

the width of the default screen in pixels.

Returns the width of the default screen in millimeters. Note that on many X servers this value will not be correct.

Deprecated since 3.22

Use per-monitor information

Returns

the width of the default screen in millimeters, though it is not always correct.

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

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.

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

Gets any options previously set with set_font_options().

Returns

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Emit signal with details by signal id.

Emit signal by it’s name.

Same as emit but takes Value for the arguments.

Same as emit_by_name but takes Value for the arguments.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.