GDK Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GdkScreen

## Name

GdkScreen -- object representing a physical screen

## Synopsis

    #include <gdk/gdk.h>

    struct      GdkScreen;
    GdkColormap* gdk_screen_get_default_colormap
                                                (GdkScreen *screen);
    void        gdk_screen_set_default_colormap (GdkScreen *screen,
                                                 GdkColormap *colormap);
    GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);
    GdkVisual*  gdk_screen_get_system_visual    (GdkScreen *screen);
    GdkColormap* gdk_screen_get_rgb_colormap    (GdkScreen *screen);
    GdkVisual*  gdk_screen_get_rgb_visual       (GdkScreen *screen);
    GdkWindow*  gdk_screen_get_root_window      (GdkScreen *screen);
    GdkDisplay* gdk_screen_get_display          (GdkScreen *screen);
    gint        gdk_screen_get_number           (GdkScreen *screen);
    GdkWindow*  gdk_screen_get_window_at_pointer
                                                (GdkScreen *screen,
                                                 gint *win_x,
                                                 gint *win_y);
    gint        gdk_screen_get_width            (GdkScreen *screen);
    gint        gdk_screen_get_height           (GdkScreen *screen);
    gint        gdk_screen_get_width_mm         (GdkScreen *screen);
    gint        gdk_screen_get_height_mm        (GdkScreen *screen);
    void        gdk_screen_close                (GdkScreen *screen);
    GList*      gdk_screen_list_visuals         (GdkScreen *screen);
    GList*      gdk_screen_get_toplevel_windows (GdkScreen *screen);
    gint        gdk_screen_get_n_monitors       (GdkScreen *screen);
    void        gdk_screen_get_monitor_geometry (GdkScreen *screen,
                                                 gint monitor_num,
                                                 GdkRectangle *dest);
    gint        gdk_screen_get_monitor_at_point (GdkScreen *screen,
                                                 gint x,
                                                 gint y);
    gint        gdk_screen_get_monitor_at_window
                                                (GdkScreen *screen,
                                                 GdkWindow *window);
    void        gdk_screen_broadcast_client_message
                                                (GdkScreen *screen,
                                                 GdkEvent *event);
    GdkScreen*  gdk_get_default_screen          (void);
    gboolean    gdk_screen_get_setting          (GdkScreen *screen,
                                                 const gchar *name,
                                                 GValue *value);

## Object Hierarchy

      GObject
       +----GdkScreen

## Description

GdkScreen 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_get_default_colormap()), the screen width (gdk_screen_get_width()), etc.

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

## Details

### struct GdkScreen

    struct GdkScreen;

This is a currently just a placeholder typedef for the first argument of the `window_at_pointer` function in GdkPointerHooks. It will be used when GDK gets multihead support.

### gdk_screen_get_default_colormap ()

    GdkColormap* gdk_screen_get_default_colormap
                                                (GdkScreen *screen);

Gets the default colormap for `screen`.

`screen` : | a GdkScreen
Returns : | the default GdkColormap.

### gdk_screen_set_default_colormap ()

    void        gdk_screen_set_default_colormap (GdkScreen *screen,
                                                 GdkColormap *colormap);

Sets the default `colormap` for `screen`.

`screen` : | a GdkScreen
`colormap` : | a GdkColormap

### gdk_screen_get_system_colormap ()

    GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);

Gets the system's default colormap for `screen`

`screen` : | a GdkScreen
Returns : | the default colormap for `screen`.

### gdk_screen_get_system_visual ()

    GdkVisual*  gdk_screen_get_system_visual    (GdkScreen *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.

`screen` : | a GdkScreen.
Returns : | system visual

### gdk_screen_get_rgb_colormap ()

    GdkColormap* gdk_screen_get_rgb_colormap    (GdkScreen *screen);

Gets the preferred colormap for rendering image data on `screen`. Not a very useful function; 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 function.

`screen` : | a GdkScreen.
Returns : | the preferred colormap

### gdk_screen_get_rgb_visual ()

    GdkVisual*  gdk_screen_get_rgb_visual       (GdkScreen *screen);

Gets a "preferred visual" chosen by GdkRGB for rendering image data on `screen`. In previous versions of GDK, this was the only visual GdkRGB could use for rendering. In current versions, it's simply the visual GdkRGB would have chosen as the optimal one in those previous versions. GdkRGB can now render to drawables with any visual.

`screen` : | a GdkScreen
Returns : | The GdkVisual chosen by GdkRGB.

### gdk_screen_get_root_window ()

    GdkWindow*  gdk_screen_get_root_window      (GdkScreen *screen);

Gets the root window of `screen`.

`screen` : | a GdkScreen
Returns : | the root window

### gdk_screen_get_display ()

    GdkDisplay* gdk_screen_get_display          (GdkScreen *screen);

Gets the display to which the `screen` belongs.

`screen` : | a GdkScreen
Returns : | the display to which `screen` belongs

### gdk_screen_get_number ()

    gint        gdk_screen_get_number           (GdkScreen *screen);

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

`screen` : | a GdkScreen
Returns : | the index

### gdk_screen_get_window_at_pointer ()

    GdkWindow*  gdk_screen_get_window_at_pointer
                                                (GdkScreen *screen,
                                                 gint *win_x,
                                                 gint *win_y);

Obtains the window underneath the mouse pointer, returning the location of that window in `win_x`, `win_y` for `screen`. Returns `NULL` if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

`screen` : | a GdkScreen
`win_x` : | return location for origin of the window under the pointer
`win_y` : | return location for origin of the window under the pointer
Returns : | the window under the mouse pointer, or `NULL`

### gdk_screen_get_width ()

    gint        gdk_screen_get_width            (GdkScreen *screen);

Gets the width of `screen` in pixels

`screen` : | a GdkScreen
Returns : | the width of `screen` in pixels.

### gdk_screen_get_height ()

    gint        gdk_screen_get_height           (GdkScreen *screen);

Gets the height of `screen` in pixels

`screen` : | a GdkScreen
Returns : | the height of `screen` in pixels.

### gdk_screen_get_width_mm ()

    gint        gdk_screen_get_width_mm         (GdkScreen *screen);

Gets the width of `screen` in millimeters. Note that on some X servers this value will not be correct.

`screen` : | a GdkScreen
Returns : | the width of `screen` in pixels.

### gdk_screen_get_height_mm ()

    gint        gdk_screen_get_height_mm        (GdkScreen *screen);

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

`screen` : | a GdkScreen
Returns : | the heigth of `screen` in pixels.

### gdk_screen_close ()

    void        gdk_screen_close                (GdkScreen *screen);

Closes the `screen` connection and cleanup its resources. Note that this function is called automatically by gdk_display_close().

`screen` : | a GdkScreen

### gdk_screen_list_visuals ()

    GList*      gdk_screen_list_visuals         (GdkScreen *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.

`screen` : | the relevant GdkScreen.
Returns : | a list of visuals; the list must be freed, but not its contents

### gdk_screen_get_toplevel_windows ()

    GList*      gdk_screen_get_toplevel_windows (GdkScreen *screen);

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.

`screen` : | The GdkScreen where the toplevels are located.
Returns : | list of toplevel windows, free with g_list_free()

### gdk_screen_get_n_monitors ()

    gint        gdk_screen_get_n_monitors       (GdkScreen *screen);

Returns the number of monitors being part of the virtual screen

`screen` : | a GdkScreen.
Returns : | number of monitors part of the virtual screen or 0 if `screen` is not in virtual screen mode.

### gdk_screen_get_monitor_geometry ()

    void        gdk_screen_get_monitor_geometry (GdkScreen *screen,
                                                 gint monitor_num,
                                                 GdkRectangle *dest);

Retrieves the GdkRectangle representing the size and start coordinates of the individual monitor within the the entire virtual screen.

Note that the virtual screen coordinates can be retrieved via gdk_screen_get_width() and gdk_screen_get_height().

`screen` : | a GdkScreen.
`monitor_num` : | the monitor number.
`dest` : | a GdkRectangle to be filled with the monitor geometry

### gdk_screen_get_monitor_at_point ()

    gint        gdk_screen_get_monitor_at_point (GdkScreen *screen,
                                                 gint x,
                                                 gint y);

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

`screen` : | a GdkScreen.
`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`) belong, or -1 if the point is not in any monitor.

### gdk_screen_get_monitor_at_window ()

    gint        gdk_screen_get_monitor_at_window
                                                (GdkScreen *screen,
                                                 GdkWindow *window);

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

`screen` : | a GdkScreen.
`window` : | a GdkWindow
Returns : | the monitor number in which most of `window` is located.

### gdk_screen_broadcast_client_message ()

    void        gdk_screen_broadcast_client_message
                                                (GdkScreen *screen,
                                                 GdkEvent *event);

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.

`screen` : | the GdkScreen where the event will be broadcasted.
`event` : | the GdkEvent.

### gdk_get_default_screen ()

    GdkScreen*  gdk_get_default_screen          (void);

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

Returns : | a GdkScreen.

### gdk_screen_get_setting ()

    gboolean    gdk_screen_get_setting          (GdkScreen *screen,
                                                 const gchar *name,
                                                 GValue *value);

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

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

`screen` : | the GdkScreen 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.

<<< Previous Page | Home | Up | Next Page >>>
GdkDisplay | Points, Rectangles and Regions