~ubuntu-branches/ubuntu/wily/libx11/wily-proposed

« back to all changes in this revision

Viewing changes to specs/libX11/CH05.xml

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2011-02-24 12:02:14 UTC
  • mfrom: (1.1.12 upstream) (2.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110224120214-a86d0lv48wk8itl6
Tags: 2:1.4.1-5ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Add Latin locale.
  - Add Klingon locale.
  - Add 102_double_arrows_Compose.patch: compose keys for double arrows
    (LP: 680143)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8" ?>
 
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
 
3
          "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
 
4
<chapter id="pixmap_and_cursor_functions">
 
5
<title>Pixmap and Cursor Functions</title>
 
6
<sect1 id="Creating_and_Freeing_Pixmaps">
 
7
<title>Creating and Freeing Pixmaps</title>
 
8
<!-- .XS -->
 
9
<!-- (SN Creating and Freeing Pixmaps -->
 
10
<!-- .XE -->
 
11
<para>
 
12
<!-- .LP -->
 
13
Pixmaps can only be used on the screen on which they were created.
 
14
Pixmaps are off-screen resources that are used for various operations,
 
15
such as defining cursors as tiling patterns 
 
16
or as the source for certain raster operations.
 
17
Most graphics requests can operate either on a window or on a pixmap.
 
18
A bitmap is a single bit-plane pixmap.
 
19
</para>
 
20
<para>
 
21
<!-- .LP -->
 
22
<!-- .sp -->
 
23
To create a pixmap of a given size, use
 
24
<function>XCreatePixmap</function>.
 
25
<indexterm significance="preferred"><primary>XCreatePixmap</primary></indexterm>
 
26
<!-- .sM -->
 
27
<funcsynopsis>
 
28
<funcprototype>
 
29
  <funcdef>Pixmap <function>XCreatePixmap</function></funcdef>
 
30
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
31
  <paramdef>Drawable<parameter> d</parameter></paramdef>
 
32
  <paramdef>unsignedintwidth,<parameter> height</parameter></paramdef>
 
33
  <paramdef>unsignedint<parameter> depth</parameter></paramdef>
 
34
</funcprototype>
 
35
</funcsynopsis>
 
36
<!-- .FN -->
 
37
<variablelist>
 
38
  <varlistentry>
 
39
    <term>
 
40
      <emphasis remap='I'>display</emphasis>
 
41
    </term>
 
42
    <listitem>
 
43
      <para>
 
44
Specifies the connection to the X server.
 
45
      </para>
 
46
    </listitem>
 
47
  </varlistentry>
 
48
  <varlistentry>
 
49
    <term>
 
50
      <emphasis remap='I'>d</emphasis>
 
51
    </term>
 
52
    <listitem>
 
53
      <para>
 
54
Specifies which screen the pixmap is created on. 
 
55
<!-- .ds Wh , which define the dimensions of the pixmap -->
 
56
      </para>
 
57
    </listitem>
 
58
  </varlistentry>
 
59
  <varlistentry>
 
60
    <term>
 
61
      <emphasis remap='I'>width</emphasis>
 
62
    </term>
 
63
    <listitem>
 
64
      <para>
 
65
<!-- .br -->
 
66
<!-- .ns -->
 
67
      </para>
 
68
    </listitem>
 
69
  </varlistentry>
 
70
  <varlistentry>
 
71
    <term>
 
72
      <emphasis remap='I'>height</emphasis>
 
73
    </term>
 
74
    <listitem>
 
75
      <para>
 
76
Specify the width and height(Wh.
 
77
      </para>
 
78
    </listitem>
 
79
  </varlistentry>
 
80
  <varlistentry>
 
81
    <term>
 
82
      <emphasis remap='I'>depth</emphasis>
 
83
    </term>
 
84
    <listitem>
 
85
      <para>
 
86
Specifies the depth of the pixmap.
 
87
    </para>
 
88
  </listitem>
 
89
  </varlistentry>
 
90
</variablelist>
 
91
</para>
 
92
<para>
 
93
<!-- .LP -->
 
94
<!-- .eM  -->
 
95
The
 
96
<function>XCreatePixmap</function>
 
97
function creates a pixmap of the width, height, and depth you specified
 
98
and returns a pixmap ID that identifies it.
 
99
It is valid to pass an 
 
100
<symbol>InputOnly</symbol>
 
101
window to the drawable argument.
 
102
The width and height arguments must be nonzero,
 
103
or a 
 
104
<errorname>BadValue</errorname>
 
105
error results.
 
106
The depth argument must be one of the depths supported by the screen
 
107
of the specified drawable,
 
108
or a
 
109
<errorname>BadValue</errorname>
 
110
error results.
 
111
</para>
 
112
<para>
 
113
<!-- .LP -->
 
114
The server uses the specified drawable to determine on which screen
 
115
to create the pixmap.
 
116
The pixmap can be used only on this screen
 
117
and only with other drawables of the same depth (see
 
118
<function>XCopyPlane</function>
 
119
for an exception to this rule).
 
120
The initial contents of the pixmap are undefined.
 
121
</para>
 
122
<para>
 
123
<!-- .LP -->
 
124
<function>XCreatePixmap</function>
 
125
can generate
 
126
<errorname>BadAlloc</errorname>,
 
127
<errorname>BadDrawable</errorname>,
 
128
and
 
129
<errorname>BadValue</errorname>
 
130
errors.
 
131
</para>
 
132
<para>
 
133
<!-- .LP -->
 
134
<!-- .sp -->
 
135
To free all storage associated with a specified pixmap, use
 
136
<function>XFreePixmap</function>.
 
137
<indexterm significance="preferred"><primary>XFreePixmap</primary></indexterm>
 
138
<!-- .sM -->
 
139
<funcsynopsis>
 
140
<funcprototype>
 
141
  <funcdef><function>XFreePixmap</function></funcdef>
 
142
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
143
  <paramdef>Pixmap<parameter> pixmap</parameter></paramdef>
 
144
</funcprototype>
 
145
</funcsynopsis>
 
146
<!-- .FN         -->
 
147
<variablelist>
 
148
  <varlistentry>
 
149
    <term>
 
150
      <emphasis remap='I'>display</emphasis>
 
151
    </term>
 
152
    <listitem>
 
153
      <para>
 
154
Specifies the connection to the X server.
 
155
      </para>
 
156
    </listitem>
 
157
  </varlistentry>
 
158
  <varlistentry>
 
159
    <term>
 
160
      <emphasis remap='I'>pixmap</emphasis>
 
161
    </term>
 
162
    <listitem>
 
163
      <para>
 
164
Specifies the pixmap.
 
165
    </para>
 
166
  </listitem>
 
167
  </varlistentry>
 
168
</variablelist>
 
169
</para>
 
170
<para>
 
171
<!-- .LP -->
 
172
<!-- .eM  -->
 
173
The
 
174
<function>XFreePixmap</function>
 
175
function first deletes the association between the pixmap ID and the pixmap.
 
176
Then, the X server frees the pixmap storage when there are no references to it.
 
177
The pixmap should never be referenced again.
 
178
</para>
 
179
<para>
 
180
<!-- .LP -->
 
181
<function>XFreePixmap</function>
 
182
can generate a
 
183
<errorname>BadPixmap</errorname>
 
184
error.
 
185
</para>
 
186
</sect1>
 
187
<sect1 id="Creating_Recoloring_and_Freeing_Cursors">
 
188
<title>Creating, Recoloring, and Freeing Cursors</title>
 
189
<!-- .XS -->
 
190
<!-- (SN Creating, Recoloring, and Freeing Cursors  -->
 
191
<!-- .XE -->
 
192
<para>
 
193
<!-- .LP -->
 
194
Each window can have a different cursor defined for it.
 
195
Whenever the pointer is in a visible window, 
 
196
it is set to the cursor defined for that window.
 
197
If no cursor was defined for that window, 
 
198
the cursor is the one defined for the parent window.
 
199
</para>
 
200
<para>
 
201
<!-- .LP -->
 
202
From X's perspective, 
 
203
a cursor consists of a cursor source, mask, colors, and a hotspot. 
 
204
The mask pixmap determines the shape of the cursor and must be a depth
 
205
of one.
 
206
The source pixmap must have a depth of one,
 
207
and the colors determine the colors of the source.
 
208
The hotspot defines the point on the cursor that is reported
 
209
when a pointer event occurs.
 
210
There may be limitations imposed by the hardware on
 
211
cursors as to size and whether a mask is implemented. 
 
212
<indexterm><primary>XQueryBestCursor</primary></indexterm>
 
213
<function>XQueryBestCursor</function>
 
214
can be used to find out what sizes are possible.
 
215
There is a standard font for creating cursors, but
 
216
Xlib provides functions that you can use to create cursors
 
217
from an arbitrary font or from bitmaps.
 
218
</para>
 
219
<para>
 
220
<!-- .LP -->
 
221
<!-- .sp -->
 
222
To create a cursor from the standard cursor font, use
 
223
<function>XCreateFontCursor</function>.
 
224
</para>
 
225
<para>
 
226
#include &lt;X11/cursorfont.h&gt;
 
227
</para>
 
228
 
 
229
<indexterm significance="preferred"><primary>XCreateFontCursor</primary></indexterm>
 
230
<!-- .sM -->
 
231
<funcsynopsis>
 
232
<funcprototype>
 
233
  <funcdef>Cursor <function>XCreateFontCursor</function></funcdef>
 
234
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
235
  <paramdef>unsignedint<parameter> shape</parameter></paramdef>
 
236
</funcprototype>
 
237
</funcsynopsis>
 
238
 
 
239
<!-- .FN -->
 
240
<variablelist>
 
241
  <varlistentry>
 
242
    <term>
 
243
      <emphasis remap='I'>display</emphasis>
 
244
    </term>
 
245
    <listitem>
 
246
      <para>
 
247
Specifies the connection to the X server.
 
248
      </para>
 
249
    </listitem>
 
250
  </varlistentry>
 
251
  <varlistentry>
 
252
    <term>
 
253
      <emphasis remap='I'>shape</emphasis>
 
254
    </term>
 
255
    <listitem>
 
256
      <para>
 
257
Specifies the shape of the cursor.
 
258
    </para>
 
259
  </listitem>
 
260
  </varlistentry>
 
261
</variablelist>
 
262
 
 
263
<para>
 
264
<!-- .LP -->
 
265
<!-- .eM -->
 
266
X provides a set of standard cursor shapes in a special font named
 
267
cursor.
 
268
Applications are encouraged to use this interface for their cursors
 
269
because the font can be customized for the individual display type.
 
270
The shape argument specifies which glyph of the standard fonts
 
271
to use.
 
272
</para>
 
273
<para>
 
274
<!-- .LP -->
 
275
The hotspot comes from the information stored in the cursor font.
 
276
The initial colors of a cursor are a black foreground and a white
 
277
background (see
 
278
<function>XRecolorCursor</function>).
 
279
For further information about cursor shapes,
 
280
see appendix B.
 
281
</para>
 
282
<para>
 
283
<!-- .LP -->
 
284
<function>XCreateFontCursor</function>
 
285
can generate
 
286
<errorname>BadAlloc</errorname>
 
287
and
 
288
<errorname>BadValue</errorname>
 
289
errors.
 
290
</para>
 
291
<para>
 
292
<!-- .LP -->
 
293
<!-- .sp -->
 
294
To create a cursor from font glyphs, use
 
295
<function>XCreateGlyphCursor</function>.
 
296
<indexterm significance="preferred"><primary>XCreateGlyphCursor</primary></indexterm>
 
297
<!-- .sM -->
 
298
<funcsynopsis>
 
299
<funcprototype>
 
300
  <funcdef>Cursor <function>XCreateGlyphCursor</function></funcdef>
 
301
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
302
  <paramdef>Fontsource_font,<parameter> mask_font</parameter></paramdef>
 
303
  <paramdef>unsignedintsource_char,<parameter> mask_char</parameter></paramdef>
 
304
  <paramdef>XColor<parameter> *foreground_color</parameter></paramdef>
 
305
  <paramdef>XColor<parameter> *background_color</parameter></paramdef>
 
306
</funcprototype>
 
307
</funcsynopsis>
 
308
<!-- .FN -->
 
309
<variablelist>
 
310
  <varlistentry>
 
311
    <term>
 
312
      <emphasis remap='I'>display</emphasis>
 
313
    </term>
 
314
    <listitem>
 
315
      <para>
 
316
Specifies the connection to the X server.
 
317
      </para>
 
318
    </listitem>
 
319
  </varlistentry>
 
320
  <varlistentry>
 
321
    <term>
 
322
      <emphasis remap='I'>source_font</emphasis>
 
323
    </term>
 
324
    <listitem>
 
325
      <para>
 
326
Specifies the font for the source glyph.
 
327
      </para>
 
328
    </listitem>
 
329
  </varlistentry>
 
330
  <varlistentry>
 
331
    <term>
 
332
      <emphasis remap='I'>mask_font</emphasis>
 
333
    </term>
 
334
    <listitem>
 
335
      <para>
 
336
Specifies the font for the mask glyph or
 
337
<symbol>None</symbol>.
 
338
      </para>
 
339
    </listitem>
 
340
  </varlistentry>
 
341
  <varlistentry>
 
342
    <term>
 
343
      <emphasis remap='I'>source_char</emphasis>
 
344
    </term>
 
345
    <listitem>
 
346
      <para>
 
347
Specifies the character glyph for the source.
 
348
      </para>
 
349
    </listitem>
 
350
  </varlistentry>
 
351
  <varlistentry>
 
352
    <term>
 
353
      <emphasis remap='I'>mask_char</emphasis>
 
354
    </term>
 
355
    <listitem>
 
356
      <para>
 
357
Specifies the glyph character for the mask. 
 
358
      </para>
 
359
    </listitem>
 
360
  </varlistentry>
 
361
  <varlistentry>
 
362
    <term>
 
363
      <emphasis remap='I'>foreground_color</emphasis>
 
364
    </term>
 
365
    <listitem>
 
366
      <para>
 
367
Specifies the <acronym>RGB</acronym> values for the foreground of the source. 
 
368
      </para>
 
369
    </listitem>
 
370
  </varlistentry>
 
371
  <varlistentry>
 
372
    <term>
 
373
      <emphasis remap='I'>background_color</emphasis>
 
374
    </term>
 
375
    <listitem>
 
376
      <para>
 
377
Specifies the <acronym>RGB</acronym> values for the background of the source.
 
378
    </para>
 
379
  </listitem>
 
380
  </varlistentry>
 
381
</variablelist>
 
382
</para>
 
383
<para>
 
384
<!-- .LP -->
 
385
<!-- .eM -->
 
386
The
 
387
<function>XCreateGlyphCursor</function>
 
388
function is similar to
 
389
<function>XCreatePixmapCursor</function>
 
390
except that the source and mask bitmaps are obtained from the specified 
 
391
font glyphs.
 
392
The source_char must be a defined glyph in source_font, 
 
393
or a
 
394
<errorname>BadValue</errorname>
 
395
error results.
 
396
If mask_font is given, 
 
397
mask_char must be a defined glyph in mask_font,
 
398
or a
 
399
<errorname>BadValue</errorname>
 
400
error results.
 
401
The mask_font and character are optional.
 
402
The origins of the source_char and mask_char (if defined) glyphs are
 
403
positioned coincidently and define the hotspot. 
 
404
The source_char and mask_char need not have the same bounding box metrics, 
 
405
and there is no restriction on the placement of the hotspot relative to the bounding
 
406
boxes. 
 
407
If no mask_char is given, all pixels of the source are displayed.
 
408
You can free the fonts immediately by calling
 
409
<function>XFreeFont</function>
 
410
if no further explicit references to them are to be made. 
 
411
</para>
 
412
<para>
 
413
<!-- .LP -->
 
414
For 2-byte matrix fonts, 
 
415
the 16-bit value should be formed with the byte1
 
416
member in the most significant byte and the byte2 member in the 
 
417
least significant byte.
 
418
</para>
 
419
<para>
 
420
<!-- .LP -->
 
421
<function>XCreateGlyphCursor</function>
 
422
can generate
 
423
<errorname>BadAlloc</errorname>,
 
424
<errorname>BadFont</errorname>,
 
425
and
 
426
<errorname>BadValue</errorname>
 
427
errors.
 
428
</para>
 
429
<para>
 
430
<!-- .LP -->
 
431
<!-- .sp -->
 
432
To create a cursor from two bitmaps,
 
433
use
 
434
<function>XCreatePixmapCursor</function>.
 
435
<indexterm significance="preferred"><primary>XCreatePixmapCursor</primary></indexterm>
 
436
<!-- .sM -->
 
437
<funcsynopsis>
 
438
<funcprototype>
 
439
  <funcdef>Cursor <function>XCreatePixmapCursor</function></funcdef>
 
440
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
441
  <paramdef>Pixmap<parameter> source</parameter></paramdef>
 
442
  <paramdef>Pixmap<parameter> mask</parameter></paramdef>
 
443
  <paramdef>XColor<parameter> *foreground_color</parameter></paramdef>
 
444
  <paramdef>XColor<parameter> *background_color</parameter></paramdef>
 
445
  <paramdef>unsignedintx,<parameter> y</parameter></paramdef>
 
446
</funcprototype>
 
447
</funcsynopsis>
 
448
<!-- .FN -->
 
449
<variablelist>
 
450
  <varlistentry>
 
451
    <term>
 
452
      <emphasis remap='I'>display</emphasis>
 
453
    </term>
 
454
    <listitem>
 
455
      <para>
 
456
Specifies the connection to the X server.
 
457
      </para>
 
458
    </listitem>
 
459
  </varlistentry>
 
460
  <varlistentry>
 
461
    <term>
 
462
      <emphasis remap='I'>source</emphasis>
 
463
    </term>
 
464
    <listitem>
 
465
      <para>
 
466
Specifies the shape of the source cursor.
 
467
<!-- .\" *** JIM: NEED TO CHECK THIS. *** -->
 
468
      </para>
 
469
    </listitem>
 
470
  </varlistentry>
 
471
  <varlistentry>
 
472
    <term>
 
473
      <emphasis remap='I'>mask</emphasis>
 
474
    </term>
 
475
    <listitem>
 
476
      <para>
 
477
Specifies the cursor's source bits to be displayed or
 
478
<symbol>None</symbol>.
 
479
      </para>
 
480
    </listitem>
 
481
  </varlistentry>
 
482
  <varlistentry>
 
483
    <term>
 
484
      <emphasis remap='I'>foreground_color</emphasis>
 
485
    </term>
 
486
    <listitem>
 
487
      <para>
 
488
Specifies the <acronym>RGB</acronym> values for the foreground of the source. 
 
489
      </para>
 
490
    </listitem>
 
491
  </varlistentry>
 
492
  <varlistentry>
 
493
    <term>
 
494
      <emphasis remap='I'>background_color</emphasis>
 
495
    </term>
 
496
    <listitem>
 
497
      <para>
 
498
Specifies the <acronym>RGB</acronym> values for the background of the source.
 
499
<!-- .ds Xy , which indicate the hotspot relative to the source's origin -->
 
500
      </para>
 
501
    </listitem>
 
502
  </varlistentry>
 
503
  <varlistentry>
 
504
    <term>
 
505
      <emphasis remap='I'>x</emphasis>
 
506
    </term>
 
507
    <listitem>
 
508
      <para>
 
509
<!-- .br -->
 
510
<!-- .ns -->
 
511
      </para>
 
512
    </listitem>
 
513
  </varlistentry>
 
514
  <varlistentry>
 
515
    <term>
 
516
      <emphasis remap='I'>y</emphasis>
 
517
    </term>
 
518
    <listitem>
 
519
      <para>
 
520
Specify the x and y coordinates(Xy.
 
521
    </para>
 
522
  </listitem>
 
523
  </varlistentry>
 
524
</variablelist>
 
525
</para>
 
526
<para>
 
527
<!-- .LP -->
 
528
<!-- .eM -->
 
529
The
 
530
<function>XCreatePixmapCursor</function>
 
531
function creates a cursor and returns the cursor ID associated with it.
 
532
The foreground and background <acronym>RGB</acronym> values must be specified using
 
533
foreground_color and background_color,
 
534
even if the X server only has a
 
535
<symbol>StaticGray</symbol>
 
536
or
 
537
<symbol>GrayScale</symbol>
 
538
screen.
 
539
The foreground color is used for the pixels set to 1 in the
 
540
source, and the background color is used for the pixels set to 0.
 
541
Both source and mask, if specified, must have depth one (or a 
 
542
<errorname>BadMatch</errorname>
 
543
error results) but can have any root.
 
544
The mask argument defines the shape of the cursor.
 
545
The pixels set to 1 in the mask define which source pixels are displayed,
 
546
and the pixels set to 0 define which pixels are ignored.
 
547
If no mask is given, 
 
548
all pixels of the source are displayed.
 
549
The mask, if present, must be the same size as the pixmap defined by the 
 
550
source argument, or a
 
551
<errorname>BadMatch</errorname>
 
552
error results.
 
553
The hotspot must be a point within the source,
 
554
or a
 
555
<errorname>BadMatch</errorname>
 
556
error results.
 
557
</para>
 
558
<para>
 
559
<!-- .LP -->
 
560
The components of the cursor can be transformed arbitrarily to meet
 
561
display limitations.
 
562
The pixmaps can be freed immediately if no further explicit references
 
563
to them are to be made.
 
564
Subsequent drawing in the source or mask pixmap has an undefined effect on the
 
565
cursor.
 
566
The X server might or might not make a copy of the pixmap.
 
567
</para>
 
568
<para>
 
569
<!-- .LP -->
 
570
<function>XCreatePixmapCursor</function>
 
571
can generate
 
572
<errorname>BadAlloc</errorname>
 
573
and
 
574
<errorname>BadPixmap</errorname>
 
575
errors.
 
576
</para>
 
577
<para>
 
578
<!-- .LP -->
 
579
<!-- .sp -->
 
580
To determine useful cursor sizes, use
 
581
<function>XQueryBestCursor</function>.
 
582
<indexterm significance="preferred"><primary>XQueryBestCursor</primary></indexterm>
 
583
<!-- .sM -->
 
584
<funcsynopsis>
 
585
<funcprototype>
 
586
  <funcdef>Status <function>XQueryBestCursor</function></funcdef>
 
587
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
588
  <paramdef>Drawable<parameter> d</parameter></paramdef>
 
589
  <paramdef>unsignedintwidth,<parameter> height</parameter></paramdef>
 
590
  <paramdef>unsignedint*width_return,<parameter> *height_return</parameter></paramdef>
 
591
</funcprototype>
 
592
</funcsynopsis>
 
593
<!-- .FN -->
 
594
<variablelist>
 
595
  <varlistentry>
 
596
    <term>
 
597
      <emphasis remap='I'>display</emphasis>
 
598
    </term>
 
599
    <listitem>
 
600
      <para>
 
601
Specifies the connection to the X server.
 
602
<!-- .ds Dr , which indicates the screen -->
 
603
      </para>
 
604
    </listitem>
 
605
  </varlistentry>
 
606
  <varlistentry>
 
607
    <term>
 
608
      <emphasis remap='I'>d</emphasis>
 
609
    </term>
 
610
    <listitem>
 
611
      <para>
 
612
Specifies the drawable(Dr. 
 
613
<!-- .ds Wh \ of the cursor that you want the size information for -->
 
614
      </para>
 
615
    </listitem>
 
616
  </varlistentry>
 
617
  <varlistentry>
 
618
    <term>
 
619
      <emphasis remap='I'>width</emphasis>
 
620
    </term>
 
621
    <listitem>
 
622
      <para>
 
623
<!-- .br -->
 
624
<!-- .ns -->
 
625
      </para>
 
626
    </listitem>
 
627
  </varlistentry>
 
628
  <varlistentry>
 
629
    <term>
 
630
      <emphasis remap='I'>height</emphasis>
 
631
    </term>
 
632
    <listitem>
 
633
      <para>
 
634
Specify the width and height(Wh.
 
635
      </para>
 
636
    </listitem>
 
637
  </varlistentry>
 
638
  <varlistentry>
 
639
    <term>
 
640
      <emphasis remap='I'>width_return</emphasis>
 
641
    </term>
 
642
    <listitem>
 
643
      <para>
 
644
<!-- .br -->
 
645
<!-- .ns -->
 
646
      </para>
 
647
    </listitem>
 
648
  </varlistentry>
 
649
  <varlistentry>
 
650
    <term>
 
651
      <emphasis remap='I'>height_return</emphasis>
 
652
    </term>
 
653
    <listitem>
 
654
      <para>
 
655
Return the best width and height that is closest to the specified width 
 
656
and height.
 
657
    </para>
 
658
  </listitem>
 
659
  </varlistentry>
 
660
</variablelist>
 
661
</para>
 
662
<para>
 
663
<!-- .LP -->
 
664
<!-- .eM -->
 
665
Some displays allow larger cursors than other displays.
 
666
The
 
667
<function>XQueryBestCursor</function>
 
668
function provides a way to find out what size cursors are actually
 
669
possible on the display.
 
670
<indexterm ><primary>Cursor</primary><secondary>limitations</secondary></indexterm>
 
671
It returns the largest size that can be displayed.
 
672
Applications should be prepared to use smaller cursors on displays that
 
673
cannot support large ones.
 
674
</para>
 
675
<para>
 
676
<!-- .LP -->
 
677
<function>XQueryBestCursor</function>
 
678
can generate a
 
679
<errorname>BadDrawable</errorname>
 
680
error.
 
681
</para>
 
682
<para>
 
683
<!-- .LP -->
 
684
<!-- .sp -->
 
685
To change the color of a given cursor, use
 
686
<function>XRecolorCursor</function>.
 
687
<indexterm significance="preferred"><primary>XRecolorCursor</primary></indexterm>
 
688
<!-- .sM -->
 
689
<funcsynopsis>
 
690
<funcprototype>
 
691
  <funcdef><function>XRecolorCursor</function></funcdef>
 
692
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
693
  <paramdef>Cursor<parameter> cursor</parameter></paramdef>
 
694
  <paramdef>XColor*foreground_color,<parameter> *background_color</parameter></paramdef>
 
695
</funcprototype>
 
696
</funcsynopsis>
 
697
<!-- .FN -->
 
698
<variablelist>
 
699
  <varlistentry>
 
700
    <term>
 
701
      <emphasis remap='I'>display</emphasis>
 
702
    </term>
 
703
    <listitem>
 
704
      <para>
 
705
Specifies the connection to the X server.
 
706
      </para>
 
707
    </listitem>
 
708
  </varlistentry>
 
709
  <varlistentry>
 
710
    <term>
 
711
      <emphasis remap='I'>cursor</emphasis>
 
712
    </term>
 
713
    <listitem>
 
714
      <para>
 
715
Specifies the cursor. 
 
716
      </para>
 
717
    </listitem>
 
718
  </varlistentry>
 
719
  <varlistentry>
 
720
    <term>
 
721
      <emphasis remap='I'>foreground_color</emphasis>
 
722
    </term>
 
723
    <listitem>
 
724
      <para>
 
725
Specifies the <acronym>RGB</acronym> values for the foreground of the source. 
 
726
      </para>
 
727
    </listitem>
 
728
  </varlistentry>
 
729
  <varlistentry>
 
730
    <term>
 
731
      <emphasis remap='I'>background_color</emphasis>
 
732
    </term>
 
733
    <listitem>
 
734
      <para>
 
735
Specifies the <acronym>RGB</acronym> values for the background of the source.
 
736
    </para>
 
737
  </listitem>
 
738
  </varlistentry>
 
739
</variablelist>
 
740
</para>
 
741
<para>
 
742
<!-- .LP -->
 
743
<!-- .eM -->
 
744
The
 
745
<function>XRecolorCursor</function>
 
746
function changes the color of the specified cursor, and
 
747
if the cursor is being displayed on a screen,
 
748
the change is visible immediately.
 
749
The pixel members of the
 
750
<structname>XColor</structname>
 
751
structures are ignored; only the <acronym>RGB</acronym> values are used.
 
752
</para>
 
753
<para>
 
754
<!-- .LP -->
 
755
<function>XRecolorCursor</function>
 
756
can generate a
 
757
<errorname>BadCursor</errorname>
 
758
error.
 
759
</para>
 
760
<para>
 
761
<!-- .LP -->
 
762
<!-- .sp -->
 
763
To free (destroy) a given cursor, use
 
764
<function>XFreeCursor</function>.
 
765
<indexterm significance="preferred"><primary>XFreeCursor</primary></indexterm>
 
766
<!-- .sM -->
 
767
<funcsynopsis>
 
768
<funcprototype>
 
769
  <funcdef><function>XFreeCursor</function></funcdef>
 
770
  <paramdef>Display<parameter> *display</parameter></paramdef>
 
771
  <paramdef>Cursor<parameter> cursor</parameter></paramdef>
 
772
</funcprototype>
 
773
</funcsynopsis>
 
774
<!-- .FN -->
 
775
<variablelist>
 
776
  <varlistentry>
 
777
    <term>
 
778
      <emphasis remap='I'>display</emphasis>
 
779
    </term>
 
780
    <listitem>
 
781
      <para>
 
782
Specifies the connection to the X server.
 
783
      </para>
 
784
    </listitem>
 
785
  </varlistentry>
 
786
  <varlistentry>
 
787
    <term>
 
788
      <emphasis remap='I'>cursor</emphasis>
 
789
    </term>
 
790
    <listitem>
 
791
      <para>
 
792
Specifies the cursor. 
 
793
    </para>
 
794
  </listitem>
 
795
  </varlistentry>
 
796
</variablelist>
 
797
</para>
 
798
<para>
 
799
<!-- .LP -->
 
800
<!-- .eM  -->
 
801
The
 
802
<function>XFreeCursor</function>
 
803
function deletes the association between the cursor resource ID 
 
804
and the specified cursor.
 
805
The cursor storage is freed when no other resource references it.
 
806
The specified cursor ID should not be referred to again.
 
807
</para>
 
808
<para>
 
809
<!-- .LP -->
 
810
<function>XFreeCursor</function>
 
811
can generate a
 
812
<errorname>BadCursor</errorname>
 
813
error.
 
814
<!-- .bp -->
 
815
 
 
816
</para>
 
817
</sect1>
 
818
</chapter>