~ubuntu-branches/ubuntu/natty/libx11/natty

« back to all changes in this revision

Viewing changes to specs/libX11/CH05

  • 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
 
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
2
 
.\"
3
 
.\" Permission is hereby granted, free of charge, to any person obtaining
4
 
.\" a copy of this software and associated documentation files (the
5
 
.\" "Software"), to deal in the Software without restriction, including
6
 
.\" without limitation the rights to use, copy, modify, merge, publish,
7
 
.\" distribute, sublicense, and/or sell copies of the Software, and to
8
 
.\" permit persons to whom the Software is furnished to do so, subject to
9
 
.\" the following conditions:
10
 
.\"
11
 
.\" The above copyright notice and this permission notice shall be included
12
 
.\" in all copies or substantial portions of the Software.
13
 
.\"
14
 
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
 
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
 
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
 
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
 
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
 
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
 
.\" OTHER DEALINGS IN THE SOFTWARE.
21
 
.\"
22
 
.\" Except as contained in this notice, the name of the X Consortium shall
23
 
.\" not be used in advertising or otherwise to promote the sale, use or
24
 
.\" other dealings in this Software without prior written authorization
25
 
.\" from the X Consortium.
26
 
.\"
27
 
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
28
 
.\" Digital Equipment Corporation
29
 
.\"
30
 
.\" Portions Copyright \(co 1990, 1991 by
31
 
.\" Tektronix, Inc.
32
 
.\"
33
 
.\" Permission to use, copy, modify and distribute this documentation for
34
 
.\" any purpose and without fee is hereby granted, provided that the above
35
 
.\" copyright notice appears in all copies and that both that copyright notice
36
 
.\" and this permission notice appear in all copies, and that the names of
37
 
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
38
 
.\" to this documentation without specific, written prior permission.
39
 
.\" Digital and Tektronix makes no representations about the suitability
40
 
.\" of this documentation for any purpose.
41
 
.\" It is provided ``as is'' without express or implied warranty.
42
 
.\" 
43
 
\&
44
 
.sp 1
45
 
.ce 3
46
 
\s+1\fBChapter 5\fP\s-1
47
 
 
48
 
\s+1\fBPixmap and Cursor Functions\fP\s-1
49
 
.sp 2
50
 
.nr H1 5
51
 
.nr H2 0
52
 
.nr H3 0
53
 
.nr H4 0
54
 
.nr H5 0
55
 
.na
56
 
.LP
57
 
.XS
58
 
Chapter 5: Pixmap and Cursor Functions 
59
 
.XE
60
 
Once you have connected to an X server,
61
 
you can use the Xlib functions to:
62
 
.IP \(bu 5
63
 
Create and free pixmaps
64
 
.IP \(bu 5
65
 
Create, recolor, and free cursors
66
 
.NH 2
67
 
Creating and Freeing Pixmaps
68
 
.XS
69
 
\*(SN Creating and Freeing Pixmaps
70
 
.XE
71
 
.LP
72
 
Pixmaps can only be used on the screen on which they were created.
73
 
Pixmaps are off-screen resources that are used for various operations,
74
 
such as defining cursors as tiling patterns 
75
 
or as the source for certain raster operations.
76
 
Most graphics requests can operate either on a window or on a pixmap.
77
 
A bitmap is a single bit-plane pixmap.
78
 
.LP
79
 
.sp
80
 
To create a pixmap of a given size, use
81
 
.PN XCreatePixmap .
82
 
.IN "XCreatePixmap" "" "@DEF@"
83
 
.sM
84
 
.FD 0
85
 
Pixmap XCreatePixmap\^(\^\fIdisplay\fP, \fId\fP\^, \fIwidth\fP\^, \fIheight\fP\^, \fIdepth\fP\^)
86
 
.br
87
 
      Display *\fIdisplay\fP\^;
88
 
.br
89
 
      Drawable \fId\fP\^;
90
 
.br
91
 
      unsigned int \fIwidth\fP\^, \fIheight\fP\^;
92
 
.br
93
 
      unsigned int \fIdepth\fP\^;
94
 
.FN
95
 
.IP \fIdisplay\fP 1i
96
 
Specifies the connection to the X server.
97
 
.IP \fId\fP 1i
98
 
Specifies which screen the pixmap is created on. 
99
 
.ds Wh , which define the dimensions of the pixmap
100
 
.IP \fIwidth\fP 1i
101
 
.br
102
 
.ns
103
 
.IP \fIheight\fP 1i
104
 
Specify the width and height\*(Wh.
105
 
.IP \fIdepth\fP 1i
106
 
Specifies the depth of the pixmap.
107
 
.LP
108
 
.eM 
109
 
The
110
 
.PN XCreatePixmap
111
 
function creates a pixmap of the width, height, and depth you specified
112
 
and returns a pixmap ID that identifies it.
113
 
It is valid to pass an 
114
 
.PN InputOnly
115
 
window to the drawable argument.
116
 
The width and height arguments must be nonzero,
117
 
or a 
118
 
.PN BadValue
119
 
error results.
120
 
The depth argument must be one of the depths supported by the screen
121
 
of the specified drawable,
122
 
or a
123
 
.PN BadValue
124
 
error results.
125
 
.LP
126
 
The server uses the specified drawable to determine on which screen
127
 
to create the pixmap.
128
 
The pixmap can be used only on this screen
129
 
and only with other drawables of the same depth (see
130
 
.PN XCopyPlane
131
 
for an exception to this rule).
132
 
The initial contents of the pixmap are undefined.
133
 
.LP
134
 
.PN XCreatePixmap
135
 
can generate
136
 
.PN BadAlloc ,
137
 
.PN BadDrawable ,
138
 
and
139
 
.PN BadValue 
140
 
errors.
141
 
.LP
142
 
.sp
143
 
To free all storage associated with a specified pixmap, use
144
 
.PN XFreePixmap .
145
 
.IN "XFreePixmap" "" "@DEF@"
146
 
.sM
147
 
.FD 0
148
 
XFreePixmap\^(\^\fIdisplay\fP, \fIpixmap\fP\^)
149
 
.br
150
 
      Display *\fIdisplay\fP\^;
151
 
.br
152
 
      Pixmap \fIpixmap\fP\^;
153
 
.FN     
154
 
.IP \fIdisplay\fP 1i
155
 
Specifies the connection to the X server.
156
 
.IP \fIpixmap\fP 1i
157
 
Specifies the pixmap.
158
 
.LP
159
 
.eM 
160
 
The
161
 
.PN XFreePixmap
162
 
function first deletes the association between the pixmap ID and the pixmap.
163
 
Then, the X server frees the pixmap storage when there are no references to it.
164
 
The pixmap should never be referenced again.
165
 
.LP
166
 
.PN XFreePixmap
167
 
can generate a
168
 
.PN BadPixmap 
169
 
error.
170
 
.NH 2
171
 
Creating, Recoloring, and Freeing Cursors
172
 
.XS
173
 
\*(SN Creating, Recoloring, and Freeing Cursors 
174
 
.XE
175
 
.LP
176
 
Each window can have a different cursor defined for it.
177
 
Whenever the pointer is in a visible window, 
178
 
it is set to the cursor defined for that window.
179
 
If no cursor was defined for that window, 
180
 
the cursor is the one defined for the parent window.
181
 
.LP
182
 
From X's perspective, 
183
 
a cursor consists of a cursor source, mask, colors, and a hotspot. 
184
 
The mask pixmap determines the shape of the cursor and must be a depth
185
 
of one.
186
 
The source pixmap must have a depth of one,
187
 
and the colors determine the colors of the source.
188
 
The hotspot defines the point on the cursor that is reported
189
 
when a pointer event occurs.
190
 
There may be limitations imposed by the hardware on
191
 
cursors as to size and whether a mask is implemented. 
192
 
.IN "XQueryBestCursor"
193
 
.PN XQueryBestCursor
194
 
can be used to find out what sizes are possible.
195
 
There is a standard font for creating cursors, but
196
 
Xlib provides functions that you can use to create cursors
197
 
from an arbitrary font or from bitmaps.
198
 
.LP
199
 
.sp
200
 
To create a cursor from the standard cursor font, use
201
 
.PN XCreateFontCursor .
202
 
.IN "XCreateFontCursor" "" "@DEF@"
203
 
.sM
204
 
.FD 0
205
 
#include <X11/cursorfont.h>
206
 
.sp 6p
207
 
Cursor XCreateFontCursor\^(\^\fIdisplay\fP, \fIshape\fP\^)
208
 
.br
209
 
      Display *\fIdisplay\fP\^;
210
 
.br
211
 
      unsigned int \fIshape\fP\^;
212
 
.FN
213
 
.IP \fIdisplay\fP 1i
214
 
Specifies the connection to the X server.
215
 
.IP \fIshape\fP 1i
216
 
Specifies the shape of the cursor.
217
 
.LP
218
 
.eM
219
 
X provides a set of standard cursor shapes in a special font named
220
 
cursor.
221
 
Applications are encouraged to use this interface for their cursors
222
 
because the font can be customized for the individual display type.
223
 
The shape argument specifies which glyph of the standard fonts
224
 
to use.
225
 
.LP
226
 
The hotspot comes from the information stored in the cursor font.
227
 
The initial colors of a cursor are a black foreground and a white
228
 
background (see
229
 
.PN XRecolorCursor ).
230
 
For further information about cursor shapes,
231
 
see appendix B.
232
 
.LP
233
 
.PN XCreateFontCursor
234
 
can generate
235
 
.PN BadAlloc
236
 
and
237
 
.PN BadValue 
238
 
errors.
239
 
.LP
240
 
.sp
241
 
To create a cursor from font glyphs, use
242
 
.PN XCreateGlyphCursor .
243
 
.IN "XCreateGlyphCursor" "" "@DEF@"
244
 
.sM
245
 
.FD 0
246
 
Cursor XCreateGlyphCursor\^(\^\fIdisplay\fP, \fIsource_font\fP\^, \fImask_font\fP\^, \fIsource_char\fP\^, \fImask_char\fP\^,
247
 
.br
248
 
                           \fIforeground_color\fP\^, \fIbackground_color\fP\^)
249
 
.br
250
 
      Display *\fIdisplay\fP\^;
251
 
.br
252
 
      Font \fIsource_font\fP\^, \fImask_font\fP\^;
253
 
.br
254
 
      unsigned int \fIsource_char\fP\^, \fImask_char\fP\^;
255
 
.br
256
 
      XColor *\fIforeground_color\fP\^;
257
 
.br
258
 
      XColor *\fIbackground_color\fP\^;
259
 
.FN
260
 
.IP \fIdisplay\fP 1i
261
 
Specifies the connection to the X server.
262
 
.IP \fIsource_font\fP 1i
263
 
Specifies the font for the source glyph.
264
 
.IP \fImask_font\fP 1i
265
 
Specifies the font for the mask glyph or
266
 
.PN None .
267
 
.IP \fIsource_char\fP 1i
268
 
Specifies the character glyph for the source.
269
 
.IP \fImask_char\fP 1i
270
 
Specifies the glyph character for the mask. 
271
 
.IP \fIforeground_color\fP 1i
272
 
Specifies the RGB values for the foreground of the source. 
273
 
.IP \fIbackground_color\fP 1i
274
 
Specifies the RGB values for the background of the source.
275
 
.LP
276
 
.eM
277
 
The
278
 
.PN XCreateGlyphCursor
279
 
function is similar to
280
 
.PN XCreatePixmapCursor
281
 
except that the source and mask bitmaps are obtained from the specified 
282
 
font glyphs.
283
 
The source_char must be a defined glyph in source_font, 
284
 
or a
285
 
.PN BadValue
286
 
error results.
287
 
If mask_font is given, 
288
 
mask_char must be a defined glyph in mask_font,
289
 
or a
290
 
.PN BadValue
291
 
error results.
292
 
The mask_font and character are optional.
293
 
The origins of the source_char and mask_char (if defined) glyphs are
294
 
positioned coincidently and define the hotspot. 
295
 
The source_char and mask_char need not have the same bounding box metrics, 
296
 
and there is no restriction on the placement of the hotspot relative to the bounding
297
 
boxes. 
298
 
If no mask_char is given, all pixels of the source are displayed.
299
 
You can free the fonts immediately by calling
300
 
.PN XFreeFont
301
 
if no further explicit references to them are to be made. 
302
 
.LP
303
 
For 2-byte matrix fonts, 
304
 
the 16-bit value should be formed with the byte1
305
 
member in the most significant byte and the byte2 member in the 
306
 
least significant byte.
307
 
.LP
308
 
.PN XCreateGlyphCursor
309
 
can generate
310
 
.PN BadAlloc ,
311
 
.PN BadFont ,
312
 
and
313
 
.PN BadValue 
314
 
errors.
315
 
.LP
316
 
.sp
317
 
To create a cursor from two bitmaps,
318
 
use
319
 
.PN XCreatePixmapCursor .
320
 
.IN "XCreatePixmapCursor" "" "@DEF@"
321
 
.sM
322
 
.FD 0
323
 
Cursor XCreatePixmapCursor\^(\^\fIdisplay\fP, \fIsource\fP\^, \fImask\fP\^, \fIforeground_color\fP\^, \fIbackground_color\fP\^, \fIx\fP\^, \fIy\fP\^)
324
 
.br
325
 
      Display *\fIdisplay\fP\^;
326
 
.br
327
 
      Pixmap \fIsource\fP\^;
328
 
.br
329
 
      Pixmap \fImask\fP\^;
330
 
.br
331
 
      XColor *\fIforeground_color\fP\^;
332
 
.br
333
 
      XColor *\fIbackground_color\fP\^;
334
 
.br
335
 
      unsigned int \fIx\fP\^, \fIy\fP\^;
336
 
.FN
337
 
.IP \fIdisplay\fP 1i
338
 
Specifies the connection to the X server.
339
 
.IP \fIsource\fP 1i
340
 
Specifies the shape of the source cursor.
341
 
.\" *** JIM: NEED TO CHECK THIS. ***
342
 
.IP \fImask\fP 1i
343
 
Specifies the cursor's source bits to be displayed or
344
 
.PN None .
345
 
.IP \fIforeground_color\fP 1i
346
 
Specifies the RGB values for the foreground of the source. 
347
 
.IP \fIbackground_color\fP 1i
348
 
Specifies the RGB values for the background of the source.
349
 
.ds Xy , which indicate the hotspot relative to the source's origin
350
 
.IP \fIx\fP 1i
351
 
.br
352
 
.ns
353
 
.IP \fIy\fP 1i
354
 
Specify the x and y coordinates\*(Xy.
355
 
.LP
356
 
.eM
357
 
The
358
 
.PN XCreatePixmapCursor
359
 
function creates a cursor and returns the cursor ID associated with it.
360
 
The foreground and background RGB values must be specified using
361
 
foreground_color and background_color,
362
 
even if the X server only has a
363
 
.PN StaticGray
364
 
or
365
 
.PN GrayScale
366
 
screen.
367
 
The foreground color is used for the pixels set to 1 in the
368
 
source, and the background color is used for the pixels set to 0.
369
 
Both source and mask, if specified, must have depth one (or a 
370
 
.PN BadMatch
371
 
error results) but can have any root.
372
 
The mask argument defines the shape of the cursor.
373
 
The pixels set to 1 in the mask define which source pixels are displayed,
374
 
and the pixels set to 0 define which pixels are ignored.
375
 
If no mask is given, 
376
 
all pixels of the source are displayed.
377
 
The mask, if present, must be the same size as the pixmap defined by the 
378
 
source argument, or a
379
 
.PN BadMatch
380
 
error results.
381
 
The hotspot must be a point within the source,
382
 
or a
383
 
.PN BadMatch
384
 
error results.
385
 
.LP
386
 
The components of the cursor can be transformed arbitrarily to meet
387
 
display limitations.
388
 
The pixmaps can be freed immediately if no further explicit references
389
 
to them are to be made.
390
 
Subsequent drawing in the source or mask pixmap has an undefined effect on the
391
 
cursor.
392
 
The X server might or might not make a copy of the pixmap.
393
 
.LP
394
 
.PN XCreatePixmapCursor
395
 
can generate
396
 
.PN BadAlloc
397
 
and
398
 
.PN BadPixmap
399
 
errors.
400
 
.LP
401
 
.sp
402
 
To determine useful cursor sizes, use
403
 
.PN XQueryBestCursor .
404
 
.IN "XQueryBestCursor" "" "@DEF@"
405
 
.sM
406
 
.FD 0
407
 
Status XQueryBestCursor\^(\^\fIdisplay\fP, \fId\fP, \fIwidth\fP\^, \fIheight\fP\^, \fIwidth_return\fP\^, \fIheight_return\fP\^)
408
 
.br
409
 
      Display *\fIdisplay\fP\^;
410
 
.br
411
 
      Drawable \fId\fP\^;
412
 
.br
413
 
      unsigned int \fIwidth\fP\^, \fIheight\fP\^;
414
 
.br
415
 
      unsigned int *\fIwidth_return\fP\^, *\fIheight_return\fP\^;
416
 
.FN
417
 
.IP \fIdisplay\fP 1i
418
 
Specifies the connection to the X server.
419
 
.ds Dr , which indicates the screen
420
 
.IP \fId\fP 1i
421
 
Specifies the drawable\*(Dr. 
422
 
.ds Wh \ of the cursor that you want the size information for
423
 
.IP \fIwidth\fP 1i
424
 
.br
425
 
.ns
426
 
.IP \fIheight\fP 1i
427
 
Specify the width and height\*(Wh.
428
 
.IP \fIwidth_return\fP 1i
429
 
.br
430
 
.ns
431
 
.IP \fIheight_return\fP 1i
432
 
Return the best width and height that is closest to the specified width 
433
 
and height.
434
 
.LP
435
 
.eM
436
 
Some displays allow larger cursors than other displays.
437
 
The
438
 
.PN XQueryBestCursor
439
 
function provides a way to find out what size cursors are actually
440
 
possible on the display.
441
 
.IN "Cursor" "limitations" 
442
 
It returns the largest size that can be displayed.
443
 
Applications should be prepared to use smaller cursors on displays that
444
 
cannot support large ones.
445
 
.LP
446
 
.PN XQueryBestCursor
447
 
can generate a
448
 
.PN BadDrawable 
449
 
error.
450
 
.LP
451
 
.sp
452
 
To change the color of a given cursor, use
453
 
.PN XRecolorCursor .
454
 
.IN "XRecolorCursor" "" "@DEF@"
455
 
.sM
456
 
.FD 0
457
 
XRecolorCursor\^(\^\fIdisplay\fP, \fIcursor\fP\^, \fIforeground_color\fP\^, \fIbackground_color\fP\^)
458
 
.br
459
 
      Display *\fIdisplay\fP\^;
460
 
.br
461
 
      Cursor \fIcursor\fP\^;
462
 
.br
463
 
      XColor *\fIforeground_color\fP\^, *\fIbackground_color\fP\^;
464
 
.FN
465
 
.IP \fIdisplay\fP 1i
466
 
Specifies the connection to the X server.
467
 
.IP \fIcursor\fP 1i
468
 
Specifies the cursor. 
469
 
.IP \fIforeground_color\fP 1i
470
 
Specifies the RGB values for the foreground of the source. 
471
 
.IP \fIbackground_color\fP 1i
472
 
Specifies the RGB values for the background of the source.
473
 
.LP
474
 
.eM
475
 
The
476
 
.PN XRecolorCursor
477
 
function changes the color of the specified cursor, and
478
 
if the cursor is being displayed on a screen,
479
 
the change is visible immediately.
480
 
The pixel members of the
481
 
.PN XColor
482
 
structures are ignored; only the RGB values are used.
483
 
.LP
484
 
.PN XRecolorCursor
485
 
can generate a
486
 
.PN BadCursor 
487
 
error.
488
 
.LP
489
 
.sp
490
 
To free (destroy) a given cursor, use
491
 
.PN XFreeCursor .
492
 
.IN "XFreeCursor" "" "@DEF@"
493
 
.sM
494
 
.FD 0
495
 
XFreeCursor\^(\^\fIdisplay\fP, \fIcursor\fP\^)
496
 
.br
497
 
      Display *\fIdisplay\fP\^;
498
 
.br
499
 
      Cursor \fIcursor\fP\^;
500
 
.FN
501
 
.IP \fIdisplay\fP 1i
502
 
Specifies the connection to the X server.
503
 
.IP \fIcursor\fP 1i
504
 
Specifies the cursor. 
505
 
.LP
506
 
.eM 
507
 
The
508
 
.PN XFreeCursor
509
 
function deletes the association between the cursor resource ID 
510
 
and the specified cursor.
511
 
The cursor storage is freed when no other resource references it.
512
 
The specified cursor ID should not be referred to again.
513
 
.LP
514
 
.PN XFreeCursor
515
 
can generate a
516
 
.PN BadCursor 
517
 
error.
518
 
.bp