~ubuntu-branches/ubuntu/raring/gtk+2.0/raring-proposed

« back to all changes in this revision

Viewing changes to docs/reference/gdk/tmpl/general.sgml

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-02-06 22:03:26 UTC
  • mfrom: (1.14.12)
  • Revision ID: package-import@ubuntu.com-20120206220326-10d7cnkpdpbi9iox
Tags: 2.24.10-0ubuntu1
* New upstream version, dropped patches included in the new version
* debian/patches/090_logging_file_saves.patch:
  - improve the logging of saved filed, thanks Siegfried Gevatter 
    (lp: #920961)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- ##### SECTION Title ##### -->
 
2
General
 
3
 
 
4
<!-- ##### SECTION Short_Description ##### -->
 
5
Library initialization and miscellaneous functions
 
6
 
 
7
<!-- ##### SECTION Long_Description ##### -->
 
8
<para>
 
9
This section describes the GDK initialization functions and miscellaneous
 
10
utility functions.
 
11
</para>
 
12
 
 
13
<!-- ##### SECTION See_Also ##### -->
 
14
<para>
 
15
 
 
16
</para>
 
17
 
 
18
<!-- ##### SECTION Stability_Level ##### -->
 
19
 
 
20
 
 
21
<!-- ##### SECTION Image ##### -->
 
22
 
 
23
 
 
24
<!-- ##### FUNCTION gdk_init ##### -->
 
25
<para>
 
26
Initializes the GDK library and connects to the X server.
 
27
If initialization fails, a warning message is output and the application
 
28
terminates with a call to <literal>exit(1)</literal>.
 
29
</para>
 
30
<para>
 
31
Any arguments used by GDK are removed from the array and @argc and @argv are
 
32
updated accordingly.
 
33
</para>
 
34
<para>
 
35
GTK+ initializes GDK in gtk_init() and so this function is not usually needed
 
36
by GTK+ applications.
 
37
</para>
 
38
 
 
39
@argc: the number of command line arguments.
 
40
@argv: the array of command line arguments.
 
41
 
 
42
 
 
43
<!-- ##### FUNCTION gdk_init_check ##### -->
 
44
<para>
 
45
Initializes the GDK library and connects to the X server, returning %TRUE on
 
46
success.
 
47
</para>
 
48
<para>
 
49
Any arguments used by GDK are removed from the array and @argc and @argv are
 
50
updated accordingly.
 
51
</para>
 
52
<para>
 
53
GTK+ initializes GDK in gtk_init() and so this function is not usually needed
 
54
by GTK+ applications.
 
55
</para>
 
56
 
 
57
@argc: the number of command line arguments.
 
58
@argv: the array of command line arguments.
 
59
@Returns: %TRUE if initialization succeeded.
 
60
 
 
61
 
 
62
<!-- ##### FUNCTION gdk_parse_args ##### -->
 
63
<para>
 
64
 
 
65
</para>
 
66
 
 
67
@argc: 
 
68
@argv: 
 
69
 
 
70
 
 
71
<!-- ##### FUNCTION gdk_get_display_arg_name ##### -->
 
72
<para>
 
73
 
 
74
</para>
 
75
 
 
76
@void: 
 
77
@Returns: 
 
78
 
 
79
 
 
80
<!-- ##### FUNCTION gdk_set_locale ##### -->
 
81
<para>
 
82
Initializes the support for internationalization by calling the <function>setlocale()</function>
 
83
system call. This function is called by gtk_set_locale() and so GTK+
 
84
applications should use that instead.
 
85
</para>
 
86
<para>
 
87
The locale to use is determined by the <envar>LANG</envar> environment variable,
 
88
so to run an application in a certain locale you can do something like this:
 
89
<informalexample>
 
90
<programlisting>
 
91
  export LANG="fr"
 
92
  ... run application ...
 
93
</programlisting>
 
94
</informalexample>
 
95
</para>
 
96
<para>
 
97
If the locale is not supported by X then it is reset to the standard "C"
 
98
locale.
 
99
</para>
 
100
 
 
101
@void: 
 
102
@Returns: the resulting locale.
 
103
@Deprecated: 2.24: Use setlocale() directly
 
104
 
 
105
 
 
106
<!-- ##### FUNCTION gdk_set_sm_client_id ##### -->
 
107
<para>
 
108
</para>
 
109
 
 
110
@sm_client_id: 
 
111
 
 
112
 
 
113
<!-- ##### FUNCTION gdk_exit ##### -->
 
114
<para>
 
115
Exits the application using the <function>exit()</function> system call.
 
116
</para>
 
117
<para>
 
118
This routine is provided mainly for backwards compatibility, since it used to
 
119
perform tasks necessary to exit the application cleanly. Those tasks are now
 
120
performed in a function which is automatically called on exit (via the use
 
121
of g_atexit()).
 
122
</para>
 
123
 
 
124
@error_code: the error code to pass to the <function>exit()</function> call.
 
125
 
 
126
 
 
127
<!-- ##### FUNCTION gdk_notify_startup_complete ##### -->
 
128
<para>
 
129
 
 
130
</para>
 
131
 
 
132
@void: 
 
133
 
 
134
 
 
135
<!-- ##### FUNCTION gdk_notify_startup_complete_with_id ##### -->
 
136
<para>
 
137
 
 
138
</para>
 
139
 
 
140
@startup_id: 
 
141
 
 
142
 
 
143
<!-- ##### FUNCTION gdk_get_program_class ##### -->
 
144
<para>
 
145
Gets the program class. Unless the program class has explicitly
 
146
been set with gdk_set_program_class() or with the <option>--class</option> 
 
147
commandline option, the default value is the program name (determined 
 
148
with g_get_prgname()) with the first character converted to uppercase. 
 
149
</para>
 
150
 
 
151
@void: 
 
152
@Returns: the program class.
 
153
 
 
154
 
 
155
<!-- ##### FUNCTION gdk_set_program_class ##### -->
 
156
<para>
 
157
Sets the program class. The X11 backend uses the program class to set
 
158
the class name part of the <literal>WM_CLASS</literal> property on
 
159
toplevel windows; see the ICCCM.
 
160
</para>
 
161
 
 
162
@program_class: a string.
 
163
 
 
164
 
 
165
<!-- ##### FUNCTION gdk_get_display ##### -->
 
166
<para>
 
167
Gets the name of the display, which usually comes from the <envar>DISPLAY</envar>
 
168
environment variable or the <option>--display</option> command line option.
 
169
</para>
 
170
 
 
171
@void: 
 
172
@Returns: the name of the display.
 
173
 
 
174
 
 
175
<!-- ##### FUNCTION gdk_flush ##### -->
 
176
<para>
 
177
Flushes the X output buffer and waits until all requests have been processed
 
178
by the server. This is rarely needed by applications. It's main use is for
 
179
trapping X errors with gdk_error_trap_push() and gdk_error_trap_pop().
 
180
</para>
 
181
 
 
182
@void: 
 
183
 
 
184
 
 
185
<!-- ##### FUNCTION gdk_screen_width ##### -->
 
186
<para>
 
187
</para>
 
188
 
 
189
@void: 
 
190
@Returns: 
 
191
 
 
192
 
 
193
<!-- ##### FUNCTION gdk_screen_height ##### -->
 
194
<para>
 
195
</para>
 
196
 
 
197
@void: 
 
198
@Returns: 
 
199
 
 
200
 
 
201
<!-- ##### FUNCTION gdk_screen_width_mm ##### -->
 
202
<para>
 
203
</para>
 
204
 
 
205
@void: 
 
206
@Returns: 
 
207
 
 
208
 
 
209
<!-- ##### FUNCTION gdk_screen_height_mm ##### -->
 
210
<para>
 
211
</para>
 
212
 
 
213
@void: 
 
214
@Returns: 
 
215
 
 
216
 
 
217
<!-- ##### FUNCTION gdk_pointer_grab ##### -->
 
218
<para>
 
219
Grabs the pointer (usually a mouse) so that all events are passed to this
 
220
application until the pointer is ungrabbed with gdk_pointer_ungrab(), or
 
221
the grab window becomes unviewable.
 
222
This overrides any previous pointer grab by this client.
 
223
</para>
 
224
<para>
 
225
Pointer grabs are used for operations which need complete control over mouse
 
226
events, even if the mouse leaves the application.
 
227
For example in GTK+ it is used for Drag and Drop, for dragging the handle in
 
228
the #GtkHPaned and #GtkVPaned widgets, and for resizing columns in #GtkCList
 
229
widgets.
 
230
</para>
 
231
<para>
 
232
Note that if the event mask of an X window has selected both button press and
 
233
button release events, then a button press event will cause an automatic
 
234
pointer grab until the button is released.
 
235
X does this automatically since most applications expect to receive button
 
236
press and release events in pairs.
 
237
It is equivalent to a pointer grab on the window with @owner_events set to
 
238
%TRUE.
 
239
</para>
 
240
<para>
 
241
If you set up anything at the time you take the grab that needs to be cleaned
 
242
up when the grab ends, you should handle the #GdkEventGrabBroken events that
 
243
are emitted when the grab ends unvoluntarily.
 
244
</para>
 
245
 
 
246
@window: the #GdkWindow which will own the grab (the grab window).
 
247
@owner_events: if %FALSE then all pointer events are reported with respect to
 
248
@window and are only reported if selected by @event_mask. If %TRUE then pointer
 
249
events for this application are reported as normal, but pointer events outside
 
250
this application are reported with respect to @window and only if selected by
 
251
@event_mask. In either mode, unreported events are discarded.
 
252
@event_mask: specifies the event mask, which is used in accordance with
 
253
@owner_events. Note that only pointer events (i.e. button and motion events) 
 
254
    may be selected.
 
255
@confine_to: If non-%NULL, the pointer will be confined to this
 
256
window during the grab. If the pointer is outside @confine_to, it will
 
257
automatically be moved to the closest edge of @confine_to and enter
 
258
and leave events will be generated as necessary.
 
259
@cursor: the cursor to display while the grab is active. If this is %NULL then
 
260
the normal cursors are used for @window and its descendants, and the cursor
 
261
for @window is used for all other windows.
 
262
@time_: the timestamp of the event which led to this pointer grab. This usually
 
263
comes from a #GdkEventButton struct, though %GDK_CURRENT_TIME can be used if
 
264
the time isn't known.
 
265
@Returns: %GDK_GRAB_SUCCESS if the grab was successful.
 
266
 
 
267
 
 
268
<!-- ##### ENUM GdkGrabStatus ##### -->
 
269
<para>
 
270
Returned by gdk_pointer_grab() and gdk_keyboard_grab() to indicate 
 
271
success or the reason for the failure of the grab attempt.
 
272
</para>
 
273
 
 
274
@GDK_GRAB_SUCCESS: the resource was successfully grabbed.
 
275
@GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
 
276
@GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the 
 
277
  specified time.
 
278
@GDK_GRAB_NOT_VIEWABLE: the grab window or the @confine_to window are not
 
279
  viewable.
 
280
@GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
 
281
 
 
282
<!-- ##### FUNCTION gdk_pointer_ungrab ##### -->
 
283
<para>
 
284
 
 
285
</para>
 
286
 
 
287
@time_: 
 
288
 
 
289
 
 
290
<!-- ##### FUNCTION gdk_pointer_is_grabbed ##### -->
 
291
<para>
 
292
</para>
 
293
<para>
 
294
</para>
 
295
 
 
296
@void: 
 
297
@Returns: 
 
298
 
 
299
 
 
300
<!-- ##### FUNCTION gdk_set_double_click_time ##### -->
 
301
<para>
 
302
 
 
303
</para>
 
304
 
 
305
@msec: 
 
306
 
 
307
 
 
308
<!-- ##### FUNCTION gdk_keyboard_grab ##### -->
 
309
<para>
 
310
Grabs the keyboard so that all events are passed to this
 
311
application until the keyboard is ungrabbed with gdk_keyboard_ungrab().
 
312
This overrides any previous keyboard grab by this client.
 
313
</para>
 
314
<para>
 
315
If you set up anything at the time you take the grab that needs to be cleaned
 
316
up when the grab ends, you should handle the #GdkEventGrabBroken events that
 
317
are emitted when the grab ends unvoluntarily.
 
318
</para>
 
319
 
 
320
@window: the #GdkWindow which will own the grab (the grab window).
 
321
@owner_events: if %FALSE then all keyboard events are reported with respect to
 
322
@window. If %TRUE then keyboard events for this application are reported as
 
323
normal, but keyboard events outside this application are reported with respect
 
324
to @window. Both key press and key release events are always reported,
 
325
independant of the event mask set by the application.
 
326
@time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is
 
327
available.
 
328
@Returns: %GDK_GRAB_SUCCESS if the grab was successful.
 
329
 
 
330
 
 
331
<!-- ##### FUNCTION gdk_keyboard_ungrab ##### -->
 
332
<para>
 
333
</para>
 
334
 
 
335
@time_: 
 
336
 
 
337
 
 
338
<!-- ##### FUNCTION gdk_beep ##### -->
 
339
<para>
 
340
</para>
 
341
 
 
342
@void: 
 
343
 
 
344
 
 
345
<!-- ##### FUNCTION gdk_get_use_xshm ##### -->
 
346
<para>
 
347
Returns %TRUE if GDK will attempt to use the MIT-SHM shared memory extension.
 
348
</para>
 
349
<para>
 
350
The shared memory extension is used for #GdkImage, and consequently for
 
351
<link linkend="gdk-GdkRGB">GdkRGB</link>.
 
352
It enables much faster drawing by communicating with the X server through
 
353
SYSV shared memory calls. However, it can only be used if the X client and
 
354
server are on the same machine and the server supports it.
 
355
</para>
 
356
 
 
357
@void: 
 
358
@Returns: %TRUE if use of the MIT shared memory extension will be attempted.
 
359
 
 
360
 
 
361
<!-- ##### FUNCTION gdk_set_use_xshm ##### -->
 
362
<para>
 
363
Sets whether the use of the MIT shared memory extension should be attempted.
 
364
This function is mainly for internal use. It is only safe for an application
 
365
to set this to %FALSE, since if it is set to %TRUE and the server does not
 
366
support the extension it may cause warning messages to be output.
 
367
</para>
 
368
 
 
369
@use_xshm: %TRUE if use of the MIT shared memory extension should be attempted.
 
370
 
 
371
 
 
372
<!-- ##### FUNCTION gdk_error_trap_push ##### -->
 
373
<para>
 
374
This function allows X errors to be trapped instead of the normal behavior
 
375
of exiting the application. It should only be used if it is not possible to
 
376
avoid the X error in any other way.
 
377
</para>
 
378
<example>
 
379
<title>Trapping an X error</title>
 
380
<programlisting>
 
381
  gdk_error_trap_push (<!-- -->);
 
382
 
 
383
  /* ... Call the X function which may cause an error here ... */
 
384
 
 
385
  /* Flush the X queue to catch errors now. */
 
386
  gdk_flush (<!-- -->);
 
387
 
 
388
  if (gdk_error_trap_pop (<!-- -->))
 
389
    {
 
390
      /* ... Handle the error here ... */
 
391
    }
 
392
</programlisting>
 
393
</example>
 
394
 
 
395
@void: 
 
396
 
 
397
 
 
398
<!-- ##### FUNCTION gdk_error_trap_pop ##### -->
 
399
<para>
 
400
Removes the X error trap installed with gdk_error_trap_push().
 
401
</para>
 
402
 
 
403
@void: 
 
404
@Returns: the X error code, or 0 if no error occurred.
 
405
 
 
406
 
 
407
<!-- ##### MACRO GDK_WINDOWING_X11 ##### -->
 
408
<para>
 
409
This macro is defined if GDK is configured to use the X11 backend.
 
410
</para>
 
411
 
 
412
 
 
413
 
 
414
<!-- ##### MACRO GDK_WINDOWING_WIN32 ##### -->
 
415
<para>
 
416
This macro is defined if GDK is configured to use the Win32 backend.
 
417
</para>
 
418
 
 
419
 
 
420