1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
<title>Main loop and Events</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
7
<link rel="start" href="index.html" title="GTK+ Reference Manual">
8
<link rel="up" href="gtkbase.html" title="Part II. GTK+ Core Reference">
9
<link rel="prev" href="gtkbase.html" title="Part II. GTK+ Core Reference">
10
<link rel="next" href="gtk-Keyboard-Accelerators.html" title="Accelerator Groups">
11
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
14
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
15
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
16
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
17
<link rel="chapter" href="ch02.html" title="Widget Gallery">
18
<link rel="chapter" href="WindowWidgets.html" title="Windows">
19
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
20
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
21
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
22
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
23
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
24
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
25
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
26
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
27
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
28
<link rel="chapter" href="Ornaments.html" title="Ornaments">
29
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
30
<link rel="chapter" href="Printing.html" title="Printing">
31
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
32
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
33
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
34
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
35
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
36
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
37
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
38
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
39
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
40
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
41
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and GtkComboBoxEntry">
42
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
43
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
44
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
45
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
46
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
47
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
48
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
49
<link rel="glossary" href="glossary.html" title="Glossary">
50
<link rel="index" href="ix01.html" title="Index">
51
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
52
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
53
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
54
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
55
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
56
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
58
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
59
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
61
<td><a accesskey="p" href="gtkbase.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
62
<td><a accesskey="u" href="gtkbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
63
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
64
<th width="100%" align="center">GTK+ Reference Manual</th>
65
<td><a accesskey="n" href="gtk-Keyboard-Accelerators.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
67
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2630618" class="shortcut">Top</a>
69
<a href="#id2631993" class="shortcut">Description</a></nobr></td></tr>
71
<div class="refentry" lang="en">
72
<a name="gtk-General"></a><div class="titlepage"></div>
73
<div class="refnamediv"><table width="100%"><tr>
76
<a name="id2630618"></a><span class="refentrytitle">Main loop and Events</span>
78
<p>Main loop and Events — Library initialization, main event loop, and events</p>
80
<td valign="top" align="right"></td>
82
<div class="refsynopsisdiv">
84
<pre class="synopsis">
86
#include <gtk/gtk.h>
89
gchar* <a href="gtk-General.html#gtk-set-locale">gtk_set_locale</a> (void);
90
void <a href="gtk-General.html#gtk-disable-setlocale">gtk_disable_setlocale</a> (void);
91
PangoLanguage* <a href="gtk-General.html#gtk-get-default-language">gtk_get_default_language</a> (void);
92
gboolean <a href="gtk-General.html#gtk-parse-args">gtk_parse_args</a> (int *argc,
94
void <a href="gtk-General.html#gtk-init">gtk_init</a> (int *argc,
96
gboolean <a href="gtk-General.html#gtk-init-check">gtk_init_check</a> (int *argc,
98
gboolean <a href="gtk-General.html#gtk-init-with-args">gtk_init_with_args</a> (int *argc,
100
char *parameter_string,
101
GOptionEntry *entries,
102
char *translation_domain,
104
GOptionGroup* <a href="gtk-General.html#gtk-get-option-group">gtk_get_option_group</a> (gboolean open_default_display);
105
void <a href="gtk-General.html#gtk-exit">gtk_exit</a> (gint error_code);
106
gboolean <a href="gtk-General.html#gtk-events-pending">gtk_events_pending</a> (void);
107
void <a href="gtk-General.html#gtk-main">gtk_main</a> (void);
108
guint <a href="gtk-General.html#gtk-main-level">gtk_main_level</a> (void);
109
void <a href="gtk-General.html#gtk-main-quit">gtk_main_quit</a> (void);
110
gboolean <a href="gtk-General.html#gtk-main-iteration">gtk_main_iteration</a> (void);
111
gboolean <a href="gtk-General.html#gtk-main-iteration-do">gtk_main_iteration_do</a> (gboolean blocking);
112
void <a href="gtk-General.html#gtk-main-do-event">gtk_main_do_event</a> (<a
113
href="../gdk/gdk-Event-Structures.html#GdkEvent"
114
>GdkEvent</a> *event);
115
void (<a href="gtk-General.html#GtkModuleInitFunc">*GtkModuleInitFunc</a>) (gint *argc,
117
void (<a href="gtk-General.html#GtkModuleDisplayInitFunc">*GtkModuleDisplayInitFunc</a>) (<a
118
href="../gdk/GdkDisplay.html"
119
>GdkDisplay</a> *display);
121
gboolean <a href="gtk-General.html#gtk-true">gtk_true</a> (void);
122
gboolean <a href="gtk-General.html#gtk-false">gtk_false</a> (void);
124
void <a href="gtk-General.html#gtk-grab-add">gtk_grab_add</a> (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);
125
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="gtk-General.html#gtk-grab-get-current">gtk_grab_get_current</a> (void);
126
void <a href="gtk-General.html#gtk-grab-remove">gtk_grab_remove</a> (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);
128
void <a href="gtk-General.html#gtk-init-add">gtk_init_add</a> (<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
130
void <a href="gtk-General.html#gtk-quit-add-destroy">gtk_quit_add_destroy</a> (guint main_level,
131
<a href="GtkObject.html" title="GtkObject">GtkObject</a> *object);
132
guint <a href="gtk-General.html#gtk-quit-add">gtk_quit_add</a> (guint main_level,
133
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
135
guint <a href="gtk-General.html#gtk-quit-add-full">gtk_quit_add_full</a> (guint main_level,
136
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
137
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
139
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);
140
void <a href="gtk-General.html#gtk-quit-remove">gtk_quit_remove</a> (guint quit_handler_id);
141
void <a href="gtk-General.html#gtk-quit-remove-by-data">gtk_quit_remove_by_data</a> (gpointer data);
143
guint <a href="gtk-General.html#gtk-timeout-add-full">gtk_timeout_add_full</a> (guint32 interval,
144
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
145
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
147
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);
148
guint <a href="gtk-General.html#gtk-timeout-add">gtk_timeout_add</a> (guint32 interval,
149
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
151
void <a href="gtk-General.html#gtk-timeout-remove">gtk_timeout_remove</a> (guint timeout_handler_id);
153
guint <a href="gtk-General.html#gtk-idle-add">gtk_idle_add</a> (<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
155
guint <a href="gtk-General.html#gtk-idle-add-priority">gtk_idle_add_priority</a> (gint priority,
156
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
158
guint <a href="gtk-General.html#gtk-idle-add-full">gtk_idle_add_full</a> (gint priority,
159
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
160
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
162
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);
163
void <a href="gtk-General.html#gtk-idle-remove">gtk_idle_remove</a> (guint idle_handler_id);
164
void <a href="gtk-General.html#gtk-idle-remove-by-data">gtk_idle_remove_by_data</a> (gpointer data);
166
guint <a href="gtk-General.html#gtk-input-add-full">gtk_input_add_full</a> (gint source,
168
href="../gdk/gdk-Input.html#GdkInputCondition"
169
>GdkInputCondition</a> condition,
171
href="../gdk/gdk-Input.html#GdkInputFunction"
172
>GdkInputFunction</a> function,
173
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
175
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);
176
void <a href="gtk-General.html#gtk-input-remove">gtk_input_remove</a> (guint input_handler_id);
178
#define <a href="gtk-General.html#GTK-PRIORITY-REDRAW:CAPS">GTK_PRIORITY_REDRAW</a>
179
#define <a href="gtk-General.html#GTK-PRIORITY-RESIZE:CAPS">GTK_PRIORITY_RESIZE</a>
180
#define <a href="gtk-General.html#GTK-PRIORITY-HIGH:CAPS">GTK_PRIORITY_HIGH</a>
181
#define <a href="gtk-General.html#GTK-PRIORITY-INTERNAL:CAPS">GTK_PRIORITY_INTERNAL</a>
182
#define <a href="gtk-General.html#GTK-PRIORITY-DEFAULT:CAPS">GTK_PRIORITY_DEFAULT</a>
183
#define <a href="gtk-General.html#GTK-PRIORITY-LOW:CAPS">GTK_PRIORITY_LOW</a>
185
guint <a href="gtk-General.html#gtk-key-snooper-install">gtk_key_snooper_install</a> (<a href="gtk-General.html#GtkKeySnoopFunc">GtkKeySnoopFunc</a> snooper,
187
gint (<a href="gtk-General.html#GtkKeySnoopFunc">*GtkKeySnoopFunc</a>) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *grab_widget,
189
href="../gdk/gdk-Event-Structures.html#GdkEventKey"
190
>GdkEventKey</a> *event,
192
void <a href="gtk-General.html#gtk-key-snooper-remove">gtk_key_snooper_remove</a> (guint snooper_handler_id);
195
href="../gdk/gdk-Event-Structures.html#GdkEvent"
196
>GdkEvent</a>* <a href="gtk-General.html#gtk-get-current-event">gtk_get_current_event</a> (void);
197
guint32 <a href="gtk-General.html#gtk-get-current-event-time">gtk_get_current_event_time</a> (void);
198
gboolean <a href="gtk-General.html#gtk-get-current-event-state">gtk_get_current_event_state</a> (<a
199
href="../gdk/gdk-Windows.html#GdkModifierType"
200
>GdkModifierType</a> *state);
201
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="gtk-General.html#gtk-get-event-widget">gtk_get_event_widget</a> (<a
202
href="../gdk/gdk-Event-Structures.html#GdkEvent"
203
>GdkEvent</a> *event);
204
void <a href="gtk-General.html#gtk-propagate-event">gtk_propagate_event</a> (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget,
206
href="../gdk/gdk-Event-Structures.html#GdkEvent"
207
>GdkEvent</a> *event);
211
<div class="refsect1" lang="en">
212
<a name="id2631993"></a><h2>Description</h2>
214
Before using GTK+, you need to initialize it; initialization connects
215
to the window system display, and parses some standard command line
216
arguments. The <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> function initializes GTK+. <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> exits
217
the application if errors occur; to avoid this, use <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a>.
218
<a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a> allows you to recover from a failed GTK+
219
initialization - you might start up your application in text mode instead.
222
Like all GUI toolkits, GTK+ uses an event-driven programming
223
model. When the user is doing nothing, GTK+ sits in the
224
<em class="firstterm">main loop</em> and waits for input. If the user
225
performs some action - say, a mouse click - then the main loop "wakes
226
up" and delivers an event to GTK+. GTK+ forwards the event to one or
230
When widgets receive an event, they frequently emit one or more
231
<em class="firstterm">signals</em>. Signals notify your program that
232
"something interesting happened" by invoking functions you've
233
connected to the signal with <code class="function">g_signal_connect()</code>. Functions connected
234
to a signal are often termed <em class="firstterm">callbacks</em>.
237
When your callbacks are invoked, you would typically take some action
238
- for example, when an Open button is clicked you might display a
239
<span class="type">GtkFileSelectionDialog</span>. After a callback finishes, GTK+ will return
240
to the main loop and await more user input.
242
<div class="example">
243
<a name="id2632109"></a><p class="title"><b>Example 1. Typical <code class="function">main</code> function for a GTK+ application</b></p>
244
<div class="example-contents"><pre class="programlisting">
246
main (int argc, char **argv)
248
/* Initialize i18n support */
251
/* Initialize the widget set */
252
gtk_init (&argc, &argv);
254
/* Create the main window */
255
mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
257
/* Set up our GUI elements */
260
/* Show the application window */
261
gtk_widget_show_all (mainwin);
263
/* Enter the main event loop, and wait for user interaction */
266
/* The user lost interest */
271
<br class="example-break"><p>
272
It's OK to use the GLib main loop directly instead of <a href="gtk-General.html#gtk-main"><code class="function">gtk_main()</code></a>,
273
though it involves slightly more typing. See <span class="type">GMainLoop</span> in the GLib
277
<div class="refsect1" lang="en">
278
<a name="id2632173"></a><h2>Details</h2>
279
<div class="refsect2" lang="en">
280
<a name="id2632183"></a><h3>
281
<a name="gtk-set-locale"></a>gtk_set_locale ()</h3>
282
<a class="indexterm" name="id2632196"></a><pre class="programlisting">gchar* gtk_set_locale (void);</pre>
284
Initializes internationalization support for GTK+. <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a>
285
automatically does this, so there is typically no point
286
in calling this function.
289
If you are calling this function because you changed the locale
290
after GTK+ is was initialized, then calling this function
291
may help a bit. (Note, however, that changing the locale
292
after GTK+ is initialized may produce inconsistent results and
293
is not really supported.)
296
In detail - sets the current locale according to the
297
program environment. This is the same as calling the C library function
298
<code class="literal">setlocale (LC_ALL, "")</code> but also takes care of the
299
locale specific setup of the windowing system used by GDK.</p>
302
<div class="variablelist"><table border="0">
303
<col align="left" valign="top">
305
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
306
<td> a string corresponding to the locale set, typically in the
307
form lang_COUNTRY, where lang is an ISO-639 language code, and
308
COUNTRY is an ISO-3166 country code. On Unix, this form matches the
309
result of the <code class="function">setlocale()</code>; it is also used on other machines, such as
310
Windows, where the C library returns a different result. The string is
311
owned by GTK+ and should not be modified or freed.
317
<div class="refsect2" lang="en">
318
<a name="id2632286"></a><h3>
319
<a name="gtk-disable-setlocale"></a>gtk_disable_setlocale ()</h3>
320
<a class="indexterm" name="id2632298"></a><pre class="programlisting">void gtk_disable_setlocale (void);</pre>
322
Prevents <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a>, <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a>, <a href="gtk-General.html#gtk-init-with-args"><code class="function">gtk_init_with_args()</code></a> and
323
<a href="gtk-General.html#gtk-parse-args"><code class="function">gtk_parse_args()</code></a> from automatically
324
calling <code class="literal">setlocale (LC_ALL, "")</code>. You would
325
want to use this function if you wanted to set the locale for
326
your program to something other than the user's locale, or if
327
you wanted to set different values for different locale categories.
330
Most programs should not need to call this function.</p>
336
<div class="refsect2" lang="en">
337
<a name="id2632382"></a><h3>
338
<a name="gtk-get-default-language"></a>gtk_get_default_language ()</h3>
339
<a class="indexterm" name="id2632395"></a><pre class="programlisting">PangoLanguage* gtk_get_default_language (void);</pre>
341
Returns the <span class="type">PangoLanguage</span> for the default language currently in
342
effect. (Note that this can change over the life of an
343
application.) The default language is derived from the current
344
locale. It determines, for example, whether GTK+ uses the
345
right-to-left or left-to-right text direction. See
346
<code class="function">_gtk_get_lc_ctype()</code> for notes on behaviour on Windows.</p>
350
<div class="variablelist"><table border="0">
351
<col align="left" valign="top">
353
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
354
<td> the default language as a <span class="type">PangoLanguage</span>, must not be
361
<div class="refsect2" lang="en">
362
<a name="id2632470"></a><h3>
363
<a name="gtk-parse-args"></a>gtk_parse_args ()</h3>
364
<a class="indexterm" name="id2632483"></a><pre class="programlisting">gboolean gtk_parse_args (int *argc,
367
Parses command line arguments, and initializes global
368
attributes of GTK+, but does not actually open a connection
369
to a display. (See <a
370
href="../gdk/GdkDisplay.html#gdk-display-open"
371
><code class="function">gdk_display_open()</code></a>, <a
372
href="../gdk/gdk-General.html#gdk-get-display-arg-name"
373
><code class="function">gdk_get_display_arg_name()</code></a>)
376
Any arguments used by GTK+ or GDK are removed from the array and
377
<em class="parameter"><code>argc</code></em> and <em class="parameter"><code>argv</code></em> are updated accordingly.
380
You shouldn't call this function explicitely if you are using
381
<a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a>, or <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a>.</p>
385
<div class="variablelist"><table border="0">
386
<col align="left" valign="top">
389
<td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td>
390
<td> a pointer to the number of command line arguments.
394
<td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td>
395
<td> a pointer to the array of command line arguments.
399
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
400
<td> <code class="literal">TRUE</code> if initialization succeeded, otherwise <code class="literal">FALSE</code>.
407
<div class="refsect2" lang="en">
408
<a name="id2632653"></a><h3>
409
<a name="gtk-init"></a>gtk_init ()</h3>
410
<a class="indexterm" name="id2632665"></a><pre class="programlisting">void gtk_init (int *argc,
413
Call this function before using any other GTK+ functions in your GUI
414
applications. It will initialize everything needed to operate the
415
toolkit and parses some standard command line options. <em class="parameter"><code>argc</code></em> and
416
<em class="parameter"><code>argv</code></em> are adjusted accordingly so your own code will
417
never see those standard arguments.
420
Note that there are some alternative ways to initialize GTK+:
421
if you are calling <a href="gtk-General.html#gtk-parse-args"><code class="function">gtk_parse_args()</code></a>, <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a>,
422
<a href="gtk-General.html#gtk-init-with-args"><code class="function">gtk_init_with_args()</code></a> or <code class="function">g_option_context_parse()</code> with
423
the option group returned by <a href="gtk-General.html#gtk-get-option-group"><code class="function">gtk_get_option_group()</code></a>, you
424
<span class="emphasis"><em>don't</em></span> have to call <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a>.
428
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
429
<h3 class="title">Note</h3>
431
This function will terminate your program if it was unable to initialize
432
the GUI for some reason. If you want your program to fall back to a
433
textual interface you want to call <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a> instead.
438
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
439
<h3 class="title">Note</h3>
443
<div class="variablelist"><table border="0">
444
<col align="left" valign="top">
447
<td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td>
448
<td> Address of the <em class="parameter"><code>argc</code></em> parameter of your
449
<code class="function">main()</code> function. Changed if any arguments were handled.
453
<td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td>
454
<td> Address of the <em class="parameter"><code>argv</code></em> parameter of <code class="function">main()</code>.
455
Any parameters understood by <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> are stripped before return.
462
<div class="refsect2" lang="en">
463
<a name="id2632898"></a><h3>
464
<a name="gtk-init-check"></a>gtk_init_check ()</h3>
465
<a class="indexterm" name="id2632910"></a><pre class="programlisting">gboolean gtk_init_check (int *argc,
468
This function does the same work as <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> with only
469
a single change: It does not terminate the program if the GUI can't be
470
initialized. Instead it returns <code class="literal">FALSE</code> on failure.
473
This way the application can fall back to some other means of communication
474
with the user - for example a curses or command line interface.</p>
477
<div class="variablelist"><table border="0">
478
<col align="left" valign="top">
481
<td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td>
482
<td> Address of the <em class="parameter"><code>argc</code></em> parameter of your
483
<code class="function">main()</code> function. Changed if any arguments were handled.
487
<td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td>
488
<td> Address of the <em class="parameter"><code>argv</code></em> parameter of <code class="function">main()</code>.
489
Any parameters understood by <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> are stripped before return.
493
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
494
<td> <code class="literal">TRUE</code> if the GUI has been successfully initialized,
495
<code class="literal">FALSE</code> otherwise.
502
<div class="refsect2" lang="en">
503
<a name="id2633086"></a><h3>
504
<a name="gtk-init-with-args"></a>gtk_init_with_args ()</h3>
505
<a class="indexterm" name="id2633102"></a><pre class="programlisting">gboolean gtk_init_with_args (int *argc,
507
char *parameter_string,
508
GOptionEntry *entries,
509
char *translation_domain,
510
GError **error);</pre>
512
This function does the same work as <a href="gtk-General.html#gtk-init-check"><code class="function">gtk_init_check()</code></a>.
513
Additionally, it allows you to add your own commandline options,
514
and it automatically generates nicely formatted
515
<code class="option">--help</code> output. Note that your program will
516
be terminated after writing out the help output.</p>
520
<div class="variablelist"><table border="0">
521
<col align="left" valign="top">
524
<td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td>
525
<td> a pointer to the number of command line arguments.
529
<td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td>
530
<td> a pointer to the array of command line arguments.
534
<td><span class="term"><em class="parameter"><code>parameter_string</code></em> :</span></td>
535
<td> a string which is displayed in
536
the first line of <code class="option">--help</code> output, after
537
<code class="literal"><em class="replaceable"><code>programname</code></em> [OPTION...]</code>
541
<td><span class="term"><em class="parameter"><code>entries</code></em> :</span></td>
543
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
544
><code class="literal">NULL</code></a>-terminated array of <span class="type">GOptionEntry</span>s
545
describing the options of your program
549
<td><span class="term"><em class="parameter"><code>translation_domain</code></em> :</span></td>
550
<td> a translation domain to use for translating
551
the <code class="option">--help</code> output for the options in <em class="parameter"><code>entries</code></em>
552
with <code class="function">gettext()</code>, or <a
553
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
554
><code class="literal">NULL</code></a>
558
<td><span class="term"><em class="parameter"><code>error</code></em> :</span></td>
559
<td> a return location for errors
563
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
564
<td> <code class="literal">TRUE</code> if the GUI has been successfully initialized,
565
<code class="literal">FALSE</code> otherwise.
571
<p class="since">Since 2.6
575
<div class="refsect2" lang="en">
576
<a name="id2633383"></a><h3>
577
<a name="gtk-get-option-group"></a>gtk_get_option_group ()</h3>
578
<a class="indexterm" name="id2633398"></a><pre class="programlisting">GOptionGroup* gtk_get_option_group (gboolean open_default_display);</pre>
580
Returns a <span class="type">GOptionGroup</span> for the commandline arguments recognized
581
by GTK+ and GDK. You should add this group to your <span class="type">GOptionContext</span>
582
with <code class="function">g_option_context_add_group()</code>, if you are using
583
<code class="function">g_option_context_parse()</code> to parse your commandline arguments.</p>
587
<div class="variablelist"><table border="0">
588
<col align="left" valign="top">
591
<td><span class="term"><em class="parameter"><code>open_default_display</code></em> :</span></td>
592
<td> whether to open the default display
593
when parsing the commandline arguments
597
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
598
<td>a <span class="type">GOptionGroup</span> for the commandline arguments recognized
605
<p class="since">Since 2.6
609
<div class="refsect2" lang="en">
610
<a name="id2633519"></a><h3>
611
<a name="gtk-exit"></a>gtk_exit ()</h3>
612
<a class="indexterm" name="id2633534"></a><pre class="programlisting">void gtk_exit (gint error_code);</pre>
613
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
614
<h3 class="title">Warning</h3>
615
<p><code class="literal">gtk_exit</code> is deprecated and should not be used in newly-written code. Use the standard <code class="function">exit()</code> function instead.</p>
618
Terminates the program and returns the given exit code to the caller.
619
This function will shut down the GUI and free all resources allocated
622
<div class="variablelist"><table border="0">
623
<col align="left" valign="top">
625
<td><span class="term"><em class="parameter"><code>error_code</code></em> :</span></td>
626
<td>Return value to pass to the caller. This is dependent on the
627
target system but at least on Unix systems <code class="literal">0</code> means success.
633
<div class="refsect2" lang="en">
634
<a name="id2633620"></a><h3>
635
<a name="gtk-events-pending"></a>gtk_events_pending ()</h3>
636
<a class="indexterm" name="id2633633"></a><pre class="programlisting">gboolean gtk_events_pending (void);</pre>
638
Checks if any events are pending. This can be used to update the GUI
639
and invoke timeouts etc. while doing some time intensive computation.
641
<div class="example">
642
<a name="id2633656"></a><p class="title"><b>Example 2. Updating the GUI during a long computation.</b></p>
643
<div class="example-contents"><pre class="programlisting">
644
/* computation going on */
646
while (gtk_events_pending ())
647
gtk_main_iteration ();
649
/* computation continued */
652
<br class="example-break"><div class="variablelist"><table border="0">
653
<col align="left" valign="top">
655
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
657
<code class="literal">TRUE</code> if any events are pending, <code class="literal">FALSE</code> otherwise.
665
<div class="refsect2" lang="en">
666
<a name="id2633711"></a><h3>
667
<a name="gtk-main"></a>gtk_main ()</h3>
668
<a class="indexterm" name="id2633723"></a><pre class="programlisting">void gtk_main (void);</pre>
670
Runs the main loop until <a href="gtk-General.html#gtk-main-quit"><code class="function">gtk_main_quit()</code></a> is called. You can nest calls to
671
<a href="gtk-General.html#gtk-main"><code class="function">gtk_main()</code></a>. In that case <a href="gtk-General.html#gtk-main-quit"><code class="function">gtk_main_quit()</code></a> will make the innermost invocation
672
of the main loop return.
676
<div class="refsect2" lang="en">
677
<a name="id2633778"></a><h3>
678
<a name="gtk-main-level"></a>gtk_main_level ()</h3>
679
<a class="indexterm" name="id2633790"></a><pre class="programlisting">guint gtk_main_level (void);</pre>
681
Asks for the current nesting level of the main loop. This can be useful
682
when calling <a href="gtk-General.html#gtk-quit-add"><code class="function">gtk_quit_add()</code></a>.
684
<div class="variablelist"><table border="0">
685
<col align="left" valign="top">
687
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
688
<td>the nesting level of the current invocation of the main loop.
696
<div class="refsect2" lang="en">
697
<a name="id2633839"></a><h3>
698
<a name="gtk-main-quit"></a>gtk_main_quit ()</h3>
699
<a class="indexterm" name="id2633852"></a><pre class="programlisting">void gtk_main_quit (void);</pre>
701
Makes the innermost invocation of the main loop return when it regains
706
<div class="refsect2" lang="en">
707
<a name="id2633874"></a><h3>
708
<a name="gtk-main-iteration"></a>gtk_main_iteration ()</h3>
709
<a class="indexterm" name="id2633887"></a><pre class="programlisting">gboolean gtk_main_iteration (void);</pre>
711
Runs a single iteration of the mainloop. If no events are waiting to be
712
processed GTK+ will block until the next event is noticed. If you don't
713
want to block look at <a href="gtk-General.html#gtk-main-iteration-do"><code class="function">gtk_main_iteration_do()</code></a> or check if any events are
714
pending with <a href="gtk-General.html#gtk-events-pending"><code class="function">gtk_events_pending()</code></a> first.
716
<div class="variablelist"><table border="0">
717
<col align="left" valign="top">
719
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
721
<code class="literal">TRUE</code> if <a href="gtk-General.html#gtk-main-quit"><code class="function">gtk_main_quit()</code></a> has been called for the innermost mainloop.
729
<div class="refsect2" lang="en">
730
<a name="id2633969"></a><h3>
731
<a name="gtk-main-iteration-do"></a>gtk_main_iteration_do ()</h3>
732
<a class="indexterm" name="id2633981"></a><pre class="programlisting">gboolean gtk_main_iteration_do (gboolean blocking);</pre>
734
Runs a single iteration of the mainloop. If no events are available either
735
return or block dependent on the value of <em class="parameter"><code>blocking</code></em>.
737
<div class="variablelist"><table border="0">
738
<col align="left" valign="top">
741
<td><span class="term"><em class="parameter"><code>blocking</code></em> :</span></td>
743
<code class="literal">TRUE</code> if you want GTK+ to block if no events are pending.
747
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
749
<code class="literal">TRUE</code> if <a href="gtk-General.html#gtk-main-quit"><code class="function">gtk_main_quit()</code></a> has been called for the innermost mainloop.
758
<div class="refsect2" lang="en">
759
<a name="id2634076"></a><h3>
760
<a name="gtk-main-do-event"></a>gtk_main_do_event ()</h3>
761
<a class="indexterm" name="id2634089"></a><pre class="programlisting">void gtk_main_do_event (<a
762
href="../gdk/gdk-Event-Structures.html#GdkEvent"
763
>GdkEvent</a> *event);</pre>
765
Processes a single GDK event. This is public only to allow filtering of events
766
between GDK and GTK+. You will not usually need to call this function directly.
769
While you should not call this function directly, you might want to know
770
how exactly events are handled. So here is what this function does with
773
<div class="orderedlist"><ol type="1">
775
Compress enter/leave notify events. If the event passed build an
776
enter/leave pair together with the next event (peeked from GDK)
777
both events are thrown away. This is to avoid a backlog of (de-)highlighting
778
widgets crossed by the pointer.
781
Find the widget which got the event. If the widget can't be determined
782
the event is thrown away unless it belongs to a INCR transaction. In that
783
case it is passed to <code class="function">gtk_selection_incr_event()</code>.
786
Then the event is passed on a stack so you can query the currently handled
787
event with <a href="gtk-General.html#gtk-get-current-event"><code class="function">gtk_get_current_event()</code></a>.
791
The event is sent to a widget. If a grab is active all events for
792
widgets that are not in the contained in the grab widget are sent to the
793
latter with a few exceptions:
796
<div class="itemizedlist"><ul type="disc">
798
Deletion and destruction events are still sent to the event widget for
802
Events which directly relate to the visual representation of the event
806
Leave events are delivered to the event widget if there was an enter
807
event delivered to it before without the paired leave event.
810
Drag events are not redirected because it is unclear what the semantics
816
Another point of interest might be that all key events are first passed
817
through the key snooper functions if there are any. Read the description
818
of <a href="gtk-General.html#gtk-key-snooper-install"><code class="function">gtk_key_snooper_install()</code></a> if you need this feature.
822
After finishing the delivery the event is popped from the event stack.
825
<div class="variablelist"><table border="0">
826
<col align="left" valign="top">
828
<td><span class="term"><em class="parameter"><code>event</code></em> :</span></td>
829
<td>An event to process (normally) passed by GDK.
837
<div class="refsect2" lang="en">
838
<a name="id2634252"></a><h3>
839
<a name="GtkModuleInitFunc"></a>GtkModuleInitFunc ()</h3>
840
<a class="indexterm" name="id2634266"></a><pre class="programlisting">void (*GtkModuleInitFunc) (gint *argc,
841
gchar ***argv);</pre>
843
Each GTK+ module must have a function <code class="function">gtk_module_init()</code> with this prototype.
844
This function is called after loading the module with the <em class="parameter"><code>argc</code></em> and <em class="parameter"><code>argv</code></em>
845
cleaned from any arguments that GTK+ handles itself.
847
<div class="variablelist"><table border="0">
848
<col align="left" valign="top">
851
<td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td>
852
<td>Pointer to the number of arguments remaining after <a href="gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a>.
856
<td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td>
857
<td>Points to the argument vector.
866
<div class="refsect2" lang="en">
867
<a name="id2634371"></a><h3>
868
<a name="GtkModuleDisplayInitFunc"></a>GtkModuleDisplayInitFunc ()</h3>
869
<a class="indexterm" name="id2634386"></a><pre class="programlisting">void (*GtkModuleDisplayInitFunc) (<a
870
href="../gdk/GdkDisplay.html"
871
>GdkDisplay</a> *display);</pre>
875
<div class="variablelist"><table border="0">
876
<col align="left" valign="top">
878
<td><span class="term"><em class="parameter"><code>display</code></em> :</span></td>
883
<p class="since">Since 2.2
889
<div class="refsect2" lang="en">
890
<a name="id2634439"></a><h3>
891
<a name="gtk-true"></a>gtk_true ()</h3>
892
<a class="indexterm" name="id2634451"></a><pre class="programlisting">gboolean gtk_true (void);</pre>
894
All this function does it to return <code class="literal">TRUE</code>. This can be useful for example
895
if you want to inhibit the deletion of a window. Of course you should
896
not do this as the user expects a reaction from clicking the close
897
icon of the window...
899
<div class="example">
900
<a name="id2634487"></a><p class="title"><b>Example 3. A persistent window</b></p>
901
<div class="example-contents"><pre class="programlisting">
902
##include <gtk/gtk.h>
905
main (int argc, char **argv)
907
GtkWidget *win, *but;
909
gtk_init( &argc, &argv );
911
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
912
g_signal_connect (win, "delete-event",
913
G_CALLBACK (gtk_true), NULL);
914
g_signal_connect (win, "destroy",
915
G_CALLBACK (gtk_main_quit), NULL);
917
but = gtk_button_new_with_label ("Close yourself. I mean it!");
918
g_signal_connect_swapped (but, "clicked",
919
G_CALLBACK (gtk_object_destroy), win);
920
gtk_container_add (GTK_CONTAINER (win), but);
922
gtk_widget_show_all (win);
928
<br class="example-break"><div class="variablelist"><table border="0">
929
<col align="left" valign="top">
931
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
933
<code class="literal">TRUE</code>
941
<div class="refsect2" lang="en">
942
<a name="id2634548"></a><h3>
943
<a name="gtk-false"></a>gtk_false ()</h3>
944
<a class="indexterm" name="id2634560"></a><pre class="programlisting">gboolean gtk_false (void);</pre>
946
Analogical to <a href="gtk-General.html#gtk-true"><code class="function">gtk_true()</code></a> this function does nothing
947
but always returns <code class="literal">FALSE</code>.
949
<div class="variablelist"><table border="0">
950
<col align="left" valign="top">
952
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
954
<code class="literal">FALSE</code>
962
<div class="refsect2" lang="en">
963
<a name="id2634626"></a><h3>
964
<a name="gtk-grab-add"></a>gtk_grab_add ()</h3>
965
<a class="indexterm" name="id2634639"></a><pre class="programlisting">void gtk_grab_add (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);</pre>
967
Makes <em class="parameter"><code>widget</code></em> the current grabbed widget. This means that interaction with
968
other widgets in the same application is blocked and mouse as well as
969
keyboard events are delivered to this widget.
971
<div class="variablelist"><table border="0">
972
<col align="left" valign="top">
974
<td><span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
975
<td>The widget that grabs keyboard and pointer events.
983
<div class="refsect2" lang="en">
984
<a name="id2634695"></a><h3>
985
<a name="gtk-grab-get-current"></a>gtk_grab_get_current ()</h3>
986
<a class="indexterm" name="id2634708"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_grab_get_current (void);</pre>
988
Queries the current grab of the default window group.
990
<div class="variablelist"><table border="0">
991
<col align="left" valign="top">
993
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
994
<td>The widget which currently has the grab or <a
995
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
996
><code class="literal">NULL</code></a> if no grab is active.
1004
<div class="refsect2" lang="en">
1005
<a name="id2634756"></a><h3>
1006
<a name="gtk-grab-remove"></a>gtk_grab_remove ()</h3>
1007
<a class="indexterm" name="id2634769"></a><pre class="programlisting">void gtk_grab_remove (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);</pre>
1009
Removes the grab from the given widget. You have to pair calls to <a href="gtk-General.html#gtk-grab-add"><code class="function">gtk_grab_add()</code></a>
1010
and <a href="gtk-General.html#gtk-grab-remove"><code class="function">gtk_grab_remove()</code></a>.
1012
<div class="variablelist"><table border="0">
1013
<col align="left" valign="top">
1015
<td><span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
1016
<td>The widget which gives up the grab.
1024
<div class="refsect2" lang="en">
1025
<a name="id2634838"></a><h3>
1026
<a name="gtk-init-add"></a>gtk_init_add ()</h3>
1027
<a class="indexterm" name="id2634850"></a><pre class="programlisting">void gtk_init_add (<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1028
gpointer data);</pre>
1030
Registers a function to be called when the mainloop is started.
1032
<div class="variablelist"><table border="0">
1033
<col align="left" valign="top">
1036
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1037
<td>Function to invoke when <a href="gtk-General.html#gtk-main"><code class="function">gtk_main()</code></a> is called next.
1041
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1042
<td>Data to pass to that function.
1051
<div class="refsect2" lang="en">
1052
<a name="id2634931"></a><h3>
1053
<a name="gtk-quit-add-destroy"></a>gtk_quit_add_destroy ()</h3>
1054
<a class="indexterm" name="id2634943"></a><pre class="programlisting">void gtk_quit_add_destroy (guint main_level,
1055
<a href="GtkObject.html" title="GtkObject">GtkObject</a> *object);</pre>
1057
Trigger destruction of <em class="parameter"><code>object</code></em> in case the mainloop at level <em class="parameter"><code>main_level</code></em>
1060
<div class="variablelist"><table border="0">
1061
<col align="left" valign="top">
1064
<td><span class="term"><em class="parameter"><code>main_level</code></em> :</span></td>
1065
<td>Level of the mainloop which shall trigger the destruction.
1069
<td><span class="term"><em class="parameter"><code>object</code></em> :</span></td>
1070
<td>Object to be destroyed.
1079
<div class="refsect2" lang="en">
1080
<a name="id2635026"></a><h3>
1081
<a name="gtk-quit-add"></a>gtk_quit_add ()</h3>
1082
<a class="indexterm" name="id2635038"></a><pre class="programlisting">guint gtk_quit_add (guint main_level,
1083
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1084
gpointer data);</pre>
1086
Registers a function to be called when an instance of the mainloop is left.
1088
<div class="variablelist"><table border="0">
1089
<col align="left" valign="top">
1092
<td><span class="term"><em class="parameter"><code>main_level</code></em> :</span></td>
1093
<td>Level at which termination the function shall be called. You
1094
can pass 0 here to have the function run at the termination of the current
1099
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1100
<td>The function to call. This should return 0 to be removed from the
1101
list of quit handlers. Otherwise the function might be called again.
1105
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1106
<td>Pointer to pass when calling <em class="parameter"><code>function</code></em>.
1110
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1111
<td>A handle for this quit handler (you need this for <a href="gtk-General.html#gtk-quit-remove"><code class="function">gtk_quit_remove()</code></a>)
1112
or 0 if you passed a <a
1113
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1114
><code class="literal">NULL</code></a> pointer in <em class="parameter"><code>function</code></em>.
1123
<div class="refsect2" lang="en">
1124
<a name="id2635178"></a><h3>
1125
<a name="gtk-quit-add-full"></a>gtk_quit_add_full ()</h3>
1126
<a class="indexterm" name="id2635192"></a><pre class="programlisting">guint gtk_quit_add_full (guint main_level,
1127
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1128
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
1130
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre>
1132
Registers a function to be called when an instance of the mainloop is left.
1133
In comparison to <a href="gtk-General.html#gtk-quit-add"><code class="function">gtk_quit_add()</code></a> this function adds the possibility to
1134
pass a marshaller and a function to be called when the quit handler is freed.
1137
The former can be used to run interpreted code instead of a compiled function
1138
while the latter can be used to free the information stored in <em class="parameter"><code>data</code></em> (while
1139
you can do this in <em class="parameter"><code>function</code></em> as well)... So this function will mostly be
1140
used by GTK+ wrappers for languages other than C.
1142
<div class="variablelist"><table border="0">
1143
<col align="left" valign="top">
1146
<td><span class="term"><em class="parameter"><code>main_level</code></em> :</span></td>
1147
<td>Level at which termination the function shall be called. You
1148
can pass 0 here to have the function run at the termination of the current
1153
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1154
<td>The function to call. This should return 0 to be removed from the
1155
list of quit handlers. Otherwise the function might be called again.
1159
<td><span class="term"><em class="parameter"><code>marshal</code></em> :</span></td>
1160
<td>The marshaller to be used. If this is non-<a
1161
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1162
><code class="literal">NULL</code></a>, <em class="parameter"><code>function</code></em> is
1167
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1168
<td>Pointer to pass when calling <em class="parameter"><code>function</code></em>.
1172
<td><span class="term"><em class="parameter"><code>destroy</code></em> :</span></td>
1173
<td>Function to call to destruct <em class="parameter"><code>data</code></em>. Gets <em class="parameter"><code>data</code></em> as argument.
1177
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1178
<td>A handle for this quit handler (you need this for <a href="gtk-General.html#gtk-quit-remove"><code class="function">gtk_quit_remove()</code></a>)
1179
or 0 if you passed a <a
1180
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1181
><code class="literal">NULL</code></a> pointer in <em class="parameter"><code>function</code></em>.
1190
<div class="refsect2" lang="en">
1191
<a name="id2635437"></a><h3>
1192
<a name="gtk-quit-remove"></a>gtk_quit_remove ()</h3>
1193
<a class="indexterm" name="id2635450"></a><pre class="programlisting">void gtk_quit_remove (guint quit_handler_id);</pre>
1195
Removes a quit handler by its identifier.
1197
<div class="variablelist"><table border="0">
1198
<col align="left" valign="top">
1200
<td><span class="term"><em class="parameter"><code>quit_handler_id</code></em> :</span></td>
1201
<td>Identifier for the handler returned when installing it.
1209
<div class="refsect2" lang="en">
1210
<a name="id2635498"></a><h3>
1211
<a name="gtk-quit-remove-by-data"></a>gtk_quit_remove_by_data ()</h3>
1212
<a class="indexterm" name="id2635511"></a><pre class="programlisting">void gtk_quit_remove_by_data (gpointer data);</pre>
1214
Removes a quit handler identified by its <em class="parameter"><code>data</code></em> field.
1216
<div class="variablelist"><table border="0">
1217
<col align="left" valign="top">
1219
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1220
<td>The pointer passed as <em class="parameter"><code>data</code></em> to <a href="gtk-General.html#gtk-quit-add"><code class="function">gtk_quit_add()</code></a> or <a href="gtk-General.html#gtk-quit-add-full"><code class="function">gtk_quit_add_full()</code></a>.
1228
<div class="refsect2" lang="en">
1229
<a name="id2635592"></a><h3>
1230
<a name="gtk-timeout-add-full"></a>gtk_timeout_add_full ()</h3>
1231
<a class="indexterm" name="id2635608"></a><pre class="programlisting">guint gtk_timeout_add_full (guint32 interval,
1232
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1233
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
1235
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre>
1236
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1237
<h3 class="title">Warning</h3>
1238
<p><code class="literal">gtk_timeout_add_full</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_timeout_add_full()</code> instead.</p>
1241
Registers a function to be called periodically. The function will be called
1242
repeatedly after <em class="parameter"><code>interval</code></em> milliseconds until it returns <code class="literal">FALSE</code> at which
1243
point the timeout is destroyed and will not be called again.
1245
<div class="variablelist"><table border="0">
1246
<col align="left" valign="top">
1249
<td><span class="term"><em class="parameter"><code>interval</code></em> :</span></td>
1250
<td>The time between calls to the function, in milliseconds
1251
(1/1000ths of a second.)
1255
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1256
<td>The function to call periodically.
1260
<td><span class="term"><em class="parameter"><code>marshal</code></em> :</span></td>
1261
<td>The marshaller to use instead of the function (if non-<a
1262
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1263
><code class="literal">NULL</code></a>).
1267
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1268
<td>The data to pass to the function.
1272
<td><span class="term"><em class="parameter"><code>destroy</code></em> :</span></td>
1273
<td>Function to call when the timeout is destroyed or <a
1274
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1275
><code class="literal">NULL</code></a>.
1279
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1280
<td>A unique id for the event source.
1287
<div class="refsect2" lang="en">
1288
<a name="id2635821"></a><h3>
1289
<a name="gtk-timeout-add"></a>gtk_timeout_add ()</h3>
1290
<a class="indexterm" name="id2635836"></a><pre class="programlisting">guint gtk_timeout_add (guint32 interval,
1291
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1292
gpointer data);</pre>
1293
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1294
<h3 class="title">Warning</h3>
1295
<p><code class="literal">gtk_timeout_add</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_timeout_add()</code> instead.</p>
1298
Registers a function to be called periodically. The function will be called
1299
repeatedly after <em class="parameter"><code>interval</code></em> milliseconds until it returns <code class="literal">FALSE</code> at which
1300
point the timeout is destroyed and will not be called again.
1302
<div class="variablelist"><table border="0">
1303
<col align="left" valign="top">
1306
<td><span class="term"><em class="parameter"><code>interval</code></em> :</span></td>
1307
<td>The time between calls to the function, in milliseconds
1308
(1/1000ths of a second.)
1312
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1313
<td>The function to call periodically.
1317
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1318
<td>The data to pass to the function.
1322
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1323
<td>A unique id for the event source.
1330
<div class="refsect2" lang="en">
1331
<a name="id2635983"></a><h3>
1332
<a name="gtk-timeout-remove"></a>gtk_timeout_remove ()</h3>
1333
<a class="indexterm" name="id2635998"></a><pre class="programlisting">void gtk_timeout_remove (guint timeout_handler_id);</pre>
1334
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1335
<h3 class="title">Warning</h3>
1336
<p><code class="literal">gtk_timeout_remove</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_source_remove()</code> instead.</p>
1339
Removes the given timeout destroying all information about it.
1341
<div class="variablelist"><table border="0">
1342
<col align="left" valign="top">
1344
<td><span class="term"><em class="parameter"><code>timeout_handler_id</code></em> :</span></td>
1345
<td>The identifier returned when installing the timeout.
1351
<div class="refsect2" lang="en">
1352
<a name="id2636071"></a><h3>
1353
<a name="gtk-idle-add"></a>gtk_idle_add ()</h3>
1354
<a class="indexterm" name="id2636087"></a><pre class="programlisting">guint gtk_idle_add (<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1355
gpointer data);</pre>
1356
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1357
<h3 class="title">Warning</h3>
1358
<p><code class="literal">gtk_idle_add</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_idle_add()</code> instead.</p>
1361
Causes the mainloop to call the given function whenever no events with
1362
higher priority are to be processed. The default priority is
1363
<a href="gtk-General.html#GTK-PRIORITY-DEFAULT:CAPS"><code class="literal">GTK_PRIORITY_DEFAULT</code></a>, which is rather low.
1365
<div class="variablelist"><table border="0">
1366
<col align="left" valign="top">
1369
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1370
<td>The function to call.
1374
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1375
<td>The information to pass to the function.
1379
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1380
<td>a unique handle for this registration.
1387
<div class="refsect2" lang="en">
1388
<a name="id2636205"></a><h3>
1389
<a name="gtk-idle-add-priority"></a>gtk_idle_add_priority ()</h3>
1390
<a class="indexterm" name="id2636221"></a><pre class="programlisting">guint gtk_idle_add_priority (gint priority,
1391
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1392
gpointer data);</pre>
1393
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1394
<h3 class="title">Warning</h3>
1395
<p><code class="literal">gtk_idle_add_priority</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_idle_add_full()</code> instead.</p>
1398
Like <a href="gtk-General.html#gtk-idle-add"><code class="function">gtk_idle_add()</code></a> this function allows you to have a function called
1399
when the event loop is idle. The difference is that you can give a
1400
priority different from <a href="gtk-General.html#GTK-PRIORITY-DEFAULT:CAPS"><code class="literal">GTK_PRIORITY_DEFAULT</code></a> to the idle function.
1402
<div class="variablelist"><table border="0">
1403
<col align="left" valign="top">
1406
<td><span class="term"><em class="parameter"><code>priority</code></em> :</span></td>
1407
<td>The priority which should not be above <code class="literal">G_PRIORITY_HIGH_IDLE</code>.
1408
Note that you will interfere with GTK+ if you use a priority above
1409
<a href="gtk-General.html#GTK-PRIORITY-RESIZE:CAPS"><code class="literal">GTK_PRIORITY_RESIZE</code></a>.
1413
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1414
<td>The function to call.
1418
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1419
<td>Data to pass to that function.
1423
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1424
<td>A unique id for the event source.
1431
<div class="refsect2" lang="en">
1432
<a name="id2636396"></a><h3>
1433
<a name="gtk-idle-add-full"></a>gtk_idle_add_full ()</h3>
1434
<a class="indexterm" name="id2636412"></a><pre class="programlisting">guint gtk_idle_add_full (gint priority,
1435
<a href="gtk-Types.html#GtkFunction">GtkFunction</a> function,
1436
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
1438
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre>
1439
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1440
<h3 class="title">Warning</h3>
1441
<p><code class="literal">gtk_idle_add_full</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_idle_add_full()</code> instead.</p>
1444
Like <a href="gtk-General.html#gtk-idle-add"><code class="function">gtk_idle_add()</code></a> this function allows you to have a function called
1445
when the event loop is idle. The difference is that you can give a
1446
priority different from <a href="gtk-General.html#GTK-PRIORITY-DEFAULT:CAPS"><code class="literal">GTK_PRIORITY_DEFAULT</code></a> to the idle function.
1448
<div class="variablelist"><table border="0">
1449
<col align="left" valign="top">
1452
<td><span class="term"><em class="parameter"><code>priority</code></em> :</span></td>
1453
<td>The priority which should not be above <code class="literal">G_PRIORITY_HIGH_IDLE</code>.
1454
Note that you will interfere with GTK+ if you use a priority above
1455
<a href="gtk-General.html#GTK-PRIORITY-RESIZE:CAPS"><code class="literal">GTK_PRIORITY_RESIZE</code></a>.
1459
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1460
<td>The function to call.
1464
<td><span class="term"><em class="parameter"><code>marshal</code></em> :</span></td>
1465
<td>The marshaller to use instead of the function (if non-<a
1466
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1467
><code class="literal">NULL</code></a>).
1471
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1472
<td>Data to pass to that function.
1476
<td><span class="term"><em class="parameter"><code>destroy</code></em> :</span></td>
1477
<td>Function to call when the timeout is destroyed or <a
1478
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1479
><code class="literal">NULL</code></a>.
1483
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1484
<td>A unique id for the event source.
1491
<div class="refsect2" lang="en">
1492
<a name="id2636650"></a><h3>
1493
<a name="gtk-idle-remove"></a>gtk_idle_remove ()</h3>
1494
<a class="indexterm" name="id2636666"></a><pre class="programlisting">void gtk_idle_remove (guint idle_handler_id);</pre>
1495
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1496
<h3 class="title">Warning</h3>
1497
<p><code class="literal">gtk_idle_remove</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_source_remove()</code> instead.</p>
1500
Removes the idle function with the given id.
1502
<div class="variablelist"><table border="0">
1503
<col align="left" valign="top">
1505
<td><span class="term"><em class="parameter"><code>idle_handler_id</code></em> :</span></td>
1506
<td>Identifies the idle function to remove.
1512
<div class="refsect2" lang="en">
1513
<a name="id2636738"></a><h3>
1514
<a name="gtk-idle-remove-by-data"></a>gtk_idle_remove_by_data ()</h3>
1515
<a class="indexterm" name="id2636754"></a><pre class="programlisting">void gtk_idle_remove_by_data (gpointer data);</pre>
1516
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1517
<h3 class="title">Warning</h3>
1518
<p><code class="literal">gtk_idle_remove_by_data</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_idle_remove_by_data()</code> instead.</p>
1521
Removes the idle function identified by the user data.
1523
<div class="variablelist"><table border="0">
1524
<col align="left" valign="top">
1526
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1527
<td>remove the idle function which was registered with this user data.
1533
<div class="refsect2" lang="en">
1534
<a name="id2636828"></a><h3>
1535
<a name="gtk-input-add-full"></a>gtk_input_add_full ()</h3>
1536
<a class="indexterm" name="id2636844"></a><pre class="programlisting">guint gtk_input_add_full (gint source,
1538
href="../gdk/gdk-Input.html#GdkInputCondition"
1539
>GdkInputCondition</a> condition,
1541
href="../gdk/gdk-Input.html#GdkInputFunction"
1542
>GdkInputFunction</a> function,
1543
<a href="gtk-Types.html#GtkCallbackMarshal">GtkCallbackMarshal</a> marshal,
1545
<a href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre>
1546
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1547
<h3 class="title">Warning</h3>
1548
<p><code class="literal">gtk_input_add_full</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_io_add_watch_full()</code> instead.</p>
1551
Registers a function to be called when a condition becomes true
1552
on a file descriptor.
1554
<div class="variablelist"><table border="0">
1555
<col align="left" valign="top">
1558
<td><span class="term"><em class="parameter"><code>source</code></em> :</span></td>
1559
<td>a file descriptor.
1563
<td><span class="term"><em class="parameter"><code>condition</code></em> :</span></td>
1568
<td><span class="term"><em class="parameter"><code>function</code></em> :</span></td>
1569
<td>The function to call.
1573
<td><span class="term"><em class="parameter"><code>marshal</code></em> :</span></td>
1574
<td>The marshaller to use instead of the function (if non-<a
1575
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1576
><code class="literal">NULL</code></a>).
1580
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
1581
<td>callback data passed to <em class="parameter"><code>function</code></em>.
1585
<td><span class="term"><em class="parameter"><code>destroy</code></em> :</span></td>
1586
<td>callback function to call with <em class="parameter"><code>data</code></em> when the input
1587
handler is removed, or <a
1588
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1589
><code class="literal">NULL</code></a>.
1593
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1594
<td>A unique id for the event source; to be used with <a href="gtk-General.html#gtk-input-remove"><code class="function">gtk_input_remove()</code></a>.
1601
<div class="refsect2" lang="en">
1602
<a name="id2637082"></a><h3>
1603
<a name="gtk-input-remove"></a>gtk_input_remove ()</h3>
1604
<a class="indexterm" name="id2637097"></a><pre class="programlisting">void gtk_input_remove (guint input_handler_id);</pre>
1605
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1606
<h3 class="title">Warning</h3>
1607
<p><code class="literal">gtk_input_remove</code> has been deprecated since version 2.4 and should not be used in newly-written code. Use <code class="function">g_source_remove()</code> instead.</p>
1610
Removes the function with the given id.
1612
<div class="variablelist"><table border="0">
1613
<col align="left" valign="top">
1615
<td><span class="term"><em class="parameter"><code>input_handler_id</code></em> :</span></td>
1616
<td>Identifies the function to remove.
1622
<div class="refsect2" lang="en">
1623
<a name="id2637169"></a><h3>
1624
<a name="GTK-PRIORITY-REDRAW:CAPS"></a>GTK_PRIORITY_REDRAW</h3>
1625
<a class="indexterm" name="id2637186"></a><pre class="programlisting">#define GTK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
1627
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1628
<h3 class="title">Warning</h3>
1629
<p><code class="literal">GTK_PRIORITY_REDRAW</code> has been deprecated since version 2.4 and should not be used in newly-written code. This macro is deprecated. You should use <a
1630
href="../gdk/gdk-Events.html#GDK-PRIORITY-REDRAW:CAPS"
1631
><code class="literal">GDK_PRIORITY_REDRAW</code></a> instead.</p>
1634
Use this priority for redrawing related stuff. It is used internally by
1635
GTK+ to do pending redraws. This priority is lower than <a href="gtk-General.html#GTK-PRIORITY-RESIZE:CAPS"><code class="literal">GTK_PRIORITY_RESIZE</code></a>
1636
to avoid redrawing a widget just before resizing (and therefore redrawing
1641
<div class="refsect2" lang="en">
1642
<a name="id2637242"></a><h3>
1643
<a name="GTK-PRIORITY-RESIZE:CAPS"></a>GTK_PRIORITY_RESIZE</h3>
1644
<a class="indexterm" name="id2637255"></a><pre class="programlisting">#define GTK_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 10)
1647
Use this priority for resizing related stuff. It is used internally by
1648
GTK+ to compute the sizes of widgets. This priority is higher than
1649
<a href="gtk-General.html#GTK-PRIORITY-REDRAW:CAPS"><code class="literal">GTK_PRIORITY_REDRAW</code></a> to avoid resizing a widget which was just redrawn.
1653
<div class="refsect2" lang="en">
1654
<a name="id2637285"></a><h3>
1655
<a name="GTK-PRIORITY-HIGH:CAPS"></a>GTK_PRIORITY_HIGH</h3>
1656
<a class="indexterm" name="id2637301"></a><pre class="programlisting">#define GTK_PRIORITY_HIGH G_PRIORITY_HIGH
1658
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1659
<h3 class="title">Warning</h3>
1660
<p><code class="literal">GTK_PRIORITY_HIGH</code> has been deprecated since version 2.4 and should not be used in newly-written code. This macro is deprecated. You should use <code class="literal">G_PRIORITY_HIGH</code> instead.</p>
1663
Use this for high priority timeouts. This priority is never used inside
1664
GTK+ so everything running at this priority will be running before anything
1669
<div class="refsect2" lang="en">
1670
<a name="id2637345"></a><h3>
1671
<a name="GTK-PRIORITY-INTERNAL:CAPS"></a>GTK_PRIORITY_INTERNAL</h3>
1672
<a class="indexterm" name="id2637360"></a><pre class="programlisting">#define GTK_PRIORITY_INTERNAL GTK_PRIORITY_REDRAW
1674
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1675
<h3 class="title">Warning</h3>
1676
<p><code class="literal">GTK_PRIORITY_INTERNAL</code> is deprecated and should not be used in newly-written code.</p>
1679
This priority is for GTK+ internal stuff. Don't use it in your applications.
1683
<div class="refsect2" lang="en">
1684
<a name="id2637390"></a><h3>
1685
<a name="GTK-PRIORITY-DEFAULT:CAPS"></a>GTK_PRIORITY_DEFAULT</h3>
1686
<a class="indexterm" name="id2637407"></a><pre class="programlisting">#define GTK_PRIORITY_DEFAULT G_PRIORITY_DEFAULT_IDLE
1688
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1689
<h3 class="title">Warning</h3>
1690
<p><code class="literal">GTK_PRIORITY_DEFAULT</code> has been deprecated since version 2.4 and should not be used in newly-written code. This macro is deprecated. You should use <code class="literal">G_PRIORITY_DEFAULT_IDLE</code> instead.</p>
1693
Default priority for idle functions.
1697
<div class="refsect2" lang="en">
1698
<a name="id2637450"></a><h3>
1699
<a name="GTK-PRIORITY-LOW:CAPS"></a>GTK_PRIORITY_LOW</h3>
1700
<a class="indexterm" name="id2637467"></a><pre class="programlisting">#define GTK_PRIORITY_LOW G_PRIORITY_LOW
1702
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1703
<h3 class="title">Warning</h3>
1704
<p><code class="literal">GTK_PRIORITY_LOW</code> has been deprecated since version 2.4 and should not be used in newly-written code. This macro is deprecated. You should use <code class="literal">G_PRIORITY_LOW</code> instead.</p>
1707
Priority for very unimportant background tasks.
1711
<div class="refsect2" lang="en">
1712
<a name="id2637508"></a><h3>
1713
<a name="gtk-key-snooper-install"></a>gtk_key_snooper_install ()</h3>
1714
<a class="indexterm" name="id2637521"></a><pre class="programlisting">guint gtk_key_snooper_install (<a href="gtk-General.html#GtkKeySnoopFunc">GtkKeySnoopFunc</a> snooper,
1715
gpointer func_data);</pre>
1717
Installs a key snooper function, which will get called on all key events
1718
before delivering them normally.
1720
<div class="variablelist"><table border="0">
1721
<col align="left" valign="top">
1724
<td><span class="term"><em class="parameter"><code>snooper</code></em> :</span></td>
1725
<td>a <a href="gtk-General.html#GtkKeySnoopFunc"><span class="type">GtkKeySnoopFunc</span></a>.
1729
<td><span class="term"><em class="parameter"><code>func_data</code></em> :</span></td>
1730
<td>data to pass to <em class="parameter"><code>snooper</code></em>.
1734
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1735
<td>a unique id for this key snooper for use with <a href="gtk-General.html#gtk-key-snooper-remove"><code class="function">gtk_key_snooper_remove()</code></a>.
1744
<div class="refsect2" lang="en">
1745
<a name="id2637628"></a><h3>
1746
<a name="GtkKeySnoopFunc"></a>GtkKeySnoopFunc ()</h3>
1747
<a class="indexterm" name="id2637640"></a><pre class="programlisting">gint (*GtkKeySnoopFunc) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *grab_widget,
1749
href="../gdk/gdk-Event-Structures.html#GdkEventKey"
1750
>GdkEventKey</a> *event,
1751
gpointer func_data);</pre>
1753
Key snooper functions are called before normal event delivery.
1754
They can be used to implement custom key event handling.
1756
<div class="variablelist"><table border="0">
1757
<col align="left" valign="top">
1760
<td><span class="term"><em class="parameter"><code>grab_widget</code></em> :</span></td>
1761
<td>the widget to which the event will be delivered.
1765
<td><span class="term"><em class="parameter"><code>event</code></em> :</span></td>
1770
<td><span class="term"><em class="parameter"><code>func_data</code></em> :</span></td>
1771
<td>the <em class="parameter"><code>func_data</code></em> supplied to <a href="gtk-General.html#gtk-key-snooper-install"><code class="function">gtk_key_snooper_install()</code></a>.
1775
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1777
<code class="literal">TRUE</code> to stop further processing of <em class="parameter"><code>event</code></em>, <code class="literal">FALSE</code> to continue.
1786
<div class="refsect2" lang="en">
1787
<a name="id2637785"></a><h3>
1788
<a name="gtk-key-snooper-remove"></a>gtk_key_snooper_remove ()</h3>
1789
<a class="indexterm" name="id2637798"></a><pre class="programlisting">void gtk_key_snooper_remove (guint snooper_handler_id);</pre>
1791
Removes the key snooper function with the given id.
1793
<div class="variablelist"><table border="0">
1794
<col align="left" valign="top">
1796
<td><span class="term"><em class="parameter"><code>snooper_handler_id</code></em> :</span></td>
1797
<td>Identifies the key snooper to remove.
1805
<div class="refsect2" lang="en">
1806
<a name="id2637846"></a><h3>
1807
<a name="gtk-get-current-event"></a>gtk_get_current_event ()</h3>
1808
<a class="indexterm" name="id2637860"></a><pre class="programlisting"><a
1809
href="../gdk/gdk-Event-Structures.html#GdkEvent"
1810
>GdkEvent</a>* gtk_get_current_event (void);</pre>
1812
Obtains a copy of the event currently being processed by GTK+. For
1813
example, if you get a "clicked" signal from <a href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a>, the current
1814
event will be the <a
1815
href="../gdk/gdk-Event-Structures.html#GdkEventButton"
1816
><span class="type">GdkEventButton</span></a> that triggered the "clicked"
1817
signal. The returned event must be freed with <a
1818
href="../gdk/gdk-Events.html#gdk-event-free"
1819
><code class="function">gdk_event_free()</code></a>.
1820
If there is no current event, the function returns <a
1821
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1822
><code class="literal">NULL</code></a>.</p>
1826
<div class="variablelist"><table border="0">
1827
<col align="left" valign="top">
1829
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1830
<td> a copy of the current event, or <a
1831
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1832
><code class="literal">NULL</code></a> if no current event.
1838
<div class="refsect2" lang="en">
1839
<a name="id2637954"></a><h3>
1840
<a name="gtk-get-current-event-time"></a>gtk_get_current_event_time ()</h3>
1841
<a class="indexterm" name="id2637968"></a><pre class="programlisting">guint32 gtk_get_current_event_time (void);</pre>
1843
If there is a current event and it has a timestamp, return that
1844
timestamp, otherwise return <a
1845
href="../gdk/gdk-Events.html#GDK-CURRENT-TIME:CAPS"
1846
><code class="literal">GDK_CURRENT_TIME</code></a>.</p>
1850
<div class="variablelist"><table border="0">
1851
<col align="left" valign="top">
1853
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1854
<td> the timestamp from the current event, or <a
1855
href="../gdk/gdk-Events.html#GDK-CURRENT-TIME:CAPS"
1856
><code class="literal">GDK_CURRENT_TIME</code></a>.
1862
<div class="refsect2" lang="en">
1863
<a name="id2638033"></a><h3>
1864
<a name="gtk-get-current-event-state"></a>gtk_get_current_event_state ()</h3>
1865
<a class="indexterm" name="id2638046"></a><pre class="programlisting">gboolean gtk_get_current_event_state (<a
1866
href="../gdk/gdk-Windows.html#GdkModifierType"
1867
>GdkModifierType</a> *state);</pre>
1869
If there is a current event and it has a state field, place
1870
that state field in <em class="parameter"><code>state</code></em> and return <code class="literal">TRUE</code>, otherwise return
1871
<code class="literal">FALSE</code>.</p>
1875
<div class="variablelist"><table border="0">
1876
<col align="left" valign="top">
1879
<td><span class="term"><em class="parameter"><code>state</code></em> :</span></td>
1880
<td> a location to store the state of the current event
1884
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1885
<td> <code class="literal">TRUE</code> if there was a current event and it had a state field
1892
<div class="refsect2" lang="en">
1893
<a name="id2638146"></a><h3>
1894
<a name="gtk-get-event-widget"></a>gtk_get_event_widget ()</h3>
1895
<a class="indexterm" name="id2638158"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_get_event_widget (<a
1896
href="../gdk/gdk-Event-Structures.html#GdkEvent"
1897
>GdkEvent</a> *event);</pre>
1899
If <em class="parameter"><code>event</code></em> is <a
1900
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1901
><code class="literal">NULL</code></a> or the event was not associated with any widget,
1903
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1904
><code class="literal">NULL</code></a>, otherwise returns the widget that received the event
1909
<div class="variablelist"><table border="0">
1910
<col align="left" valign="top">
1913
<td><span class="term"><em class="parameter"><code>event</code></em> :</span></td>
1915
href="../gdk/gdk-Event-Structures.html#GdkEvent"
1916
><span class="type">GdkEvent</span></a>
1920
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1921
<td> the widget that originally received <em class="parameter"><code>event</code></em>, or <a
1922
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
1923
><code class="literal">NULL</code></a>
1930
<div class="refsect2" lang="en">
1931
<a name="id2638271"></a><h3>
1932
<a name="gtk-propagate-event"></a>gtk_propagate_event ()</h3>
1933
<a class="indexterm" name="id2638284"></a><pre class="programlisting">void gtk_propagate_event (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget,
1935
href="../gdk/gdk-Event-Structures.html#GdkEvent"
1936
>GdkEvent</a> *event);</pre>
1938
Sends an event to a widget, propagating the event to parent widgets
1939
if the event remains unhandled. Events received by GTK+ from GDK
1940
normally begin in <a href="gtk-General.html#gtk-main-do-event"><code class="function">gtk_main_do_event()</code></a>. Depending on the type of
1941
event, existence of modal dialogs, grabs, etc., the event may be
1942
propagated; if so, this function is used. <a href="gtk-General.html#gtk-propagate-event"><code class="function">gtk_propagate_event()</code></a>
1943
calls <a href="GtkWidget.html#gtk-widget-event"><code class="function">gtk_widget_event()</code></a> on each widget it decides to send the
1944
event to. So <a href="GtkWidget.html#gtk-widget-event"><code class="function">gtk_widget_event()</code></a> is the lowest-level function; it
1945
simply emits the "event" and possibly an event-specific signal on a
1946
widget. <a href="gtk-General.html#gtk-propagate-event"><code class="function">gtk_propagate_event()</code></a> is a bit higher-level, and
1947
<a href="gtk-General.html#gtk-main-do-event"><code class="function">gtk_main_do_event()</code></a> is the highest level.
1950
All that said, you most likely don't want to use any of these
1951
functions; synthesizing events is rarely needed. Consider asking on
1952
the mailing list for better ways to achieve your goals. For
1954
href="../gdk/gdk-Windows.html#gdk-window-invalidate-rect"
1955
><code class="function">gdk_window_invalidate_rect()</code></a> or
1956
<a href="GtkWidget.html#gtk-widget-queue-draw"><code class="function">gtk_widget_queue_draw()</code></a> instead of making up expose events.</p>
1960
<div class="variablelist"><table border="0">
1961
<col align="left" valign="top">
1964
<td><span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
1965
<td> a <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a>
1969
<td><span class="term"><em class="parameter"><code>event</code></em> :</span></td>
1977
<div class="refsect1" lang="en">
1978
<a name="id2638469"></a><h2>See Also</h2>
1980
See the GLib manual, especially <span class="type">GMainLoop</span> and signal-related
1981
functions such as <code class="function">g_signal_connect()</code>.