GDK 2 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <gdk/gdk.h> GdkScreen; GdkScreen * gdk_screen_get_default (void
); 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
); GdkColormap * gdk_screen_get_rgba_colormap (GdkScreen *screen
); GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen
); gboolean gdk_screen_is_composited (GdkScreen *screen
); GdkWindow * gdk_screen_get_root_window (GdkScreen *screen
); GdkDisplay * gdk_screen_get_display (GdkScreen *screen
); gint gdk_screen_get_number (GdkScreen *screen
); 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
); GList * gdk_screen_list_visuals (GdkScreen *screen
); GList * gdk_screen_get_toplevel_windows (GdkScreen *screen
); gchar * gdk_screen_make_display_name (GdkScreen *screen
); gint gdk_screen_get_n_monitors (GdkScreen *screen
); gint gdk_screen_get_primary_monitor (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
); gint gdk_screen_get_monitor_height_mm (GdkScreen *screen
,gint monitor_num
); gint gdk_screen_get_monitor_width_mm (GdkScreen *screen
,gint monitor_num
); gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen
,gint monitor_num
); void gdk_screen_broadcast_client_message (GdkScreen *screen
,GdkEvent *event
); gboolean gdk_screen_get_setting (GdkScreen *screen
,const gchar *name
,GValue *value
); const cairo_font_options_t * gdk_screen_get_font_options (GdkScreen *screen
); void gdk_screen_set_font_options (GdkScreen *screen
,const cairo_font_options_t *options
); gdouble gdk_screen_get_resolution (GdkScreen *screen
); void gdk_screen_set_resolution (GdkScreen *screen
,gdouble dpi
); GdkWindow * gdk_screen_get_active_window (GdkScreen *screen
); GList * gdk_screen_get_window_stack (GdkScreen *screen
); gboolean gdk_spawn_on_screen (GdkScreen *screen
,const gchar *working_directory
,gchar **argv
,gchar **envp
,GSpawnFlags flags
,GSpawnChildSetupFunc child_setup
,gpointer user_data
,gint *child_pid
,GError **error
); gboolean gdk_spawn_on_screen_with_pipes (GdkScreen *screen
,const gchar *working_directory
,gchar **argv
,gchar **envp
,GSpawnFlags flags
,GSpawnChildSetupFunc child_setup
,gpointer user_data
,gint *child_pid
,gint *standard_input
,gint *standard_output
,gint *standard_error
,GError **error
); gboolean gdk_spawn_command_line_on_screen (GdkScreen *screen
,const gchar *command_line
,GError **error
);
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.
typedef struct _GdkScreen 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.
Since 2.2
GdkScreen * gdk_screen_get_default (void
);
Gets the default screen for the default display. (See
gdk_display_get_default()
).
Since 2.2
GdkColormap * gdk_screen_get_default_colormap (GdkScreen *screen
);
Gets the default colormap for screen
.
|
a GdkScreen |
Returns : |
the default GdkColormap. [transfer none] |
Since 2.2
void gdk_screen_set_default_colormap (GdkScreen *screen
,GdkColormap *colormap
);
Sets the default colormap
for screen
.
|
a GdkScreen |
|
a GdkColormap |
Since 2.2
GdkColormap * gdk_screen_get_system_colormap (GdkScreen *screen
);
Gets the system's default colormap for screen
|
a GdkScreen |
Returns : |
the default colormap for screen . [transfer none]
|
Since 2.2
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.
|
a GdkScreen. |
Returns : |
the system visual. [transfer none] |
Since 2.2
GdkColormap * gdk_screen_get_rgb_colormap (GdkScreen *screen
);
gdk_screen_get_rgb_colormap
has been deprecated since version 2.22 and should not be used in newly-written code. Use gdk_screen_get_system_colormap()
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.
|
a GdkScreen. |
Returns : |
the preferred colormap. [transfer none] |
Since 2.2
GdkVisual * gdk_screen_get_rgb_visual (GdkScreen *screen
);
gdk_screen_get_rgb_visual
has been deprecated since version 2.22 and should not be used in newly-written code. Use gdk_screen_get_system_visual()
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.
Since 2.2
GdkColormap * gdk_screen_get_rgba_colormap (GdkScreen *screen
);
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 NULL
will
be returned. Even if a non-NULL
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()
.
|
a GdkScreen. |
Returns : |
a colormap to use for windows with
an alpha channel or NULL if the capability is not available. [transfer none]
|
Since 2.8
GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen
);
Gets a visual to use for creating windows or pixmaps with an
alpha channel. See the docs for gdk_screen_get_rgba_colormap()
for caveats.
|
a GdkScreen |
Returns : |
a visual to use for windows with an
alpha channel or NULL if the capability is not available. [transfer none]
|
Since 2.8
gboolean gdk_screen_is_composited (GdkScreen *screen
);
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
.
|
a GdkScreen |
Returns : |
Whether windows with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen. |
Since 2.10
GdkWindow * gdk_screen_get_root_window (GdkScreen *screen
);
Gets the root window of screen
.
|
a GdkScreen |
Returns : |
the root window. [transfer none] |
Since 2.2
GdkDisplay * gdk_screen_get_display (GdkScreen *screen
);
Gets the display to which the screen
belongs.
|
a GdkScreen |
Returns : |
the display to which screen belongs |
Since 2.2
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()
)
|
a GdkScreen |
Returns : |
the index |
Since 2.2
gint gdk_screen_get_width (GdkScreen *screen
);
Gets the width of screen
in pixels
|
a GdkScreen |
Returns : |
the width of screen in pixels. |
Since 2.2
gint gdk_screen_get_height (GdkScreen *screen
);
Gets the height of screen
in pixels
|
a GdkScreen |
Returns : |
the height of screen in pixels. |
Since 2.2
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.
|
a GdkScreen |
Returns : |
the width of screen in millimeters. |
Since 2.2
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.
|
a GdkScreen |
Returns : |
the heigth of screen in millimeters. |
Since 2.2
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.
|
the relevant GdkScreen. |
Returns : |
a list of visuals; the list must be freed, but not its contents. [transfer container][element-type GdkVisual] |
Since 2.2
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.
|
The GdkScreen where the toplevels are located. |
Returns : |
list of toplevel windows, free with g_list_free() . [transfer container][element-type GdkWindow]
|
Since 2.2
gchar * gdk_screen_make_display_name (GdkScreen *screen
);
Determines the name to pass to gdk_display_open()
to get
a GdkDisplay with this screen as the default screen.
Since 2.2
gint gdk_screen_get_n_monitors (GdkScreen *screen
);
Returns the number of monitors which screen
consists of.
|
a GdkScreen |
Returns : |
number of monitors which screen consists of |
Since 2.2
gint gdk_screen_get_primary_monitor (GdkScreen *screen
);
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.
|
a GdkScreen. |
Returns : |
An integer index for the primary monitor, or 0 if none is configured. |
Since 2.20
void gdk_screen_get_monitor_geometry (GdkScreen *screen
,gint monitor_num
,GdkRectangle *dest
);
Retrieves the GdkRectangle 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_get_width()
and gdk_screen_get_height()
.
|
a GdkScreen |
|
the monitor number, between 0 and gdk_screen_get_n_monitors (screen) |
|
a GdkRectangle to be filled with the monitor geometry |
Since 2.2
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.
|
a GdkScreen. |
|
the x coordinate in the virtual screen. |
|
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. |
Since 2.2
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.
|
a GdkScreen. |
|
a GdkWindow |
Returns : |
the monitor number in which most of window is located,
or if window does not intersect any monitors, a monitor,
close to window . |
Since 2.2
gint gdk_screen_get_monitor_height_mm (GdkScreen *screen
,gint monitor_num
);
Gets the height in millimeters of the specified monitor.
|
a GdkScreen |
|
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) |
Returns : |
the height of the monitor, or -1 if not available |
Since 2.14
gint gdk_screen_get_monitor_width_mm (GdkScreen *screen
,gint monitor_num
);
Gets the width in millimeters of the specified monitor, if available.
|
a GdkScreen |
|
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) |
Returns : |
the width of the monitor, or -1 if not available |
Since 2.14
gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen
,gint monitor_num
);
Returns the output name of the specified monitor. Usually something like VGA, DVI, or TV, not the actual product name of the display device.
|
a GdkScreen |
|
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 NULL if the name cannot be determined |
Since 2.14
void gdk_screen_broadcast_client_message (GdkScreen *screen
,GdkEvent *event
);
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
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.
|
the GdkScreen where the setting is located |
|
the name of the setting |
|
location to store the value of the setting |
Returns : |
TRUE if the setting existed and a value was stored
in value , FALSE otherwise. |
Since 2.2
const cairo_font_options_t * gdk_screen_get_font_options
(GdkScreen *screen
);
Gets any options previously set with gdk_screen_set_font_options()
.
|
a GdkScreen |
Returns : |
the current font options, or NULL if no default
font options have been set. |
Since 2.10
void gdk_screen_set_font_options (GdkScreen *screen
,const cairo_font_options_t *options
);
Sets the default font options for the screen. These
options will be set on any PangoContext'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.
|
a GdkScreen |
|
a cairo_font_options_t, or NULL to unset any
previously set default font options. [allow-none]
|
Since 2.10
gdouble gdk_screen_get_resolution (GdkScreen *screen
);
Gets the resolution for font handling on the screen; see
gdk_screen_set_resolution()
for full details.
|
a GdkScreen |
Returns : |
the current resolution, or -1 if no resolution has been set. |
Since 2.10
void gdk_screen_set_resolution (GdkScreen *screen
,gdouble dpi
);
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).
|
a GdkScreen |
|
the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) |
Since 2.10
GdkWindow * gdk_screen_get_active_window (GdkScreen *screen
);
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 NULL
.
On other platforms, this function may return NULL
, depending on whether
it is implementable on that platform.
The returned window should be unrefed using g_object_unref()
when
no longer needed.
Since 2.10
GList * gdk_screen_get_window_stack (GdkScreen *screen
);
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 NULL
.
On other platforms, this function may return NULL
, 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.
|
a GdkScreen |
Returns : |
a list of GdkWindows for the current window stack,
or NULL . [transfer full][element-type GdkWindow]
|
Since 2.10
gboolean gdk_spawn_on_screen (GdkScreen *screen
,const gchar *working_directory
,gchar **argv
,gchar **envp
,GSpawnFlags flags
,GSpawnChildSetupFunc child_setup
,gpointer user_data
,gint *child_pid
,GError **error
);
gdk_spawn_on_screen
has been deprecated since version 2.24 and should not be used in newly-written code. This function is being removed in 3.0. Use
either g_spawn_sync()
, g_spawn_async()
, or GdkAppLaunchContext instead.
Like g_spawn_async()
, except the child process is spawned in such
an environment that on calling gdk_display_open()
it would be
returned a GdkDisplay with screen
as the default screen.
This is useful for applications which wish to launch an application on a specific screen.
|
a GdkScreen |
|
child's current working directory, or NULL to
inherit parent's |
|
child's argument vector |
|
child's environment, or NULL to inherit parent's |
|
flags from GSpawnFlags |
|
function to run in the child just before exec()
|
|
user data for child_setup
|
|
return location for child process ID, or NULL
|
|
return location for error |
Returns : |
TRUE on success, FALSE if error is set |
Since 2.4
gboolean gdk_spawn_on_screen_with_pipes (GdkScreen *screen
,const gchar *working_directory
,gchar **argv
,gchar **envp
,GSpawnFlags flags
,GSpawnChildSetupFunc child_setup
,gpointer user_data
,gint *child_pid
,gint *standard_input
,gint *standard_output
,gint *standard_error
,GError **error
);
gdk_spawn_on_screen_with_pipes
has been deprecated since version 2.24 and should not be used in newly-written code. This function is being removed in 3.0. Use
either g_spawn_async_with_pipes()
or GdkAppLaunchContext instead.
Like g_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 GdkDisplay with screen
as the default
screen.
This is useful for applications which wish to launch an application on a specific screen.
|
a GdkScreen |
|
child's current working directory, or NULL to
inherit parent's |
|
child's argument vector |
|
child's environment, or NULL to inherit parent's |
|
flags from GSpawnFlags |
|
function to run in the child just before exec()
|
|
user data for child_setup
|
|
return location for child process ID, or NULL
|
|
return location for file descriptor to write to
child's stdin, or NULL
|
|
return location for file descriptor to read child's
stdout, or NULL
|
|
return location for file descriptor to read child's
stderr, or NULL
|
|
return location for error |
Returns : |
TRUE on success, FALSE if an error was set |
Since 2.4
gboolean gdk_spawn_command_line_on_screen (GdkScreen *screen
,const gchar *command_line
,GError **error
);
gdk_spawn_command_line_on_screen
has been deprecated since version 2.24 and should not be used in newly-written code. This function is being removed in 3.0. Use
either g_spawn_command_line_sync()
, g_spawn_command_line_async()
or
GdkAppLaunchContext instead.
Like g_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 GdkDisplay with screen
as the default
screen.
This is useful for applications which wish to launch an application on a specific screen.
|
a GdkScreen |
|
a command line |
|
return location for errors |
Returns : |
TRUE on success, FALSE if error is set. |
Since 2.4
"font-options"
property"font-options" gpointer : Read / Write
The default font options for the screen.
"resolution"
property"resolution" gdouble : Read / Write
The resolution for fonts on the screen.
Default value: -1
"composited-changed"
signalvoid user_function (GdkScreen *screen,
gpointer user_data) : Run Last
The ::composited-changed signal is emitted when the composited status of the screen changes
|
the object on which the signal is emitted |
|
user data set when the signal handler was connected. |
Since 2.10
"monitors-changed"
signalvoid user_function (GdkScreen *screen,
gpointer user_data) : Run Last
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 object on which the signal is emitted |
|
user data set when the signal handler was connected. |
Since 2.14
"size-changed"
signalvoid user_function (GdkScreen *screen,
gpointer user_data) : Run Last
The ::size-changed signal is emitted when the pixel width or height of a screen changes.
|
the object on which the signal is emitted |
|
user data set when the signal handler was connected. |
Since 2.2