GDK is free; this means that everyone is free to use it and free to redestribute it on a free basis. GDK is not in the public domain; it is copyrighted and there are restrictions on its distribution, but these restrictions are designed to permit everything that a good cooperating citizen would want to do. What is not allowed is to try to prevent others from further sharing any version of GDK that they might get from you.
Specifically, we want to make sure that you have the right to give away copies of GDK, that you receive source code or else can get it if you want it, that you can change GDK or use pieces of it in new free programs, and that you know you can do these things.
To make sure that everyone has such rights, we have to forbid you to deprive anyone else of these rights. For example, if you distribute copies of GDK, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights.
Also, for my own protection, we must make certain that everyone finds out that there is no warranty for GDK. If GDK is modified by someone else and passed on, we want their recipients to know that what they have is not what we distributed, so that any problems introduced by others will no reflect on our reputation.
The precise conditions of the licenses for GDK are found in the General Public Licenses that accompanies it.
GDK is designed as a wrapper library that lies on top of Xlib. It performs many common and desired operations for a programmer instead of the programmer having to explicitly ask for such functionality from Xlib directly. For example, GDK provides a common interface to both regular and shared memory XImage types. By doing so, an application can nearly transparently use the fastest image type available. GDK also provides routines for determining the best available color depth and the best available visual which is not always the default visual for a screen.
Initializing GDK is easy. Simply call gdk_init
passing in the
argc and argv parameters. Exit is similarly easy. Just
call gdk_exit
.
main
upon program invocation.
gdk_exit
will call
the systems exit
function passing errorcode as the
parameter.
int main (int argc, char *argv[]) { /* Initialize GDK. */ gdk_init (&argc, &argv); /* Exit from GDK...this call will never return. */ gdk_exit (0); /* Keep compiler from issuing a warning */ return 0; }
Events are the means by which GDK lets the programmer know of user interaction. An event is normally a button or key press or some other indirect user action, such as a the mouse cursor entering or leaving a window.
There exist only a few functions for getting events and event
information. These are gdk_events_pending
,
gdk_event_get
, gdk_events_record
and
gdk_events_playback
. The latter two functions are useful for
automatic testing of a software package and should normally not be
needed in a program.
gdk_event_get
will return TRUE
on success and
FALSE
on failure. Success and failure is determined by whether
an event arrived before the timeout period expired.
gdk_events_record
is called and when
gdk_events_playback
is called. For this reason,
gdk_events_record
is normally not called directly, but is instead
invoked indirectly by specifying the "-record" command line option.
gdk_events_record
). Normally this function is not called directly
but is invoked by the "-playback" command line option.
void handle_event () { GdkEvent event; if (gdk_event_get (&event)) { switch (event.type) { ... } } }
Jump to: g
Jump to: c - d - e - f - g - i - m - o - p - t - u - v - w
This document was generated on 25 May 2000 using texi2html 1.56k.