## General

General

## Functions

void | gdk_init ()
gboolean | gdk_init_check ()
void | gdk_parse_args ()
const gchar * | gdk_get_display_arg_name ()
gchar * | gdk_set_locale ()
void | gdk_set_sm_client_id ()
void | gdk_exit ()
void | gdk_notify_startup_complete ()
void | gdk_notify_startup_complete_with_id ()
const char * | gdk_get_program_class ()
void | gdk_set_program_class ()
gchar * | gdk_get_display ()
void | gdk_flush ()
gint | gdk_screen_width ()
gint | gdk_screen_height ()
gint | gdk_screen_width_mm ()
gint | gdk_screen_height_mm ()
GdkGrabStatus | gdk_pointer_grab ()
void | gdk_pointer_ungrab ()
gboolean | gdk_pointer_is_grabbed ()
void | gdk_set_double_click_time ()
GdkGrabStatus | gdk_keyboard_grab ()
void | gdk_keyboard_ungrab ()
void | gdk_beep ()
gboolean | gdk_get_use_xshm ()
void | gdk_set_use_xshm ()
void | gdk_error_trap_push ()
gint | gdk_error_trap_pop ()

## Types and Values

enum | GdkGrabStatus
#define | GDK_WINDOWING_X11

## Includes

    #include <gdk/gdk.h>

## Description

## Functions

### gdk_init ()

    void
    gdk_init (gint *argc,
              gchar ***argv);

#### Parameters

argc | . | [inout]
argv | . | [array length=argc][inout]

### gdk_init_check ()

    gboolean
    gdk_init_check (gint *argc,
                    gchar ***argv);

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.

Side effects: The library is initialized.

#### Side effects: The library is initialized.

#### Parameters

argc | . | [inout]
argv | . | [array length=argc][inout]

### gdk_parse_args ()

    void
    gdk_parse_args (gint *argc,
                    gchar ***argv);

Parse command line arguments, and store for future use by calls to `gdk_display_open()`.

Any arguments used by GDK are removed from the array and `argc` and `argv` are updated accordingly.

You shouldn't call this function explicitely if you are using `gtk_init()`, `gtk_init_check()`, `gdk_init()`, or `gdk_init_check()`.

#### Parameters

argc | the number of command line arguments. |
argv | the array of command line arguments. | [inout][array length=argc]

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 `gdk_init()` or `gdk_parse_args()`, if any.

#### Returns

the display name, if specified explicitely, otherwise `NULL` this string is owned by GTK+ and must not be modified or freed.

Since: 2.2

### gdk_set_locale ()

    gchar *
    gdk_set_locale (void);

`gdk_set_locale` is deprecated and should not be used in newly-written code.

### gdk_set_sm_client_id ()

    void
    gdk_set_sm_client_id (const gchar *sm_client_id);

`gdk_set_sm_client_id` has been deprecated since version 2.24 and should not be used in newly-written code.

Use `gdk_x11_set_sm_client_id()` instead

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 | the client id assigned by the session manager when the connection was opened, or `NULL` to remove the property. |

### gdk_exit ()

    void
    gdk_exit (gint error_code);

`gdk_exit` is deprecated and should not be used in newly-written code.

### 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 `gtk_window_set_auto_startup_notification()` is called to disable that feature.

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 `gtk_window_set_auto_startup_notification()` is called to disable that feature.

#### Parameters

startup_id | a startup-notification identifier, for which notification process should be completed |

Since: 2.12

### gdk_get_program_class ()

    const char *
    gdk_get_program_class (void);

### gdk_set_program_class ()

    void
    gdk_set_program_class (const char *program_class);

### gdk_get_display ()

    gchar *
    gdk_get_display (void);

### gdk_flush ()

    void
    gdk_flush (void);

### gdk_screen_width ()

    gint
    gdk_screen_width (void);

Returns the width of the default screen in pixels.

#### 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.

#### 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.

#### Returns

the width of the default screen in millimeters, though it is not always 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.

#### Returns

the height of the default screen in millimeters, though it is not always correct.

### gdk_pointer_grab ()

    GdkGrabStatus
    gdk_pointer_grab (GdkWindow *window,
                      gboolean owner_events,
                      GdkEventMask event_mask,
                      GdkWindow *confine_to,
                      GdkCursor *cursor,
                      guint32 time_);

### gdk_pointer_ungrab ()

    void
    gdk_pointer_ungrab (guint32 time_);

Ungrabs the pointer on the default display, if it is grabbed by this application.

#### Parameters

time_ | a timestamp from a GdkEvent, or `GDK_CURRENT_TIME` if no timestamp is available. |

### gdk_pointer_is_grabbed ()

    gboolean
    gdk_pointer_is_grabbed (void);

Returns `TRUE` if the pointer on the default display is currently grabbed by this application.

Note that this does not take the inmplicit pointer grab on button presses into account.

#### Returns

`TRUE` if the pointer is currently grabbed by this application.*

### gdk_set_double_click_time ()

    void
    gdk_set_double_click_time (guint msec);

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 | double click time in milliseconds (thousandths of a second) |

### gdk_keyboard_grab ()

    GdkGrabStatus
    gdk_keyboard_grab (GdkWindow *window,
                       gboolean owner_events,
                       guint32 time_);

### gdk_keyboard_ungrab ()

    void
    gdk_keyboard_ungrab (guint32 time_);

Ungrabs the keyboard on the default display, if it is grabbed by this application.

#### Parameters

time_ | a timestamp from a GdkEvent, or `GDK_CURRENT_TIME` if no timestamp is available. |

### gdk_beep ()

    void
    gdk_beep (void);

Emits a short beep on the default display.

### gdk_get_use_xshm ()

    gboolean
    gdk_get_use_xshm (void);

`gdk_get_use_xshm` is deprecated and should not be used in newly-written code.

### gdk_set_use_xshm ()

    void
    gdk_set_use_xshm (gboolean use_xshm);

`gdk_set_use_xshm` is deprecated and should not be used in newly-written code.

### gdk_error_trap_push ()

    void
    gdk_error_trap_push (void);

### gdk_error_trap_pop ()

    gint
    gdk_error_trap_pop (void);

## Types and Values

### enum GdkGrabStatus

#### Members

GDK_GRAB_SUCCESS |  |
GDK_GRAB_ALREADY_GRABBED |  |
GDK_GRAB_INVALID_TIME |  |
GDK_GRAB_NOT_VIEWABLE |  |
GDK_GRAB_FROZEN |  |

### GDK_WINDOWING_X11

    #define GDK_WINDOWING_X11