Class: Gdk::Screen

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

Gdk::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 Gdk::Screen which combines several physical monitors (see gdk_screen_get_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 (gdk_screen_get_system_visual()), the dimensions of the physical monitors (gdk_screen_get_monitor_geometry()), etc.

Instance Method Summary collapse

Instance Method Details

#active_windowGdk::Window

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](www.freedesktop.org/Standards/wm-spec). If there is no currently currently active window, or the window manager does not support the _NET_ACTIVE_WINDOW hint, this function returns nil.

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

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

Returns:

  • (Gdk::Window)

    the currently active window, or nil.

#displayGdk::Display

Gets the display to which the screen belongs.

Returns:

#font_optionsGObject

Returns font-options.

Returns:

  • (GObject)

    font-options

#font_options=(font_options) ⇒ GObject

Parameters:

  • font_options (GObject)

Returns:

  • (GObject)

    font-options

  • (GObject)

    font-options

#get_monitor_at_point(x, y) ⇒ Integer

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

Parameters:

  • x (Integer)

    the x coordinate in the virtual screen.

  • y (Integer)

    the y coordinate in the virtual screen.

Returns:

  • (Integer)

    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.

#get_monitor_at_window(window) ⇒ Integer

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

Parameters:

Returns:

  • (Integer)

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

#get_monitor_geometry(monitor_num, dest) ⇒ nil

Retrieves the Gdk::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 gdk_screen_get_monitor_scale_factor()).

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

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

Parameters:

  • monitor_num (Integer)

    the monitor number

  • dest (Gdk::Rectangle)

    a Gdk::Rectangle to be filled with the monitor geometry

Returns:

  • (nil)

#get_monitor_height_mm(monitor_num) ⇒ Integer

Gets the height in millimeters of the specified monitor.

Parameters:

  • monitor_num (Integer)

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

Returns:

  • (Integer)

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

#get_monitor_plug_name(monitor_num) ⇒ String

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:

  • monitor_num (Integer)

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

Returns:

  • (String)

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

#get_monitor_scale_factor(monitor_num) ⇒ Integer

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 gdk_window_get_scale_factor() instead.

Parameters:

  • monitor_num (Integer)

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

Returns:

  • (Integer)

    the scale factor

#get_monitor_width_mm(monitor_num) ⇒ Integer

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

Parameters:

  • monitor_num (Integer)

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

Returns:

  • (Integer)

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

#get_monitor_workarea(monitor_num, dest) ⇒ nil

Retrieves the Gdk::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 gdk_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 gdk_screen_get_n_monitors().

Parameters:

  • monitor_num (Integer)

    the monitor number

  • dest (Gdk::Rectangle)

    a Gdk::Rectangle to be filled with the monitor workarea

Returns:

  • (nil)

#get_setting(name, value) ⇒ TrueClass

Retrieves a desktop-wide setting such as double-click time for the Gdk::Screen screen.

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

Parameters:

  • name (String)

    the name of the setting

  • value (GObject::Value)

    location to store the value of the setting

Returns:

  • (TrueClass)

    true if the setting existed and a value was stored in value, false otherwise.

#heightInteger

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

Returns:

  • (Integer)

    the height of screen in pixels.

#height_mmInteger

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.

Returns:

  • (Integer)

    the heigth of screen in millimeters.

#is_compositedTrueClass

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. expected to have their alpha channels drawn correctly on the screen.

Returns:

  • (TrueClass)

    Whether windows with RGBA visuals can reasonably be

#list_visualsGLib::List

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.

Returns:

  • (GLib::List)

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

#make_display_nameString

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

Returns:

  • (String)

    a newly allocated string, free with g_free()

#n_monitorsInteger

Returns the number of monitors which screen consists of.

Returns:

  • (Integer)

    number of monitors which screen consists of

#numberInteger

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

Returns:

  • (Integer)

    the index

#primary_monitorInteger

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.

Returns:

  • (Integer)

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

#resolutionFloat

Returns resolution.

Returns:

  • (Float)

    resolution

#resolution=(resolution) ⇒ Float

Parameters:

  • resolution (Float)

Returns:

  • (Float)

    resolution

  • (Float)

    resolution

#rgba_visualGdk::Visual

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 nil will be returned. Even if a non-nil 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 gdk_window_set_opacity().

Returns:

  • (Gdk::Visual)

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

#root_windowGdk::Window

Gets the root window of screen.

Returns:

#system_visualGdk::Visual

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.

Returns:

#toplevel_windowsGLib::List

Obtains a list of all toplevel windows known to GDK on the screen screen. 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:

  • (GLib::List)

    list of toplevel windows, free with g_list_free()

#widthInteger

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

Returns:

  • (Integer)

    the width of screen in pixels.

#width_mmInteger

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.

Returns:

  • (Integer)

    the width of screen in millimeters.

#window_stackGLib::List

Returns a #GList of Gdk::Windows 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](www.freedesktop.org/Standards/wm-spec). If the window manager does not support the _NET_CLIENT_LIST_STACKING hint, this function returns nil.

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

  • (GLib::List)

    a list of Gdk::Windows for the current window stack, or nil.