Resets the clip region for a Cairo context created by gdk_cairo_create().
This resets the clip region to the "empty" state for the given drawable.
This is required for non-native windows since a direct call to
cairo_reset_clip() would unset the clip region inherited from the
drawable (i.e. the window clip region), and thus let you e.g.
draw outside your window.
This is rarely needed though, since most code just create a new cairo_t
using gdk_cairo_create() each time they want to draw something.
Sets the given pixbuf as the source pattern for the Cairo context.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of pixbuf is pixbuf_x,pixbuf_y
Sets the given pixmap as the source pattern for the Cairo context.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of pixmap is pixmap_x,pixmap_y
Sets the given window as the source pattern for the Cairo context.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of window is x,y. The window contains all its
subwindows when rendering.
Note that the contents of window are undefined outside of the
visible part of window, so use this function with care.
X coordinate of location to place upper left corner of window
y: number
Y coordinate of location to place upper left corner of window
Returns void
char_height
char_height(font: Gdk.Font, character: number): number
Determines the total height of a given character.
This value is not generally useful, because you cannot
determine how this total height will be drawn in
relation to the baseline. See gdk_text_extents().
char_measure(font: Gdk.Font, character: number): number
Determines the distance from the origin to the rightmost
portion of a character when drawn. This is not the
correct value for determining the origin of the next
portion when drawing text in multiple pieces.
Changes the value of a color that has already
been allocated. If colormap is not a private
colormap, then the color must have been allocated
using gdk_colormap_alloc_colors() with the
writeable set to %TRUE.
Parses a textual specification of a color and fill in the
red, green,
and blue fields of a #GdkColor
structure. The color is not allocated, you
must call gdk_colormap_alloc_color() yourself. The string can
either one of a large set of standard names. (Taken from the X11
rgb.txt file), or it can be a hex value in the
form '#rgb' '#rrggbb' '#rrrgggbbb' or
'#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the
red, green, and blue components of the color, respectively. (White
in the four forms is '#fff' '#ffffff' '#fffffffff' and
'#ffffffffffff')
Allocates colors from a colormap. This function
is obsolete. See gdk_colormap_alloc_colors().
For full documentation of the fields, see
the Xlib documentation for XAllocColorCells().
Returns whether the dropped data has been successfully
transferred. This function is intended to be used while
handling a %GDK_DROP_FINISHED event, its return value is
meaningless at other times.
Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
rectangle of the entire ellipse, and the start and end angles of the part
of the ellipse to be drawn.
Copies the width x height region of src at coordinates (xsrc,ysrc) to coordinates (xdest,ydest) in drawable.
width and/or height may be given as -1, in which case the entire
src drawable will be copied.
Most fields in gc are not used for this operation, but notably the
clip mask or clip region will be honored.
The source and destination drawables must have the same visual and
colormap, or errors will result. (On X11, failure to match
visual/colormap results in a BadMatch error from the X server.)
A common cause of this problem is an attempt to draw a bitmap to
a color drawable. The way to draw a bitmap is to set the bitmap as
the stipple on the #GdkGC, set the fill mode to %GDK_STIPPLED, and
then draw the rectangle.
This is a low-level function; 99% of text rendering should be done
using gdk_draw_layout() instead.
A glyph is a single image in a font. This function draws a sequence of
glyphs. To obtain a sequence of glyphs you have to understand a
lot about internationalized text handling, which you don't want to
understand; thus, use gdk_draw_layout() instead of this function,
gdk_draw_layout() handles the details.
Renders a #PangoGlyphString onto a drawable, possibly
transforming the layed-out coordinates through a transformation
matrix. Note that the transformation matrix for font is not
changed, so to produce correct rendering results, the font
must have been loaded using a #PangoContext with an identical
transformation matrix to that passed in to this function.
If the layout's #PangoContext has a transformation matrix set, then
x and y specify the position of the top left corner of the
bounding box (in device space) of the transformed layout.
If you're using GTK+, the usual way to obtain a #PangoLayout
is gtk_widget_create_pango_layout().
If the layout's #PangoContext has a transformation matrix set, then
x and y specify the position of the left edge of the baseline
(left is in before-tranform user coordinates) in after-transform
device coordinates.
Render a #PangoLayoutLine onto a #GdkDrawable, overriding the
layout's normal colors with foreground and/or background.
foreground and background need not be allocated.
If the layout's #PangoContext has a transformation matrix set, then
x and y specify the position of the left edge of the baseline
(left is in before-tranform user coordinates) in after-transform
device coordinates.
Render a #PangoLayout onto a #GdkDrawable, overriding the
layout's normal colors with foreground and/or background.
foreground and background need not be allocated.
If the layout's #PangoContext has a transformation matrix set, then
x and y specify the position of the top left corner of the
bounding box (in device space) of the transformed layout.
If you're using GTK+, the ususal way to obtain a #PangoLayout
is gtk_widget_create_pango_layout().
Draws a series of lines connecting the given points.
The way in which joins between lines are draw is determined by the
#GdkCapStyle value in the #GdkGC. This can be set with
gdk_gc_set_line_attributes().
Renders a rectangular portion of a pixbuf to a drawable. The destination
drawable must have a colormap. All windows have a colormap, however, pixmaps
only have colormap by default if they were created with a non-%NULL window
argument. Otherwise a colormap must be set on them with
gdk_drawable_set_colormap().
On older X servers, rendering pixbufs with an alpha channel involves round
trips to the X server, and may be somewhat slow.
If GDK is built with the Sun mediaLib library, the gdk_draw_pixbuf
function is accelerated using mediaLib, which provides hardware
acceleration on Intel, AMD, and Sparc chipsets. If desired, mediaLib
support can be turned off by setting the GDK_DISABLE_MEDIALIB environment
variable.
Draws a rectangular outline or filled rectangle, using the foreground color
and other attributes of the #GdkGC.
A rectangle drawn filled is 1 pixel smaller in both dimensions than a
rectangle outlined. Calling
gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20)
results in a filled rectangle 20 pixels wide and 20 pixels high. Calling
gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)
results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20),
and (20, 0), which makes it 21 pixels wide and 21 pixels high.
Draws a number of wide characters using the given font of fontset.
If the font is a 1-byte font, the string is converted into 1-byte
characters (discarding the high bytes) before output.
Draws a set of anti-aliased trapezoids. The trapezoids are
combined using saturation addition, then drawn over the background
as a set. This is low level functionality used internally to implement
rotated underlines and backgrouds when rendering a PangoLayout and is
likely not useful for applications.
Checks all open displays for a #GdkEvent to process,to be processed
on, fetching events from the windowing system if necessary.
See gdk_display_get_event().
Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is
usually not useful for GTK+ applications. (Although an application
can call this function then call gtk_main_do_event() to pass
events to GTK+.)
Request more motion notifies if event is a motion notify hint event.
This function should be used instead of gdk_window_get_pointer() to
request further motion notifies, because it also works for extension
events where motion notifies are provided for devices other than the
core pointer. Coordinate extraction, processing and requesting more
motion events from a %GDK_MOTION_NOTIFY event usually works like this:
Load a #GdkFont based on a Pango font description. This font will
only be an approximation of the Pango font, and
internationalization will not be handled correctly. This function
should only be used for legacy code that cannot be easily converted
to use Pango. Using Pango directly will produce better results.
Gets the display name specified in the command line arguments passed
to gdk_init() or gdk_parse_args(), if any.
Returns string
get_program_class
get_program_class(): string
Returns string
get_show_events
get_show_events(): boolean
Gets whether event debugging output is enabled.
Returns boolean
get_use_xshm
get_use_xshm(): boolean
Returns boolean
init
init(argv: string[]): string[]
Parameters
argv: string[]
Returns string[]
init_check
init_check(argv: string[]): [boolean, string[]]
Initialize the library for use.
Arguments:
"argc" is the number of arguments.
"argv" is an array of strings.
Results:
"argc" and "argv" are modified to reflect any arguments
which were not handled. (Such arguments should either
be handled by the application or dismissed). If initialization
fails, returns FALSE, otherwise TRUE.
Lists the available visuals for the default screen.
(See gdk_screen_list_visuals())
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.
mbstowcs(dest: number, src: string, dest_max: number): number
Converts a multi-byte string to a wide character string.
(The function name comes from an acronym of 'Multi-Byte String TO Wide
Character String').
Parameters
dest: number
the space to place the converted wide character string into.
src: string
the multi-byte string to convert, which must be nul-terminated.
dest_max: number
the maximum number of wide characters to place in dest.
Returns number
notify_startup_complete
notify_startup_complete(): void
Indicates to the GUI environment that the application has finished
loading. If the applications opens windows, this function is
normally called after opening the application's initial set of
windows.
GTK+ will call this function automatically after opening the first
#GtkWindow unless gtk_window_set_auto_startup_notification() is called
to disable that feature.
Indicates to the GUI environment that the application has finished
loading, using a given identifier.
GTK+ will call this function automatically for #GtkWindow with custom
startup-notification identifier unless
gtk_window_set_auto_startup_notification() is called to disable
that feature.
Parameters
startup_id: string
a startup-notification identifier, for which notification process should be completed
To fully embed an offscreen window, in addition to calling this
function, it is also necessary to handle the #GdkWindow::pick-embedded-child
signal on the embedder and the #GdkWindow::to-embedder and
#GdkWindow::from-embedder signals on window.
This function used to set the colormap to be used for drawing with
context. The colormap is now always derived from the graphics
context used for drawing, so calling this function is no longer
necessary.
Creates a pixmap and a mask bitmap which are returned in the pixmap_return
and mask_return arguments, respectively, and renders a pixbuf and its
corresponding thresholded alpha mask to them. This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use gdk_draw_pixbuf() and gdk_pixbuf_render_threshold_alpha().
The pixmap that is created is created for the colormap returned
by gdk_rgb_get_colormap(). You normally will want to instead use
the actual colormap for a widget, and use
gdk_pixbuf_render_pixmap_and_mask_for_colormap().
If the pixbuf does not have an alpha channel, then *mask_return will be set
to %NULL.
Creates a pixmap and a mask bitmap which are returned in the pixmap_return
and mask_return arguments, respectively, and renders a pixbuf and its
corresponding tresholded alpha mask to them. This is merely a convenience
function; applications that need to render pixbufs with dither offsets or to
given drawables should use gdk_draw_pixbuf(), and gdk_pixbuf_render_threshold_alpha().
The pixmap that is created uses the #GdkColormap specified by colormap.
This colormap must match the colormap of the window where the pixmap
will eventually be used or an error will result.
If the pixbuf does not have an alpha channel, then *mask_return will be set
to %NULL.
Takes the opacity values in a rectangular portion of a pixbuf and thresholds
them to produce a bi-level alpha mask that can be used as a clipping mask for
a drawable.
Renders a rectangular portion of a pixbuf to a drawable while using the
specified GC. This is done using GdkRGB, so the specified drawable must have
the GdkRGB visual and colormap. Note that this function will ignore the
opacity information for images with an alpha channel; the GC must already
have the clipping mask set if you want transparent regions to show through.
For an explanation of dither offsets, see the GdkRGB documentation. In
brief, the dither offset is important when re-rendering partial regions of an
image to a rendered version of the full image, or for when the offsets to a
base position change, as in scrolling. The dither matrix has to be shifted
for consistent visual results. If you do not have any of these cases, the
dither offsets can be both zero.
Renders a rectangular portion of a pixbuf to a drawable. The destination
drawable must have a colormap. All windows have a colormap, however, pixmaps
only have colormap by default if they were created with a non-%NULL window argument.
Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
On older X servers, rendering pixbufs with an alpha channel involves round trips
to the X server, and may be somewhat slow.
This function returns the available bit depths for the default
screen. It's equivalent to listing the visuals
(gdk_list_visuals()) and then looking at the depth field in each
visual, removing duplicates.
The array returned by this function should not be freed.
This function returns the available visual types for the default
screen. It's equivalent to listing the visuals
(gdk_list_visuals()) and then looking at the type field in each
visual, removing duplicates.
The array returned by this function should not be freed.
colormap should be the colormap for the graphics context and
drawable you're using to draw. If you're drawing to a #GtkWidget,
call gtk_widget_get_colormap().
color should have its %red, %green, and %blue fields initialized;
gdk_rgb_find_color() will fill in the %pixel field with the best
matching pixel from a color cube. The color is then ready to be
used for drawing, e.g. you can call gdk_gc_set_foreground() which
expects %pixel to be initialized.
In many cases, you can avoid this whole issue by calling
gdk_gc_set_rgb_fg_color() or gdk_gc_set_rgb_bg_color(), which
do not expect %pixel to be initialized in advance. If you use those
functions, there's no need for gdk_rgb_find_color().
Get the preferred colormap for rendering image data. 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.
Gets a "preferred visual" chosen by GdkRGB for rendering image data
on the default 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.
timestamp to use when setting the selection. If this is older than the timestamp given last time the owner was set for the given selection, the request will be ignored.
send_event: boolean
if %TRUE, and the new owner is different from the current owner, the current owner will be sent a SelectionClear event.
Returns boolean
selection_property_get
selection_property_get(requestor: Gdk.Window, data: number, prop_type: Gdk.Atom, prop_format: number): number
Retrieves selection data that was stored by the selection
data in response to a call to gdk_selection_convert(). This function
will not be used by applications, who should use the #GtkClipboard
API instead.
location to store a pointer to the retrieved data. If the retrieval failed, %NULL we be stored here, otherwise, it will be non-%NULL and the returned data should be freed with g_free() when you are finished using it. The length of the allocated memory is one more than the length of the returned data, and the final byte will always be zero, to ensure nul-termination of strings.
property in which the selection owner stored the data, or %GDK_NONE to indicate that the request was rejected.
time_: number
timestamp.
Returns void
set_double_click_time
set_double_click_time(msec: number): void
Set the double click time for the default display. See
gdk_display_set_double_click_time().
See also gdk_display_set_double_click_distance().
Applications should not set this, it is a
global user-configured setting.
Parameters
msec: number
double click time in milliseconds (thousandths of a second)
Returns void
set_locale
set_locale(): string
Returns string
set_program_class
set_program_class(program_class: string): void
Parameters
program_class: string
Returns void
set_show_events
set_show_events(show_events: boolean): void
Sets whether a trace of received events is output.
Note that GTK+ must be compiled with debugging (that is,
configured using the option)
to use this option.
Parameters
show_events: boolean
%TRUE to output event debugging information.
Returns void
set_sm_client_id
set_sm_client_id(sm_client_id: string): void
Sets the SM_CLIENT_ID property on the application's leader window so that
the window manager can save the application's state using the X11R6 ICCCM
session management protocol.
See the X Session Management Library documentation for more information on
session management and the Inter-Client Communication Conventions Manual
(ICCCM) for information on the WM_CLIENT_LEADER property.
(Both documents are part of the X Window System distribution.)
Parameters
sm_client_id: string
the client id assigned by the session manager when the connection was opened, or %NULL to remove the property.
Returns void
set_use_xshm
set_use_xshm(use_xshm: boolean): void
Parameters
use_xshm: boolean
Returns void
setting_get
setting_get(name: string, value: any): boolean
Obtains a desktop-wide setting, such as the double-click time,
for the default screen. See gdk_screen_get_setting().
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.
string_height(font: Gdk.Font, string: string): number
Determines the total height of a given nul-terminated
string. This value is not generally useful, because you
cannot determine how this total height will be drawn in
relation to the baseline. See gdk_string_extents().
string_measure(font: Gdk.Font, string: string): number
Determines the distance from the origin to the rightmost
portion of a nul-terminated string when drawn. This is not the
correct value for determining the origin of the next
portion when drawing text in multiple pieces.
See gdk_string_width().
location to store the encoding atom (to be used as the type for the property).
format: number
location to store the format of the property
ctext: number
location to store newly allocated data for the property.
length: number
the length of text, in bytes
Returns number
string_width
string_width(font: Gdk.Font, string: string): number
Determines the width of a nul-terminated string.
(The distance from the origin of the string to the
point where the next string in a sequence of strings
should be drawn)
This function retrieves a pixel from window to force the windowing
system to carry out any pending rendering commands.
This function is intended to be used to syncronize with rendering
pipelines, to benchmark windowing system rendering operations.
This function is intended to be used in GTK+ test programs.
It will warp the mouse pointer to the given (x,``y) corrdinates
within window and simulate a button press or release event.
Because the mouse pointer needs to be warped to the target
location, use of this function outside of test programs that
run in their own virtual windowing system (e.g. Xvfb) is not
recommended.
Also, gtk_test_simulate_button() is a fairly low level function,
for most testing purposes, gtk_test_widget_click() is the right
function to call which will generate a button press event followed
by its accompanying button release event.
This function is intended to be used in GTK+ test programs.
If (x,``y) are > (-1,-1), it will warp the mouse pointer to
the given (x,``y) corrdinates within window and simulate a
key press or release event.
When the mouse pointer is warped to the target location, use
of this function outside of test programs that run in their
own virtual windowing system (e.g. Xvfb) is not recommended.
If (x,``y) are passed as (-1,-1), the mouse pointer will not
be warped and window origin will be used as mouse pointer
location for the event.
Also, gtk_test_simulate_key() is a fairly low level function,
for most testing purposes, gtk_test_widget_send_key() is the
right function to call which will generate a key press event
followed by its accompanying key release event.
text_height(font: Gdk.Font, text: string, text_length: number): number
Determines the total height of a given string.
This value is not generally useful, because you cannot
determine how this total height will be drawn in
relation to the baseline. See gdk_text_extents().
text_measure(font: Gdk.Font, text: string, text_length: number): number
Determines the distance from the origin to the rightmost
portion of a string when drawn. This is not the
correct value for determining the origin of the next
portion when drawing text in multiple pieces.
See gdk_text_width().
Convert a text string from the encoding as it is stored
in a property into an array of strings in the encoding of
the current locale. (The elements of the array represent the
nul-separated elements of the original text string.)
threads_add_idle_full(priority: number, function_: SourceFunc): number
Adds a function to be called whenever there are no higher priority
events pending. If the function returns %FALSE it is automatically
removed from the list of event sources and will not be called again.
This variant of g_idle_add_full() calls function with the GDK lock
held. It can be thought of a MT-safe version for GTK+ widgets for the
following use case, where you have to worry about idle_callback()
running in thread A and accessing self after it has been finalized
in thread B:
|[
static gboolean
idle_callback (gpointer data)
{
/* gdk_threads_enter(); would be needed for g_idle_add() */
SomeWidget *self = data;
/* do stuff with self */
self->idle_id = 0;
/* gdk_threads_leave(); would be needed for g_idle_add() */
return FALSE;
}
static void
some_widget_do_stuff_later (SomeWidget *self)
{
self->idle_id = gdk_threads_add_idle (idle_callback, self)
/* using g_idle_add() here would require thread protection in the callback */
}
threads_add_timeout_full(priority: number, interval: number, function_: SourceFunc): number
Sets a function to be called at regular intervals holding the GDK lock,
with the given priority. The function is called repeatedly until it
returns %FALSE, at which point the timeout is automatically destroyed
and the function will not be called again. The notify function is
called when the timeout is destroyed. The first call to the
function will be at the end of the first interval.
Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given interval
(it does not try to 'catch up' time lost in delays).
This variant of g_timeout_add_full() can be thought of a MT-safe version
for GTK+ widgets for the following use case:
threads_add_timeout_seconds_full(priority: number, interval: number, function_: SourceFunc): number
A variant of gdk_threads_add_timout_full() with second-granularity.
See g_timeout_add_seconds_full() for a discussion of why it is
a good idea to use this function if you don't need finer granularity.
Return value: the ID (greater than 0) of the event source.
Parameters
priority: number
the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
interval: number
the time between calls to the function, in seconds
Initializes GDK so that it can be used from multiple threads
in conjunction with gdk_threads_enter() and gdk_threads_leave().
g_thread_init() must be called previous to this function.
This call must be made before any use of the main loop from
GTK+; to be safe, call it before gtk_init().
Returns void
threads_leave
threads_leave(): void
Returns void
unicode_to_keyval
unicode_to_keyval(wc: number): number
Convert from a ISO10646 character to a key symbol.
location to store the length of the data stored in ctext
Returns boolean
utf8_to_string_target
utf8_to_string_target(str: string): string
Converts an UTF-8 string into the best possible representation
as a STRING. The representation of characters not in STRING
is not specified; it may be as pseudo-escape sequences
\x{ABCD}, or it may be in some other form of approximation.
Parameters
str: string
a UTF-8 string
Returns string
wcstombs
wcstombs(src: number): string
Converts a wide character string to a multi-byte string.
(The function name comes from an acronym of 'Wide Character String TO
Multi-Byte String').
Obtains the window underneath the mouse pointer, returning the
location of that window in win_x,win_y. Returns %NULL if the
window under the mouse pointer is not known to GDK (if the window
belongs to another application and a #GdkWindow hasn't been created
for it with gdk_window_foreign_new())
NOTE: For multihead-aware widgets or applications use
gdk_display_get_window_at_pointer() instead.
a mask indicating what portions of geometry are set
width: number
desired width of window
height: number
desired height of the window
Returns [number, number]
window_process_all_updates
window_process_all_updates(): void
Calls gdk_window_process_updates() for all windows (see #GdkWindow)
in the application.
Returns void
window_set_debug_updates
window_set_debug_updates(setting: boolean): void
With update debugging enabled, calls to
gdk_window_invalidate_region() clear the invalidated region of the
screen to a noticeable color, and GDK pauses for a short time
before sending exposes to windows during
gdk_window_process_updates(). The net effect is that you can see
the invalid region for each window and watch redraws as they
occur. This allows you to diagnose inefficiencies in your application.
In essence, because the GDK rendering model prevents all flicker,
if you are redrawing the same region 400 times you may never
notice, aside from noticing a speed problem. Enabling update
debugging causes GTK to flicker slowly and noticeably, so you can
see exactly what's being redrawn when, in what order.
The --gtk-debug=updates command line option passed to GTK+ programs
enables this debug option at application startup time. That's
usually more useful than calling gdk_window_set_debug_updates()
yourself, though you might want to use this function to enable
updates sometime after application startup time.
Appends gdk option entries to the passed in option group. This is not public API and must not be used by applications.