1999-08-16 18:51:52 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
General
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
2000-02-01 04:27:56 +00:00
|
|
|
library initialization and miscellaneous functions.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
This section describes the GDK initialization functions and miscellaneous
|
|
|
|
utility functions.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_init ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Initializes the GDK library and connects to the X server.
|
|
|
|
If initialization fails, a warning message is output and the application
|
|
|
|
terminates with a call to exit(1).
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Any arguments used by GDK are removed from the array and @argc and @argv are
|
|
|
|
updated accordingly.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
GTK+ initializes GDK in gtk_init() and so this function is not usually needed
|
|
|
|
by GTK+ applications.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@argc: the number of command line arguments.
|
|
|
|
@argv: the array of command line arguments.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_init_check ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Initializes the GDK library and connects to the X server, returning TRUE on
|
|
|
|
success.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Any arguments used by GDK are removed from the array and @argc and @argv are
|
|
|
|
updated accordingly.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
GTK+ initializes GDK in gtk_init() and so this function is not usually needed
|
|
|
|
by GTK+ applications.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@argc: the number of command line arguments.
|
|
|
|
@argv: the array of command line arguments.
|
|
|
|
@Returns: TRUE if initialization succeeded.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_exit ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Exits the application using the exit() system call.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
This routine is provided mainly for backwards compatability, since it used to
|
|
|
|
perform tasks necessary to exit the application cleanly. Those tasks are now
|
|
|
|
performed in a function which is automatically called on exit (via the use
|
|
|
|
of g_atexit()).
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@error_code: the error code to pass to the exit() call.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_set_locale ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Initializes the support for internationalization by calling the setlocale()
|
|
|
|
system call. This function is called by gtk_set_locale() and so GTK+
|
|
|
|
applications should use that instead.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
The locale to use is determined by the LANG environment variable,
|
|
|
|
so to run an application in a certain locale you can do something like this:
|
|
|
|
<informalexample>
|
|
|
|
<programlisting>
|
|
|
|
export LANG="fr"
|
|
|
|
... run application ...
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
If the locale is not supported by X then it is reset to the standard "C"
|
|
|
|
locale.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the resulting locale.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_set_sm_client_id ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
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.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
The leader window is automatically created by GDK and never shown. It's only
|
|
|
|
use is for session management. The WM_CLIENT_LEADER property is automatically
|
|
|
|
set on all X windows created by the application to point to the leader window.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
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 Windows distribution.)
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@sm_client_id: the client id assigned by the session manager when the
|
|
|
|
connection was opened, or NULL to remove the property.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_get_display ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Gets the name of the display, which usually comes from the DISPLAY
|
|
|
|
environment variable or the --display command line option.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the name of the display.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_flush ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Flushes the X output buffer and waits until all requests have been processed
|
|
|
|
by the server. This is rarely needed by applications. It's main use is for
|
|
|
|
trapping X errors with gdk_error_trap_push() and gdk_error_trap_pop().
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_screen_width ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns the width of the screen in pixels.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the width of the screen in pixels.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_screen_height ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns the height of the screen in pixels.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the height of the screen in pixels.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_screen_width_mm ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns the width of the screen in millimeters.
|
|
|
|
Note that on many X servers this value will not be correct.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the width of the screen in millimeters, though it is not always
|
|
|
|
correct.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_screen_height_mm ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns the height of the screen in millimeters.
|
|
|
|
Note that on many X servers this value will not be correct.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the height of the screen in millimeters, though it is not always
|
|
|
|
correct.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_pointer_grab ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Grabs the pointer (usually a mouse) so that all events are passed to this
|
|
|
|
application until the pointer is ungrabbed with gdk_pointer_ungrab(), or
|
|
|
|
the grab window becomes unviewable.
|
|
|
|
This overrides any previous pointer grab by this client.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Pointer grabs are used for operations which need complete control over mouse
|
|
|
|
events, even if the mouse leaves the application.
|
|
|
|
For example in GTK+ it is used for Drag and Drop, for dragging the handle in
|
|
|
|
the #GtkHPaned and #GtkVPaned widgets, and for resizing columns in #GtkCList
|
|
|
|
widgets.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Note that if the event mask of an X window has selected both button press and
|
|
|
|
button release events, then a button press event will cause an automatic
|
|
|
|
pointer grab until the button is released.
|
|
|
|
X does this automatically since most applications expect to receive button
|
|
|
|
press and release events in pairs.
|
|
|
|
It is equivalent to a pointer grab on the window with @owner_events set to
|
|
|
|
TRUE.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@window: the #GdkWindow which will own the grab (the grab window).
|
|
|
|
@owner_events: if FALSE then all pointer events are reported with respect to
|
|
|
|
@window and are only reported if selected by @event_mask. If TRUE then pointer
|
|
|
|
events for this application are reported as normal, but pointer events outside
|
|
|
|
this application are reported with respect to @window and only if selected by
|
|
|
|
@event_mask. In either mode, unreported events are discarded.
|
|
|
|
@event_mask: specifies the event mask, which is used in accordance with
|
|
|
|
@owner_events.
|
|
|
|
@confine_to: TRUE to confine the pointer to @window. If the pointer is outside
|
|
|
|
@window, it will automatically be moved to the closest edge of @window and
|
|
|
|
enter and leave events will be generated as necessary.
|
|
|
|
@cursor: the cursor to display while the grab is active. If this is NULL then
|
|
|
|
the normal cursors are used for @window and its descendants, and the cursor
|
|
|
|
for @window is used for all other windows.
|
|
|
|
@time: the timestamp of the event which led to this pointer grab. This usually
|
|
|
|
comes from a #GdkEventButton struct, though #GDK_CURRENT_TIME can be used if
|
|
|
|
the time isn't known.
|
|
|
|
@Returns: 0 if the grab was successful.
|
|
|
|
|
1999-08-16 18:51:52 +00:00
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_pointer_ungrab ##### -->
|
|
|
|
<para>
|
|
|
|
Ungrabs the pointer, if it is grabbed by this application.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@time: a timestamp from a #GdkEvent, or #GDK_CURRENT_TIME if no timestamp is
|
|
|
|
available.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_pointer_is_grabbed ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns TRUE if the pointer is currently grabbed by this application.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Note that the return value is not completely reliable since the X server may
|
|
|
|
automatically ungrab the pointer, without informing the application, if the
|
|
|
|
grab window becomes unviewable. It also does not take passive pointer grabs
|
|
|
|
into account.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: TRUE if the pointer is currently grabbed by this application.
|
|
|
|
Though this value is not always correct.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_keyboard_grab ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Grabs the keyboard so that all events are passed to this
|
|
|
|
application until the keyboard is ungrabbed with gdk_keyboard_ungrab().
|
|
|
|
This overrides any previous keyboard grab by this client.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@window: the #GdkWindow which will own the grab (the grab window).
|
|
|
|
@owner_events: if FALSE then all keyboard events are reported with respect to
|
|
|
|
@window. If TRUE then keyboard events for this application are reported as
|
|
|
|
normal, but keyboard events outside this application are reported with respect
|
|
|
|
to @window. Both key press and key release events are alwasy reported,
|
|
|
|
independant of the event mask set by the application.
|
|
|
|
@time: a timestamp from a #GdkEvent, or #GDK_CURRENT_TIME if no timestamp is
|
|
|
|
available.
|
|
|
|
@Returns: 0 if the grab was successful.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_keyboard_ungrab ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Ungrabs the keyboard, if it is grabbed by this application.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@time: a timestamp from a #GdkEvent, or #GDK_CURRENT_TIME if no timestamp is
|
|
|
|
available.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_key_repeat_disable ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Disables the keyboard auto-repeat mode.
|
|
|
|
This should be used with care as it may affect other applications.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_key_repeat_restore ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Restores the keyboard auto-repeat mode to its state when the application was
|
|
|
|
started.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_beep ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Emits a short beep.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_get_use_xshm ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Returns TRUE if GDK will attempt to use the MIT-SHM shared memory extension.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The shared memory extension is used for #GdkImage, and consequently for
|
|
|
|
<link linkend="gdk-GdkRGB">GdkRGB</link>.
|
|
|
|
It enables much faster drawing by communicating with the X server through
|
|
|
|
SYSV shared memory calls. However, it can only be used if the X client and
|
|
|
|
server are on the same machine and the server supports it.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: TRUE if use of the MIT shared memory extension will be attempted.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
<!-- ##### FUNCTION gdk_set_use_xshm ##### -->
|
1999-08-16 18:51:52 +00:00
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Sets whether the use of the MIT shared memory extension should be attempted.
|
|
|
|
This function is mainly for internal use. It is only safe for an application
|
|
|
|
to set this to FALSE, since if it is set to TRUE and the server does not
|
|
|
|
support the extension it may cause warning messages to be output.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@use_xshm: TRUE if use of the MIT shared memory extension should be attempted.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_error_trap_push ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
This function allows X errors to be trapped instead of the normal behavior
|
|
|
|
of exiting the application. It should only be used if it is not possible to
|
|
|
|
avoid the X error in any other way.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
2000-02-01 04:27:56 +00:00
|
|
|
<example>
|
|
|
|
<title>Trapping an X error.</title>
|
|
|
|
<programlisting>
|
|
|
|
gdk_error_trap_push ();
|
|
|
|
|
|
|
|
/* ... Call the X function which may cause an error here ... */
|
|
|
|
|
|
|
|
/* Flush the X queue to catch errors now. */
|
|
|
|
gdk_flush ();
|
|
|
|
|
|
|
|
if (gdk_error_trap_pop ())
|
|
|
|
{
|
|
|
|
/* ... Handle the error here ... */
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_error_trap_pop ##### -->
|
|
|
|
<para>
|
2000-02-01 04:27:56 +00:00
|
|
|
Removes the X error trap installed with gdk_error_trap_push().
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
2000-02-01 04:27:56 +00:00
|
|
|
@Returns: the X error code, or 0 if no error occurred.
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
|