Gdk

Description This section describes the GDK initialization functions and miscellaneous utility functions.

Members

Static functions

beep
void beep()

Emits a short beep on the default display.

errorTrapPop
int errorTrapPop()

Removes the X error trap installed with gdk_error_trap_push().

errorTrapPush
void errorTrapPush()

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.

exit
void exit(int errorCode)

Warning gdk_exit is deprecated and should not be used in newly-written code. Exits the application using the exit() system call. 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 g_atexit()).

flush
void flush()

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().

getDisplay
string getDisplay()

Gets the name of the display, which usually comes from the DISPLAY environment variable or the --display command line option.

getDisplayArgName
string getDisplayArgName()

Gets the display name specified in the command line arguments passed to gdk_init() or gdk_parse_args(), if any. Since 2.2

getProgramClass
string getProgramClass()

Gets the program class. Unless the program class has explicitly been set with gdk_set_program_class() or with the --class commandline option, the default value is the program name (determined with g_get_prgname()) with the first character converted to uppercase.

getUseXshm
int getUseXshm()

Warning gdk_get_use_xshm is deprecated and should not be used in newly-written code. Returns TRUE if GDK will attempt to use the MIT-SHM shared memory extension. 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.

init
void init(string[] 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 exit(1). Any arguments used by GDK are removed from the array and argc and argv are updated accordingly. GTK+ initializes GDK in gtk_init() and so this function is not usually needed by GTK+ applications.

initCheck
int initCheck(string[] argv)

Initialize the library for use.

keyboardGrab
GdkGrabStatus keyboardGrab(Window window, int ownerEvents, uint time)

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

keyboardUngrab
void keyboardUngrab(uint time)

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

notifyStartupComplete
void notifyStartupComplete()

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

notifyStartupCompleteWithId
void notifyStartupCompleteWithId(string startupId)

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. Since 2.12

parseArgs
void parseArgs(string[] 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(). Since 2.2

pointerGrab
GdkGrabStatus pointerGrab(Window window, int ownerEvents, GdkEventMask eventMask, Window confineTo, Cursor cursor, uint time)

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. 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 owner_events set to TRUE. 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.

pointerIsGrabbed
int pointerIsGrabbed()

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.

pointerUngrab
void pointerUngrab(uint time)

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

screenHeight
int screenHeight()

Returns the height of the default screen in pixels.

screenHeightMm
int screenHeightMm()

Returns the height of the default screen in millimeters. Note that on many X servers this value will not be correct.

screenWidth
int screenWidth()

Returns the width of the default screen in pixels.

screenWidthMm
int screenWidthMm()

Returns the width of the default screen in millimeters. Note that on many X servers this value will not be correct.

setDoubleClickTime
void setDoubleClickTime(uint 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.

setLocale
string setLocale()

Warning gdk_set_locale has been deprecated since version 2.24 and should not be used in newly-written code. Use setlocale() directly 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. The locale to use is determined by the LANG environment variable,

setProgramClass
void setProgramClass(string programClass)

Sets the program class. The X11 backend uses the program class to set the class name part of the WM_CLASS property on toplevel windows; see the ICCCM.

setSmClientId
void setSmClientId(string smClientId)

Warning 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.)

setUseXshm
void setUseXshm(int useXshm)

Warning gdk_set_use_xshm is deprecated and should not be used in newly-written code. 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.

Meta