[]Struct gdk::Screen

pub struct Screen(_, _);

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 Screen::get_n_monitors).

Screen 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 (Screen::get_system_visual), the dimensions of the physical monitors (Screen::get_monitor_geometry), etc.

Implementations

impl Screen[src]

pub fn get_active_window(&self) -> Option<Window>[src]

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 gobject::Object::unref when no longer needed.

Deprecated since 3.22

Returns

the currently active window, or None.

pub fn get_display(&self) -> Display[src]

Gets the display to which the self belongs.

Returns

the display to which self belongs

pub fn get_height(&self) -> i32[src]

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

Deprecated since 3.22

Use per-monitor information instead

Returns

the height of self in pixels.

pub fn get_height_mm(&self) -> i32[src]

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.

pub fn get_monitor_at_point(&self, x: i32, y: i32) -> i32[src]

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

Deprecated since 3.22

Use Display::get_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.

pub fn get_monitor_at_window<P: IsA<Window>>(&self, window: &P) -> i32[src]

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

Deprecated since 3.22

Use Display::get_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.

pub fn get_monitor_geometry(&self, monitor_num: i32) -> Rectangle[src]

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 Screen::get_monitor_scale_factor).

Monitor numbers start at 0. To obtain the number of monitors of self, use Screen::get_n_monitors.

Note that the size of the entire screen area can be retrieved via Screen::get_width and Screen::get_height.

Deprecated since 3.22

Use Monitor::get_geometry instead

monitor_num

the monitor number

dest

a Rectangle to be filled with the monitor geometry

pub fn get_monitor_height_mm(&self, monitor_num: i32) -> i32[src]

Gets the height in millimeters of the specified monitor.

Deprecated since 3.22

Use Monitor::get_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

pub fn get_monitor_plug_name(&self, monitor_num: i32) -> Option<GString>[src]

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::get_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

pub fn get_monitor_scale_factor(&self, monitor_num: i32) -> i32[src]

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 WindowExt::get_scale_factor instead.

Deprecated since 3.22

Use Monitor::get_scale_factor instead

monitor_num

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

Returns

the scale factor

pub fn get_monitor_width_mm(&self, monitor_num: i32) -> i32[src]

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

Deprecated since 3.22

Use Monitor::get_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

pub fn get_monitor_workarea(&self, monitor_num: i32) -> Rectangle[src]

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 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 self, use Screen::get_n_monitors.

Deprecated since 3.22

Use Monitor::get_workarea instead

monitor_num

the monitor number

dest

a Rectangle to be filled with the monitor workarea

pub fn get_n_monitors(&self) -> i32[src]

Returns the number of monitors which self consists of.

Deprecated since 3.22

Use Display::get_n_monitors instead

Returns

number of monitors which self consists of

pub fn get_number(&self) -> i32[src]

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

Deprecated since 3.22

Returns

the index

pub fn get_primary_monitor(&self) -> i32[src]

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::get_primary_monitor instead

Returns

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

pub fn get_resolution(&self) -> f64[src]

Gets the resolution for font handling on the screen; see Screen::set_resolution for full details.

Returns

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

pub fn get_rgba_visual(&self) -> Option<Visual>[src]

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 WindowExt::set_opacity.

Returns

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

pub fn get_root_window(&self) -> Option<Window>[src]

Gets the root window of self.

Returns

the root window

pub fn get_system_visual(&self) -> Option<Visual>[src]

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

pub fn get_toplevel_windows(&self) -> Vec<Window>[src]

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 glib::List::free, but its elements need not be freed.

Returns

list of toplevel windows, free with glib::List::free

pub fn get_width(&self) -> i32[src]

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

Deprecated since 3.22

Use per-monitor information instead

Returns

the width of self in pixels.

pub fn get_width_mm(&self) -> i32[src]

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.

pub fn get_window_stack(&self) -> Vec<Window>[src]

Returns a glib::List 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 glib::List::free and its windows unrefed using gobject::Object::unref when no longer needed.

Returns

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

pub fn is_composited(&self) -> bool[src]

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.

pub fn list_visuals(&self) -> Vec<Visual>[src]

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 glib::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

pub fn make_display_name(&self) -> GString[src]

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

pub fn set_font_options(&self, options: Option<&FontOptions>)[src]

Sets the default font options for the screen. These options will be set on any pango::Context’s newly created with gdk_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.

pub fn set_resolution(&self, dpi: f64)[src]

Sets the resolution for font handling on the screen. This is a scale factor between points specified in a pango::FontDescription 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.)

pub fn get_default() -> Option<Screen>[src]

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

Returns

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

pub fn height() -> i32[src]

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

Deprecated since 3.22

Use per-monitor information

Returns

the height of the default screen in pixels.

pub fn height_mm() -> i32[src]

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.

pub fn width() -> i32[src]

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

Deprecated since 3.22

Use per-monitor information

Returns

the width of the default screen in pixels.

pub fn width_mm() -> i32[src]

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.

pub fn connect_composited_changed<F: Fn(&Screen) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

pub fn connect_monitors_changed<F: Fn(&Screen) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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.

pub fn connect_size_changed<F: Fn(&Screen) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

pub fn connect_property_font_options_notify<F: Fn(&Screen) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_resolution_notify<F: Fn(&Screen) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

impl Screen[src]

pub fn get_font_options(&self) -> Option<FontOptions>[src]

Gets any options previously set with Screen::set_font_options.

Returns

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

pub fn get_setting(&self, name: &str) -> Option<Value>[src]

Retrieves a desktop-wide setting such as double-click time for the Screen self.

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

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.

Trait Implementations

impl Clone for Screen

impl Debug for Screen

impl Display for Screen[src]

impl Eq for Screen

impl Hash for Screen

impl Ord for Screen

impl<T: ObjectType> PartialEq<T> for Screen

impl<T: ObjectType> PartialOrd<T> for Screen

impl StaticType for Screen

Auto Trait Implementations

impl RefUnwindSafe for Screen

impl !Send for Screen

impl !Sync for Screen

impl Unpin for Screen

impl UnwindSafe for Screen

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.