Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

Gdk::Screen

class Gdk::Screen

Gdk::Screen objects are the GDK representation of a physical screen. It 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 colormap (Gdk::Screen#default_colormap), the screen width (Gdk::Screen#width), etc.

Note that a screen may consist of multiple monitors which are merged to form a large screen area.

Class Methods

Gdk::Screen.default
Gets the default screen for the default display. (See Gdk::Display.default). Since 2.2
  • Returns: a Gdk::Screen, or nil if there is no default display

Instance Methods

default_colormap
Gets the default colormap for screen. Since 2.2
default_colormap=(colormap)
Sets the default colormap for screen. Since 2.2
set_default_colormap(colormap)
Same as Gdk::Screen#default_colormap=. Since 2.2
system_colormap
Gets the system's default colormap for screen. Since 2.2
system_visual
Get the system's default visual for screen. This is the visual for the root window of the display. Since 2.2
rgb_colormap
Gets the preferred colormap for rendering image data on screen. Not a very useful method; historically, GDK could only render RGB image data to one colormap and visual, but in the current version it can render to any colormap and visual. So there's no need to call this method. Since 2.2
rgb_visual
Gets a "preferred visual" chosen by Gdk::RGB for rendering image data on screen. In previous versions of GDK, this was the only visual Gdk::RGB could use for rendering. In current versions, it's simply the visual Gdk::RGB would have chosen as the optimal one in those previous versions. Gdk::RGB can now render to drawables with any visual. Since 2.2
rgba_colormap
Gets a colormap to use for creating windows or pixmaps 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, it's 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. Since 2.8
  • Returns: a Gdk::Colormap to use for windows with an alpha channel or nil if the capability is not available
rgba_visual
Gets a visual to use for creating windows or pixmaps with an alpha channel. See the docs for Gdk::Screen#rgba_colormap for caveats. Since 2.8
  • Returns: a Gdk::Visual to use for windows with an alpha channel or nil if the capability is not available.
root_window
Gets the root window of screen. Since 2.2
display
Gets the display to which the screen belongs. Since 2.2
number
Gets the index of screen among the screens in the display to which it belongs. (See Gdk::Screen#display) Since 2.2
  • Returns: the index
width
Gets the width of screen in pixels. Since 2.2
  • Returns: the width of screen in pixels
height
Gets the height of screen in pixels. Since 2.2
  • Returns: the height of screen in pixels
width_mm
Gets the width of screen in millimeters. Note that on some X servers this value will not be correct. Since 2.2
  • Returns: the width of screen in millimeters
height_mm
Gets the height of screen in millimeters. Note that on some X servers this value will not be correct. Since 2.2
  • Returns: the height of screen in millimeters
visuals
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. Since 2.2
  • Returns: An Array of the lists the available visuals for the specified screen
toplevel_windows
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::Window.default_root_window). Since 2.2
  • Returns: An Array of the list of toplevel windows
display_name
Determines the name to pass to Gdk::Display.open to get a Gdk::Display with this screen as the default screen. Since 2.2
  • Returns: a display name
n_monitors
Returns the number of monitors which screen consists of. Since 2.2
  • Returns: number of monitors which screen consists of.
monitor_geometry
Retrieves the Gdk::Rectangle representing the size and position of the individual monitor within the entire screen area. Note that the size of the entire screen area can be retrieved via Gdk::Screen#width and Gdk::Screen#height. Since 2.2
  • monitor_num: the monitor number.
  • Returns: a Gdk::Rectangle to be filled with the monitor geometry
get_monitor(x, y)
Returns the monitor number in which the point (x,y) is located. Since 2.2
  • 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.
get_monitor(window)
Returns the number of the monitor in which the largest area of the bounding rectangle of window resides. Since 2.2
  • window: a Gdk::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.
broadcast_client_message
On X11, sends an X ClientMessage event to all toplevel windows on screen. Toplevel windows are determined by checking for the WM_STATE property, as described in the Inter-Client Communication Conventions Manual (ICCCM). If no windows are found with the WM_STATE property set, the message is sent to all children of the root window. On Windows, broadcasts a message registered with the name GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of data is limited to one long, i.e. four bytes. Since 2.2
get_setting(name, value)
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. Since 2.2
  • name: the name of the setting
  • Returns: the value of the setting or nil
spawn_on_screen(working_directory, argv, envp, flags){ ... }
Like GLib::Spawn.async, except the child process is spawned in such an environment that on calling Gdk::Display.open it would be returned a Gdk::Display with screen as the default screen. When unsucceed, this raises a GLib::SpawnError. This is useful for applications which wish to launch an application on a specific screen. Since 2.4
  • working_directory: child's current working directory as String, or nil to inherit parent's
  • argv: child's argument vector (Array of String)
  • envp: child's environment, or nil to inherit parent's (Array of String)
  • flags: flags from GSpawnFlags
  • { ... }: a block to run in the child just before exec
  • Returns: child process ID
spawn_on_screen_with_pipes(working_directory, argv, envp, flags){ ... }
Like GLib::Spawn.async_with_pipes, except the child process is spawned in such an environment that on calling Gdk::Display.open it would be returned a Gdk::Display with screen as the default screen. When unsucceed, this raises a GLib::SpawnError. This is useful for applications which wish to launch an application on a specific screen. Since 2.4
  • working_directory: child's current working directory as String, or nil to inherit parent's
  • argv: child's argument vector (Array of String)
  • envp: child's environment, or nil to inherit parent's (Array of String)
  • flags: flags from GSpawnFlags
  • { ... }: a block to run in the child just before exec
  • Returns: [child_pid, stdin, stdout, stderr]
    • child process ID
    • stdin: file descriptor to write to child's stdin, or nil
    • stdout: file descriptor to read child's stdout, or nil
    • stderr: file descriptor to read child's stderr, or nil
spawn_command_line_on_screen(command_line)
Like GLib::Spawn.command_line_async, except the child process is spawned in such an environment that on calling Gdk::Display.open it would be returned a Gdk::Display with screen as the default screen. When unsucceed, this raises a GLib::SpawnError. This is useful for applications which wish to launch an application on a specific screen. Since 2.4
  • command_line: a command line (String)
  • Returns: true on success, false if error is occured.
screen_number
Returns the index of a Gdk::Screen. X only Since 2.2
  • Returns: the position of screen among the screens of its display.
supports_net_wm_hint?(property)
This method is specific to the X11 backend of GDK, and indicates whether the window manager supports a certain hint from the Extended Window Manager Hints Specification. You can find this specification on http://www.freedesktop.org. When using this method, keep in mind that the window manager can change over time; so you shouldn't use this method in a way that impacts persistent application state. A common bug is that your application can start up before the window manager does when the user logs in, and before the window manager starts Gdk::Screen#supports_net_wm_hint? will return false for every property. You can monitor the window_manager_changed signal on Gdk::Screen to detect a window manager change. X only Since 2.2
  • property: a property Gdk::Atom.
  • Returns: true if the window manager supports property
window_manager_name
Returns the name of the window manager for screen. X only Since 2.2
  • Returns: the name of the window manager screen, or "unknown" if the window manager is unknown.
xnumber
Returns the index of a Gdk::Screen. X only Since 2.2
  • Returns: the position of screen among the screens of its display.
active_window
  • Returns: self: FIXME
composited?
  • Returns: self: FIXME
font_options
Gets the default font options for the screen.
  • Returns: The default font options for the screen
font_options=(font_options)
Sets the default font options for the screen.
  • font_options: The default font options for the screen
  • Returns: font_options
resolution
Gets the resolution for fonts on the screen.
  • Returns: The resolution for fonts on the screen
resolution=(resolution)
Sets the resolution for fonts on the screen.
  • resolution: The resolution for fonts on the screen
  • Returns: resolution
set_font_options(font_options)
Same as font_options=.
  • font_options: The default font options for the screen
  • Returns: self
set_resolution(resolution)
Same as resolution=.
  • resolution: The resolution for fonts on the screen
  • Returns: self
window_stack
  • Returns: an array of Gdk::Window containing the list of all windows on the screen. The list is statically allocated and should not be freed.

Properties

font-options: gpointer (Read/Write)
The default font options for the screen
resolution: Float (Read/Write)
The resolution for fonts on the screen

Signals

size-changed: self
The ::size_changed signal is emitted when the pixel width or height of a screen changes. Since 2.2
composited-changed: self
monitors-changed: self

ChangeLog

  • 2005-09-23 Documented 2.8 additions. - gc?
  • 2005-05-07 Added. - Masao