Synopsis#include <gdk/gdk.h> void gdk_init (gint *argc, gchar ***argv); gboolean gdk_init_check (gint *argc, gchar ***argv); void gdk_parse_args (gint *argc, gchar ***argv); const gchar* gdk_get_display_arg_name (void); gchar* gdk_set_locale (void); void gdk_set_sm_client_id (const gchar *sm_client_id); void gdk_exit (gint error_code); void gdk_notify_startup_complete (void); void gdk_notify_startup_complete_with_id (const gchar *startup_id); const char* gdk_get_program_class (void); void gdk_set_program_class (const char *program_class); gchar* gdk_get_display (void); void gdk_flush (void); gint gdk_screen_width (void); gint gdk_screen_height (void); gint gdk_screen_width_mm (void); gint gdk_screen_height_mm (void); GdkGrabStatus gdk_pointer_grab (GdkWindow *window, gboolean owner_events, GdkEventMask event_mask, GdkWindow *confine_to, GdkCursor *cursor, guint32 time_); enum GdkGrabStatus; void gdk_pointer_ungrab (guint32 time_); gboolean gdk_pointer_is_grabbed (void); void gdk_set_double_click_time (guint msec); GdkGrabStatus gdk_keyboard_grab (GdkWindow *window, gboolean owner_events, guint32 time_); void gdk_keyboard_ungrab (guint32 time_); void gdk_beep (void); gboolean gdk_get_use_xshm (void); void gdk_set_use_xshm (gboolean use_xshm); void gdk_error_trap_push (void); gint gdk_error_trap_pop (void); #define GDK_WINDOWING_X11 #define GDK_WINDOWING_WIN32 DescriptionThis section describes the GDK initialization functions and miscellaneous utility functions. Detailsgdk_init ()void gdk_init (gint *argc, gchar ***argv);
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
Any arguments used by GDK are removed from the array and
GTK+ initializes GDK in
gdk_init_check ()gboolean gdk_init_check (gint *argc, gchar ***argv);
Initializes the GDK library and connects to the X server, returning
Any arguments used by GDK are removed from the array and
GTK+ initializes GDK in
gdk_parse_args ()void gdk_parse_args (gint *argc, gchar ***argv);
Parse command line arguments, and store for future
use by calls to
Any arguments used by GDK are removed from the array and
You shouldn't call this function explicitely if you are using
Since 2.2 gdk_get_display_arg_name ()const gchar* gdk_get_display_arg_name (void);
Gets the display name specified in the command line arguments passed
to
Since 2.2 gdk_set_locale ()gchar* gdk_set_locale (void);
Initializes the support for internationalization by calling the
The locale to use is determined by the export LANG="fr" ... run application ...
If the locale is not supported by X then it is reset to the standard "C" locale.
gdk_set_sm_client_id ()void gdk_set_sm_client_id (const gchar *sm_client_id);
Sets the
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
gdk_exit ()void gdk_exit (gint error_code); Warning
Exits the application using the
This routine is provided mainly for backwards compatibility, 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
gdk_notify_startup_complete ()void gdk_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
Since 2.2 gdk_notify_startup_complete_with_id ()void gdk_notify_startup_complete_with_id (const gchar *startup_id); 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
Since 2.12 gdk_get_program_class ()const char* gdk_get_program_class (void);
Gets the program class. Unless the program class has explicitly
been set with
gdk_set_program_class ()void gdk_set_program_class (const char *program_class);
Sets the program class. The X11 backend uses the program class to set
the class name part of the
gdk_get_display ()gchar* gdk_get_display (void);
Gets the name of the display, which usually comes from the
gdk_flush ()void gdk_flush (void);
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_screen_width ()gint gdk_screen_width (void); Returns the width of the default screen in pixels.
gdk_screen_height ()gint gdk_screen_height (void); Returns the height of the default screen in pixels.
gdk_screen_width_mm ()gint gdk_screen_width_mm (void); Returns the width of the default screen in millimeters. Note that on many X servers this value will not be correct.
gdk_screen_height_mm ()gint gdk_screen_height_mm (void); Returns the height of the default screen in millimeters. Note that on many X servers this value will not be correct.
gdk_pointer_grab ()GdkGrabStatus gdk_pointer_grab (GdkWindow *window, gboolean owner_events, GdkEventMask event_mask, GdkWindow *confine_to, GdkCursor *cursor, guint32 time_);
Grabs the pointer (usually a mouse) so that all events are passed to this
application until the pointer is ungrabbed with 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.
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 If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the GdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.
enum GdkGrabStatustypedef enum { GDK_GRAB_SUCCESS = 0, GDK_GRAB_ALREADY_GRABBED = 1, GDK_GRAB_INVALID_TIME = 2, GDK_GRAB_NOT_VIEWABLE = 3, GDK_GRAB_FROZEN = 4 } GdkGrabStatus;
Returned by
gdk_pointer_ungrab ()void gdk_pointer_ungrab (guint32 time_); Ungrabs the pointer on the default display, if it is grabbed by this application.
gdk_pointer_is_grabbed ()gboolean gdk_pointer_is_grabbed (void);
Returns Note that this does not take the inmplicit pointer grab on button presses into account.
gdk_set_double_click_time ()void gdk_set_double_click_time (guint msec);
Set the double click time for the default display. See
gdk_keyboard_grab ()GdkGrabStatus gdk_keyboard_grab (GdkWindow *window, gboolean owner_events, guint32 time_);
Grabs the keyboard so that all events are passed to this
application until the keyboard is ungrabbed with If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the GdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.
gdk_keyboard_ungrab ()void gdk_keyboard_ungrab (guint32 time_); Ungrabs the keyboard on the default display, if it is grabbed by this application.
gdk_get_use_xshm ()gboolean gdk_get_use_xshm (void); Warning
Returns The shared memory extension is used for GdkImage, and consequently for GdkRGB. 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.
gdk_set_use_xshm ()void gdk_set_use_xshm (gboolean use_xshm); Warning
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
gdk_error_trap_push ()void gdk_error_trap_push (void); 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. Example 1. Trapping an X error 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 ... */ } gdk_error_trap_pop ()gint gdk_error_trap_pop (void);
Removes the X error trap installed with
GDK_WINDOWING_X11#define GDK_WINDOWING_X11 This macro is defined if GDK is configured to use the X backend. |