~ubuntu-branches/ubuntu/lucid/libx11/lucid

« back to all changes in this revision

Viewing changes to specs/libX11/CH02

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-12-04 11:43:54 UTC
  • mfrom: (1.1.10 upstream) (2.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20091204114354-0lik4mbb1bv1a8nw
Tags: 2:1.3.2-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add 100_latin_locale_alias.diff (LP 379785)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996, 2000 The Open Group
 
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 Open Group 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 Open Group.
 
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
.\" $XFree86$
 
44
\&
 
45
.sp 1
 
46
.ce 3
 
47
\s+1\fBChapter 2\fP\s-1
 
48
 
 
49
\s+1\fBDisplay Functions\fP\s-1
 
50
.sp 2
 
51
.nr H1 2
 
52
.nr H2 0
 
53
.nr H3 0
 
54
.nr H4 0
 
55
.nr H5 0
 
56
.na
 
57
.LP
 
58
.XS
 
59
Chapter 2: Display Functions
 
60
.XE
 
61
Before your program can use a display, you must establish a connection
 
62
to the X server.
 
63
Once you have established a connection,
 
64
you then can use the Xlib macros and functions discussed in this chapter
 
65
to return information about the display.
 
66
This chapter discusses how to:
 
67
.IP \(bu 5
 
68
Open (connect to) the display
 
69
.IP \(bu 5
 
70
Obtain information about the display, image formats, or screens
 
71
.IP \(bu 5
 
72
Generate a
 
73
.PN NoOperation
 
74
protocol request
 
75
.IP \(bu 5
 
76
Free client-created data
 
77
.IP \(bu 5
 
78
Close (disconnect from) a display
 
79
.IP \(bu 5
 
80
Use X Server connection close operations
 
81
.IP \(bu 5
 
82
Use Xlib with threads
 
83
.IP \(bu 5
 
84
Use internal connections
 
85
.NH 2
 
86
Opening the Display
 
87
.XS
 
88
\*(SN Opening the Display
 
89
.XE
 
90
.LP
 
91
To open a connection to the X server that controls a display, use
 
92
.PN XOpenDisplay .
 
93
.IN "XOpenDisplay" "" "@DEF@"
 
94
.LP
 
95
.sM
 
96
.FD 0
 
97
Display *XOpenDisplay\^(\^\fIdisplay_name\fP\^)
 
98
.br
 
99
      char *\fIdisplay_name\fP\^;
 
100
.FN     
 
101
.IP \fIdisplay_name\fP 1i
 
102
Specifies the hardware display name, which determines the display
 
103
and communications domain to be used.
 
104
On a POSIX-conformant system, if the display_name is NULL, 
 
105
it defaults to the value of the DISPLAY environment variable. 
 
106
.IN "Environment" "DISPLAY"
 
107
.LP
 
108
.eM
 
109
The encoding and interpretation of the display name are
 
110
implementation-dependent.
 
111
Strings in the Host Portable Character Encoding are supported;
 
112
support for other characters is implementation-dependent.
 
113
On POSIX-conformant systems,
 
114
the display name or DISPLAY environment variable can be a string in the format:
 
115
.LP
 
116
.sM
 
117
.Ds 0
 
118
.TA 1i
 
119
.ta 1i
 
120
        \fIprotocol\fP\^/\^\fIhostname\fP\^:\^\fInumber\fP\^.\^\fIscreen_number\fP
 
121
.De
 
122
.IP \fIprotocol\fP 1i
 
123
Specifies a protocol family or an alias for a protocol family.  Supported 
 
124
protocol families are implementation dependent.  The protocol entry is 
 
125
optional.  If protocol is not specified, the / separating protocol and 
 
126
hostname must also not be specified.
 
127
.IP \fIhostname\fP 1i
 
128
Specifies the name of the host machine on which the display is physically
 
129
attached.
 
130
You follow the hostname with either a single colon (:) or a double colon (::).
 
131
.IP \fInumber\fP 1i
 
132
Specifies the number of the display server on that host machine.
 
133
You may optionally follow this display number with a period (.).
 
134
A single CPU can have more than one display.
 
135
Multiple displays are usually numbered starting with zero.
 
136
.IN "Screen"
 
137
.IP \fIscreen_number\fP 1i
 
138
Specifies the screen to be used on that server.
 
139
Multiple screens can be controlled by a single X server.
 
140
The screen_number sets an internal variable that can be accessed by
 
141
using the 
 
142
.PN DefaultScreen 
 
143
macro or the 
 
144
.PN XDefaultScreen
 
145
function if you are using languages other than C (see section 2.2.1).
 
146
.LP
 
147
.eM
 
148
For example, the following would specify screen 1 of display 0 on the 
 
149
machine named ``dual-headed'':
 
150
.LP
 
151
.Ds
 
152
dual-headed:0.1
 
153
.De
 
154
.LP
 
155
The
 
156
.PN XOpenDisplay
 
157
function returns a 
 
158
.PN Display 
 
159
structure that serves as the
 
160
connection to the X server and that contains all the information
 
161
about that X server.
 
162
.PN XOpenDisplay
 
163
connects your application to the X server through TCP 
 
164
or DECnet communications protocols,
 
165
or through some local inter-process communication protocol.
 
166
.IN "Protocol" "TCP"
 
167
.IN "Protocol" "DECnet"
 
168
If the protocol is specified as "tcp", "inet", or "inet6", or
 
169
if no protocol is specified and the hostname is a host machine name and a single colon (:)
 
170
separates the hostname and display number,
 
171
.PN XOpenDisplay
 
172
connects using TCP streams.  (If the protocol is specified as "inet", TCP over
 
173
IPv4 is used.  If the protocol is specified as "inet6", TCP over IPv6 is used.
 
174
Otherwise, the implementation determines which IP version is used.)
 
175
If the hostname and protocol are both not specified,
 
176
Xlib uses whatever it believes is the fastest transport.
 
177
If the hostname is a host machine name and a double colon (::)
 
178
separates the hostname and display number,
 
179
.PN XOpenDisplay
 
180
connects using DECnet.
 
181
A single X server can support any or all of these transport mechanisms
 
182
simultaneously.
 
183
A particular Xlib implementation can support many more of these transport
 
184
mechanisms.
 
185
.LP
 
186
.IN "Display"
 
187
If successful, 
 
188
.PN XOpenDisplay 
 
189
returns a pointer to a 
 
190
.PN Display 
 
191
structure,
 
192
which is defined in 
 
193
.hN X11/Xlib.h .
 
194
If 
 
195
.PN XOpenDisplay 
 
196
does not succeed, it returns NULL.
 
197
After a successful call to
 
198
.PN XOpenDisplay ,
 
199
all of the screens in the display can be used by the client.
 
200
The screen number specified in the display_name argument is returned 
 
201
by the 
 
202
.PN DefaultScreen
 
203
macro (or the
 
204
.PN XDefaultScreen
 
205
function).
 
206
You can access elements of the
 
207
.PN Display
 
208
and
 
209
.PN Screen
 
210
structures only by using the information macros or functions.
 
211
For information about using macros and functions to obtain information from 
 
212
the
 
213
.PN Display 
 
214
structure,
 
215
see section 2.2.1.
 
216
.LP
 
217
X servers may implement various types of access control mechanisms
 
218
(see section 9.8).
 
219
.NH 2
 
220
Obtaining Information about the Display, Image Formats, or Screens
 
221
.XS
 
222
\*(SN Obtaining Information about the Display, Image Formats, or Screens
 
223
.XE
 
224
.LP
 
225
The Xlib library provides a number of useful macros 
 
226
and corresponding functions that return data from the 
 
227
.PN Display 
 
228
structure.
 
229
The macros are used for C programming, 
 
230
and their corresponding function equivalents are for other language bindings.
 
231
This section discusses the:
 
232
.IP \(bu 5
 
233
Display macros
 
234
.IP \(bu 5
 
235
Image format functions and macros
 
236
.IP \(bu 5
 
237
Screen information macros
 
238
.LP
 
239
.IN "Display" "data structure" 
 
240
All other members of the 
 
241
.PN Display 
 
242
structure (that is, those for which no macros are defined) are private to Xlib 
 
243
and must not be used.
 
244
Applications must never directly modify or inspect these private members of the 
 
245
.PN Display 
 
246
structure.
 
247
.NT Note
 
248
The
 
249
.PN XDisplayWidth ,
 
250
.PN XDisplayHeight ,
 
251
.PN XDisplayCells ,
 
252
.PN XDisplayPlanes ,
 
253
.PN XDisplayWidthMM ,
 
254
and
 
255
.PN XDisplayHeightMM
 
256
functions in the next sections are misnamed.
 
257
These functions really should be named Screen\fIwhatever\fP 
 
258
and XScreen\fIwhatever\fP, not Display\fIwhatever\fP or XDisplay\fIwhatever\fP.
 
259
Our apologies for the resulting confusion.
 
260
.NE
 
261
.NH 3
 
262
Display Macros 
 
263
.XS
 
264
\*(SN Display Macros
 
265
.XE
 
266
.LP
 
267
Applications should not directly modify any part of the
 
268
.PN Display
 
269
and
 
270
.PN Screen
 
271
structures.
 
272
The members should be considered read-only,
 
273
although they may change as the result of other operations on the display.
 
274
.LP 
 
275
The following lists the C language macros,
 
276
their corresponding function equivalents that are for other language bindings,
 
277
and what data both can return.
 
278
.LP
 
279
.sp
 
280
.sM
 
281
.FD 0
 
282
AllPlanes
 
283
.sp
 
284
unsigned long XAllPlanes(\^) 
 
285
.FN
 
286
.LP
 
287
.eM
 
288
.IN "AllPlanes" "" "@DEF@"
 
289
.IN "XAllPlanes" "" "@DEF@"
 
290
Both return a value with all bits set to 1 suitable for use in a plane argument to
 
291
a procedure.
 
292
.LP
 
293
.sp
 
294
Both 
 
295
.PN BlackPixel 
 
296
and 
 
297
.PN WhitePixel 
 
298
can be used in implementing a monochrome application.
 
299
These pixel values are for permanently allocated entries in the default
 
300
colormap.
 
301
The actual RGB (red, green, and blue) values are settable on some screens 
 
302
and, in any case, may not actually be black or white.
 
303
The names are intended to convey the expected relative intensity of the colors.
 
304
.sM
 
305
.FD 0
 
306
BlackPixel\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
307
.sp
 
308
unsigned long XBlackPixel\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
309
.br
 
310
      Display *\fIdisplay\fP\^;
 
311
.br
 
312
      int \fIscreen_number\fP\^;
 
313
.FN
 
314
.IP \fIdisplay\fP 1i
 
315
Specifies the connection to the X server.
 
316
.IP \fIscreen_number\fP 1i
 
317
Specifies the appropriate screen number on the host server.
 
318
.LP
 
319
.eM
 
320
.IN "BlackPixel" "" "@DEF@"
 
321
.IN "XBlackPixel" "" "@DEF@"
 
322
Both return the black pixel value for the specified screen.
 
323
.LP
 
324
.sp
 
325
.sM
 
326
.FD 0
 
327
WhitePixel\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
328
.sp
 
329
unsigned long XWhitePixel\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
330
.br
 
331
      Display *\fIdisplay\fP\^;
 
332
.br
 
333
      int \fIscreen_number\fP\^;
 
334
.FN
 
335
.IP \fIdisplay\fP 1i
 
336
Specifies the connection to the X server.
 
337
.IP \fIscreen_number\fP 1i
 
338
Specifies the appropriate screen number on the host server.
 
339
.LP
 
340
.eM
 
341
.IN "WhitePixel" "" "@DEF@"
 
342
.IN "XWhitePixel" "" "@DEF@"
 
343
Both return the white pixel value for the specified screen. 
 
344
.LP
 
345
.sp
 
346
.sM
 
347
.FD 0
 
348
ConnectionNumber\^(\^\fIdisplay\fP\^)
 
349
.sp
 
350
int XConnectionNumber\^(\^\fIdisplay\fP\^)
 
351
.br
 
352
      Display *\fIdisplay\fP\^;
 
353
.FN
 
354
.IP \fIdisplay\fP 1i
 
355
Specifies the connection to the X server.
 
356
.LP
 
357
.eM
 
358
.IN "ConnectionNumber" "" "@DEF@"
 
359
.IN "XConnectionNumber" "" "@DEF@"
 
360
Both return a connection number for the specified display.
 
361
On a POSIX-conformant system,
 
362
this is the file descriptor of the connection.
 
363
.LP
 
364
.sp
 
365
.sM
 
366
.FD 0
 
367
DefaultColormap\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
368
.sp
 
369
Colormap XDefaultColormap\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
370
.br
 
371
      Display *\fIdisplay\fP\^;
 
372
.br
 
373
      int \fIscreen_number\fP\^;
 
374
.FN
 
375
.IP \fIdisplay\fP 1i
 
376
Specifies the connection to the X server.
 
377
.IP \fIscreen_number\fP 1i
 
378
Specifies the appropriate screen number on the host server.
 
379
.LP
 
380
.eM
 
381
.IN "DefaultColormap" "" "@DEF@"
 
382
.IN "XDefaultColormap" "" "@DEF@"
 
383
Both return the default colormap ID for allocation on the specified screen.
 
384
Most routine allocations of color should be made out of this colormap.
 
385
.LP
 
386
.sp
 
387
.sM
 
388
.FD 0
 
389
DefaultDepth\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
390
.sp
 
391
int XDefaultDepth\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
392
.br
 
393
      Display *\fIdisplay\fP\^;
 
394
.br
 
395
      int \fIscreen_number\fP\^;
 
396
.FN
 
397
.IP \fIdisplay\fP 1i
 
398
Specifies the connection to the X server.
 
399
.IP \fIscreen_number\fP 1i
 
400
Specifies the appropriate screen number on the host server.
 
401
.LP
 
402
.eM
 
403
.IN "DefaultDepth" "" "@DEF@"
 
404
.IN "XDefaultDepth" "" "@DEF@"
 
405
Both return the depth (number of planes) of the default root window for the
 
406
specified screen.
 
407
Other depths may also be supported on this screen (see
 
408
.PN XMatchVisualInfo ).
 
409
.LP
 
410
.sp
 
411
.IN "XListDepths" "" "@DEF@"
 
412
To determine the number of depths that are available on a given screen, use
 
413
.PN XListDepths .
 
414
.sM
 
415
.FD 0
 
416
int *XListDepths\^(\^\fIdisplay\fP, \fIscreen_number\fP, \fIcount_return\fP\^)
 
417
.br
 
418
      Display *\fIdisplay\fP;
 
419
.br
 
420
      int \fIscreen_number\fP;
 
421
.br
 
422
      int *\fIcount_return\fP;
 
423
.FN
 
424
.IP \fIdisplay\fP 1i
 
425
Specifies the connection to the X server.
 
426
.IP \fIscreen_number\fP 1i
 
427
Specifies the appropriate screen number on the host server.
 
428
.ds Cn depths
 
429
.IP \fIcount_return\fP 1i
 
430
Returns the number of \*(Cn.
 
431
.LP
 
432
.eM
 
433
The
 
434
.PN XListDepths
 
435
function returns the array of depths 
 
436
that are available on the specified screen.
 
437
If the specified screen_number is valid and sufficient memory for the array
 
438
can be allocated,
 
439
.PN XListDepths
 
440
sets count_return to the number of available depths.
 
441
Otherwise, it does not set count_return and returns NULL.
 
442
To release the memory allocated for the array of depths, use
 
443
.PN XFree .
 
444
.LP
 
445
.sp
 
446
.sM
 
447
.FD 0
 
448
DefaultGC\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
449
.sp
 
450
GC XDefaultGC\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
451
.br
 
452
      Display *\fIdisplay\fP\^;
 
453
.br
 
454
      int \fIscreen_number\fP\^;
 
455
.FN
 
456
.IP \fIdisplay\fP 1i
 
457
Specifies the connection to the X server.
 
458
.IP \fIscreen_number\fP 1i
 
459
Specifies the appropriate screen number on the host server.
 
460
.LP
 
461
.eM
 
462
.IN "DefaultGC" "" "@DEF@"
 
463
.IN "XDefaultGC" "" "@DEF@"
 
464
Both return the default graphics context for the root window of the 
 
465
specified screen.
 
466
This GC is created for the convenience of simple applications
 
467
and contains the default GC components with the foreground and
 
468
background pixel values initialized to the black and white
 
469
pixels for the screen, respectively.
 
470
You can modify its contents freely because it is not used in any Xlib
 
471
function.
 
472
This GC should never be freed.
 
473
.LP
 
474
.sp
 
475
.sM
 
476
.FD 0
 
477
DefaultRootWindow\^(\^\fIdisplay\fP\^)
 
478
.sp
 
479
Window XDefaultRootWindow\^(\^\fIdisplay\fP\^)
 
480
.br
 
481
      Display *\fIdisplay\fP\^;
 
482
.FN
 
483
.IP \fIdisplay\fP 1i
 
484
Specifies the connection to the X server.
 
485
.LP
 
486
.eM
 
487
.IN "DefaultRootWindow" "" "@DEF@"
 
488
.IN "XDefaultRootWindow" "" "@DEF@"
 
489
Both return the root window for the default screen.
 
490
.LP
 
491
.sp
 
492
.sM
 
493
.FD 0
 
494
DefaultScreenOfDisplay\^(\^\fIdisplay\fP\^)
 
495
.sp
 
496
Screen *XDefaultScreenOfDisplay\^(\^\fIdisplay\fP\^)
 
497
.br
 
498
      Display *\fIdisplay\fP\^;
 
499
.FN
 
500
.IP \fIdisplay\fP 1i
 
501
Specifies the connection to the X server.
 
502
.LP
 
503
.eM
 
504
.IN "DefaultScreenOfDisplay" "" "@DEF@"
 
505
.IN "XDefaultScreenOfDisplay" "" "@DEF@"
 
506
Both return a pointer to the default screen.
 
507
.LP
 
508
.sp
 
509
.sM
 
510
.FD 0
 
511
ScreenOfDisplay\^(\^\fIdisplay\fP, \fIscreen_number\fP\^)
 
512
.sp
 
513
Screen *XScreenOfDisplay\^(\^\fIdisplay\fP, \fIscreen_number\fP\^)
 
514
.br
 
515
      Display *\fIdisplay\fP\^;
 
516
.br
 
517
      int \fIscreen_number\fP\^;
 
518
.FN
 
519
.IP \fIdisplay\fP 1i
 
520
Specifies the connection to the X server.
 
521
.IP \fIscreen_number\fP 1i
 
522
Specifies the appropriate screen number on the host server.
 
523
.LP
 
524
.eM
 
525
.IN "ScreenOfDisplay" "" "@DEF@"
 
526
.IN "XScreenOfDisplay" "" "@DEF@"
 
527
Both return a pointer to the indicated screen.
 
528
.LP
 
529
.sp
 
530
.sM
 
531
.FD 0
 
532
DefaultScreen\^(\^\fIdisplay\fP\^)
 
533
.sp
 
534
int XDefaultScreen\^(\^\fIdisplay\fP\^)
 
535
.br
 
536
      Display *\fIdisplay\fP\^;
 
537
.FN
 
538
.IP \fIdisplay\fP 1i
 
539
Specifies the connection to the X server.
 
540
.LP
 
541
.eM
 
542
.IN "DefaultScreen" "" "@DEF@"
 
543
.IN "XDefaultScreen" "" "@DEF@"
 
544
Both return the default screen number referenced by the 
 
545
.PN XOpenDisplay
 
546
function. 
 
547
This macro or function should be used to retrieve the screen number 
 
548
in applications that will use only a single screen.
 
549
.LP
 
550
.sp
 
551
.sM
 
552
.FD 0
 
553
DefaultVisual\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
554
.sp
 
555
Visual *XDefaultVisual\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
556
.br
 
557
      Display *\fIdisplay\fP\^;
 
558
.br
 
559
      int \fIscreen_number\fP\^;
 
560
.FN
 
561
.IP \fIdisplay\fP 1i
 
562
Specifies the connection to the X server.
 
563
.IP \fIscreen_number\fP 1i
 
564
Specifies the appropriate screen number on the host server.
 
565
.LP
 
566
.eM
 
567
.IN "DefaultVisual" "" "@DEF@"
 
568
.IN "XDefaultVisual" "" "@DEF@"
 
569
Both return the default visual type for the specified screen.
 
570
For further information about visual types,
 
571
see section 3.1.
 
572
.LP
 
573
.sp
 
574
.sM
 
575
.FD 0
 
576
DisplayCells\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
577
.sp
 
578
int XDisplayCells\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
579
.br
 
580
      Display *\fIdisplay\fP\^;
 
581
.br
 
582
      int \fIscreen_number\fP\^;
 
583
.FN
 
584
.IP \fIdisplay\fP 1i
 
585
Specifies the connection to the X server.
 
586
.IP \fIscreen_number\fP 1i
 
587
Specifies the appropriate screen number on the host server.
 
588
.LP
 
589
.eM
 
590
.IN "DisplayCells" "" "@DEF@"
 
591
.IN "XDisplayCells" "" "@DEF@"
 
592
Both return the number of entries in the default colormap.
 
593
.LP
 
594
.sp
 
595
.sM
 
596
.FD 0
 
597
DisplayPlanes\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
598
.sp
 
599
int XDisplayPlanes\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
600
.br
 
601
      Display *\fIdisplay\fP\^;
 
602
.br
 
603
      int \fIscreen_number\fP\^;
 
604
.FN
 
605
.IP \fIdisplay\fP 1i
 
606
Specifies the connection to the X server.
 
607
.IP \fIscreen_number\fP 1i
 
608
Specifies the appropriate screen number on the host server.
 
609
.LP
 
610
.eM
 
611
.IN "DisplayPlanes" "" "@DEF@"
 
612
.IN "XDisplayPlanes" "" "@DEF@"
 
613
Both return the depth of the root window of the specified screen.
 
614
For an explanation of depth,
 
615
see the glossary.
 
616
.LP
 
617
.sp
 
618
.sM
 
619
.FD 0
 
620
DisplayString\^(\^\fIdisplay\fP\^)
 
621
.sp
 
622
char *XDisplayString\^(\^\fIdisplay\fP\^)
 
623
.br
 
624
      Display *\fIdisplay\fP\^;
 
625
.FN
 
626
.IP \fIdisplay\fP 1i
 
627
Specifies the connection to the X server.
 
628
.LP
 
629
.eM
 
630
.IN "DisplayString" "" "@DEF@"
 
631
.IN "XDisplayString" "" "@DEF@"
 
632
Both return the string that was passed to 
 
633
.PN XOpenDisplay
 
634
when the current display was opened. 
 
635
On POSIX-conformant systems, 
 
636
if the passed string was NULL, these return the value of
 
637
the DISPLAY environment variable when the current display was opened.
 
638
.IN "POSIX System Call" "fork"
 
639
These are useful to applications that invoke the 
 
640
.PN fork
 
641
system call and want to open a new connection to the same display from the 
 
642
child process as well as for printing error messages.
 
643
.LP
 
644
.sp
 
645
.sM
 
646
.FD 0
 
647
long XExtendedMaxRequestSize(\^\fIdisplay\fP\^)
 
648
        Display *\fIdisplay\fP\^;
 
649
.FN
 
650
.IP \fIdisplay\fP 1i
 
651
Specifies the connection to the X server.
 
652
.LP
 
653
.eM
 
654
.IN "XExtendedMaxRequestSize" "" "@DEF@"
 
655
The
 
656
.PN XExtendedMaxRequestSize
 
657
function returns zero if the specified display does not support an
 
658
extended-length protocol encoding; otherwise,
 
659
it returns the maximum request size (in 4-byte units) supported
 
660
by the server using the extended-length encoding.
 
661
The Xlib functions
 
662
.PN XDrawLines ,
 
663
.PN XDrawArcs ,
 
664
.PN XFillPolygon ,
 
665
.PN XChangeProperty ,
 
666
.PN XSetClipRectangles ,
 
667
and
 
668
.PN XSetRegion
 
669
will use the extended-length encoding as necessary, if supported
 
670
by the server.  Use of the extended-length encoding in other Xlib
 
671
functions (for example,
 
672
.PN XDrawPoints ,
 
673
.PN XDrawRectangles ,
 
674
.PN XDrawSegments ,
 
675
.PN XFillArcs ,
 
676
.PN XFillRectangles ,
 
677
.PN XPutImage )
 
678
is permitted but not required; an Xlib implementation may choose to
 
679
split the data across multiple smaller requests instead.
 
680
.LP
 
681
.sp
 
682
.sM
 
683
.FD 0
 
684
long XMaxRequestSize(\^\fIdisplay\fP\^)
 
685
        Display *\fIdisplay\fP\^;
 
686
.FN
 
687
.IP \fIdisplay\fP 1i
 
688
Specifies the connection to the X server.
 
689
.LP
 
690
.eM
 
691
.IN "XMaxRequestSize" "" "@DEF@"
 
692
The
 
693
.PN XMaxRequestSize
 
694
function returns the maximum request size (in 4-byte units) supported
 
695
by the server without using an extended-length protocol encoding.
 
696
Single protocol requests to the server can be no larger than this size
 
697
unless an extended-length protocol encoding is supported by the server.
 
698
The protocol guarantees the size to be no smaller than 4096 units
 
699
(16384 bytes).
 
700
Xlib automatically breaks data up into multiple protocol requests
 
701
as necessary for the following functions:
 
702
.PN XDrawPoints ,
 
703
.PN XDrawRectangles ,
 
704
.PN XDrawSegments ,
 
705
.PN XFillArcs ,
 
706
.PN XFillRectangles ,
 
707
and 
 
708
.PN XPutImage .
 
709
.LP
 
710
.sp
 
711
.sM
 
712
.FD 0
 
713
LastKnownRequestProcessed\^(\^\fIdisplay\fP\^)
 
714
.sp
 
715
unsigned long XLastKnownRequestProcessed\^(\^\fIdisplay\fP\^)
 
716
.br
 
717
     Display *\fIdisplay\fP\^;
 
718
.FN
 
719
.IP \fIdisplay\fP 1i
 
720
Specifies the connection to the X server.
 
721
.LP
 
722
.eM
 
723
.IN "LastKnownRequestProcessed" "" "@DEF@"
 
724
.IN "XLastKnownRequestProcessed" "" "@DEF@"
 
725
Both extract the full serial number of the last request known by Xlib
 
726
to have been processed by the X server.
 
727
Xlib automatically sets this number when replies, events, and errors
 
728
are received.
 
729
.LP
 
730
.sp
 
731
.sM
 
732
.FD 0
 
733
NextRequest\^(\^\fIdisplay\fP\^)
 
734
.sp
 
735
unsigned long XNextRequest\^(\^\fIdisplay\fP\^)
 
736
.br
 
737
     Display *\fIdisplay\fP\^;
 
738
.FN
 
739
.IP \fIdisplay\fP 1i
 
740
Specifies the connection to the X server.
 
741
.LP
 
742
.eM
 
743
.IN "NextRequest" "" "@DEF@"
 
744
.IN "XNextRequest" "" "@DEF@"
 
745
Both extract the full serial number that is to be used for the next
 
746
request.
 
747
Serial numbers are maintained separately for each display connection.
 
748
.LP
 
749
.sp
 
750
.sM
 
751
.FD 0
 
752
ProtocolVersion\^(\^\fIdisplay\fP\^)
 
753
.sp
 
754
int XProtocolVersion\^(\^\fIdisplay\fP\^)
 
755
.br
 
756
      Display *\fIdisplay\fP\^;
 
757
.FN
 
758
.IP \fIdisplay\fP 1i
 
759
Specifies the connection to the X server.
 
760
.LP
 
761
.eM
 
762
.IN "ProtocolVersion" "" "@DEF@"
 
763
.IN "XProtocolVersion" "" "@DEF@"
 
764
Both return the major version number (11) of the X protocol associated with 
 
765
the connected display.
 
766
.LP
 
767
.sp
 
768
.sM
 
769
.FD 0
 
770
ProtocolRevision\^(\^\fIdisplay\fP\^)
 
771
.sp
 
772
int XProtocolRevision\^(\^\fIdisplay\fP\^)
 
773
.br
 
774
      Display *\fIdisplay\fP\^;
 
775
.FN
 
776
.IP \fIdisplay\fP 1i
 
777
Specifies the connection to the X server.
 
778
.LP
 
779
.eM
 
780
.IN "ProtocolRevision" "" "@DEF@"
 
781
.IN "XProtocolRevision" "" "@DEF@"
 
782
Both return the minor protocol revision number of the X server.
 
783
.LP
 
784
.sp
 
785
.sM
 
786
.FD 0
 
787
QLength\^(\^\fIdisplay\fP\^)
 
788
.sp
 
789
int XQLength\^(\^\fIdisplay\fP\^)
 
790
.br
 
791
      Display *\fIdisplay\fP\^;
 
792
.FN
 
793
.IP \fIdisplay\fP 1i
 
794
Specifies the connection to the X server.
 
795
.LP
 
796
.eM
 
797
.IN "QLength" "" "@DEF@"
 
798
.IN "XQLength" "" "@DEF@"
 
799
Both return the length of the event queue for the connected display.
 
800
Note that there may be more events that have not been read into
 
801
the queue yet (see
 
802
.PN XEventsQueued ).
 
803
.LP
 
804
.sp
 
805
.sM
 
806
.FD 0
 
807
RootWindow\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
808
.sp
 
809
Window XRootWindow\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
810
.br
 
811
      Display *\fIdisplay\fP\^;
 
812
.br
 
813
      int \fIscreen_number\fP\^;
 
814
.FN
 
815
.IP \fIdisplay\fP 1i
 
816
Specifies the connection to the X server.
 
817
.IP \fIscreen_number\fP 1i
 
818
Specifies the appropriate screen number on the host server.
 
819
.LP
 
820
.eM
 
821
.IN "Window" "RootWindow"
 
822
.IN "RootWindow" "" "@DEF@"
 
823
.IN "Window" "XRootWindow"
 
824
.IN "XRootWindow" "" "@DEF@"
 
825
Both return the root window.
 
826
These are useful with functions that need a drawable of a particular screen
 
827
and for creating top-level windows.
 
828
.LP
 
829
.sp
 
830
.sM
 
831
.FD 0
 
832
ScreenCount\^(\^\fIdisplay\fP\^)
 
833
.sp
 
834
int XScreenCount\^(\^\fIdisplay\fP\^)
 
835
.br
 
836
      Display *\fIdisplay\fP\^;
 
837
.FN
 
838
.IP \fIdisplay\fP 1i
 
839
Specifies the connection to the X server.
 
840
.LP
 
841
.eM
 
842
.IN "ScreenCount" "" "@DEF@"
 
843
.IN "XScreenCount" "" "@DEF@"
 
844
Both return the number of available screens.
 
845
.LP
 
846
.sp
 
847
.sM
 
848
.FD 0
 
849
ServerVendor\^(\^\fIdisplay\fP\^)
 
850
.sp
 
851
char *XServerVendor\^(\^\fIdisplay\fP\^)
 
852
.br
 
853
      Display *\fIdisplay\fP\^;
 
854
.FN
 
855
.IP \fIdisplay\fP 1i
 
856
Specifies the connection to the X server.
 
857
.LP
 
858
.eM
 
859
.IN "ServerVendor" "" "@DEF@"
 
860
.IN "XServerVendor" "" "@DEF@"
 
861
Both return a pointer to a null-terminated string that provides
 
862
some identification of the owner of the X server implementation.
 
863
If the data returned by the server is in the Latin Portable Character Encoding,
 
864
then the string is in the Host Portable Character Encoding.
 
865
Otherwise, the contents of the string are implementation-dependent.
 
866
.LP
 
867
.sp
 
868
.sM
 
869
.FD 0
 
870
VendorRelease\^(\^\fIdisplay\fP\^)
 
871
.sp
 
872
int XVendorRelease\^(\^\fIdisplay\fP\^)
 
873
.br
 
874
      Display *\fIdisplay\fP\^;
 
875
.FN
 
876
.IP \fIdisplay\fP 1i
 
877
Specifies the connection to the X server.
 
878
.LP
 
879
.eM
 
880
.IN "VendorRelease" "" "@DEF@"
 
881
.IN "XVendorRelease" "" "@DEF@"
 
882
Both return a number related to a vendor's release of the X server.
 
883
.NH 3
 
884
Image Format Functions and Macros
 
885
.XS
 
886
\*(SN Image Format Functions and Macros
 
887
.XE
 
888
.LP
 
889
Applications are required to present data to the X server
 
890
in a format that the server demands.
 
891
To help simplify applications,
 
892
most of the work required to convert the data is provided by Xlib
 
893
(see sections 8.7 and 16.8).
 
894
.LP
 
895
The
 
896
.PN XPixmapFormatValues
 
897
structure provides an interface to the pixmap format information
 
898
that is returned at the time of a connection setup.
 
899
It contains:
 
900
.LP
 
901
.sM
 
902
.Ds 0
 
903
.TA .5i 3i
 
904
.ta .5i 3i
 
905
typedef struct {
 
906
        int depth;
 
907
        int bits_per_pixel;
 
908
        int scanline_pad;
 
909
} XPixmapFormatValues;
 
910
.De
 
911
.LP
 
912
.eM
 
913
.sp
 
914
To obtain the pixmap format information for a given display, use
 
915
.PN XListPixmapFormats .
 
916
.IN "XListPixmapFormats" "" "@DEF@"
 
917
.sM
 
918
.FD 0
 
919
XPixmapFormatValues *XListPixmapFormats\^(\^\fIdisplay\fP, \fIcount_return\fP\^)
 
920
.br
 
921
      Display *\fIdisplay\fP\^;
 
922
.br
 
923
      int *\fIcount_return\fP\^;
 
924
.FN
 
925
.IP \fIdisplay\fP 1i
 
926
Specifies the connection to the X server.
 
927
.ds Cn pixmap formats that are supported by the display
 
928
.IP \fIcount_return\fP 1i
 
929
Returns the number of \*(Cn.
 
930
.LP
 
931
.eM
 
932
The
 
933
.PN XListPixmapFormats
 
934
function returns an array of
 
935
.PN XPixmapFormatValues
 
936
structures that describe the types of Z format images supported
 
937
by the specified display.
 
938
If insufficient memory is available,
 
939
.PN XListPixmapFormats
 
940
returns NULL.
 
941
To free the allocated storage for the
 
942
.PN XPixmapFormatValues
 
943
structures, use
 
944
.PN XFree .
 
945
.LP 
 
946
The following lists the C language macros,
 
947
their corresponding function equivalents that are for other language bindings,
 
948
and what data they both return for the specified server and screen.
 
949
These are often used by toolkits as well as by simple applications.
 
950
.LP
 
951
.sp
 
952
.sM
 
953
.FD 0
 
954
ImageByteOrder\^(\^\fIdisplay\fP\^)
 
955
.sp
 
956
int XImageByteOrder\^(\^\fIdisplay\fP\^)
 
957
.br
 
958
      Display *\fIdisplay\fP\^;
 
959
.FN
 
960
.IP \fIdisplay\fP 1i
 
961
Specifies the connection to the X server.
 
962
.LP
 
963
.eM
 
964
.IN "ImageByteOrder" "" "@DEF@"
 
965
.IN "XImageByteOrder" "" "@DEF@"
 
966
Both specify the required byte order for images for each scanline unit in 
 
967
XY format (bitmap) or for each pixel value in 
 
968
Z format.
 
969
The macro or function can return either
 
970
.PN LSBFirst 
 
971
or 
 
972
.PN MSBFirst .
 
973
.LP
 
974
.sp
 
975
.sM
 
976
.FD 0
 
977
BitmapUnit\^(\^\fIdisplay\fP\^)
 
978
.sp
 
979
int XBitmapUnit\^(\^\fIdisplay\fP\^)
 
980
.br
 
981
      Display *\fIdisplay\fP\^;
 
982
.FN
 
983
.IP \fIdisplay\fP 1i
 
984
Specifies the connection to the X server.
 
985
.LP
 
986
.eM
 
987
.IN "BitmapUnit" "" "@DEF@"
 
988
.IN "XBitmapUnit" "" "@DEF@"
 
989
Both return the size of a bitmap's scanline unit in bits.
 
990
The scanline is calculated in multiples of this value.
 
991
.LP
 
992
.sp
 
993
.sM
 
994
.FD 0
 
995
BitmapBitOrder\^(\^\fIdisplay\fP\^)
 
996
.sp
 
997
int XBitmapBitOrder\^(\^\fIdisplay\fP\^)
 
998
.br
 
999
      Display *\fIdisplay\fP\^;
 
1000
.FN
 
1001
.IP \fIdisplay\fP 1i
 
1002
Specifies the connection to the X server.
 
1003
.LP
 
1004
.eM
 
1005
.IN "BitmapBitOrder" "" "@DEF@"
 
1006
.IN "XBitmapBitOrder" "" "@DEF@"
 
1007
Within each bitmap unit, the left-most bit in the bitmap as displayed
 
1008
on the screen is either the least significant or most significant bit in the
 
1009
unit.
 
1010
This macro or function can return 
 
1011
.PN LSBFirst
 
1012
or 
 
1013
.PN MSBFirst .
 
1014
.LP
 
1015
.sp
 
1016
.sM
 
1017
.FD 0
 
1018
BitmapPad\^(\^\fIdisplay\fP\^)
 
1019
.sp
 
1020
int XBitmapPad\^(\^\fIdisplay\fP\^)
 
1021
.br
 
1022
      Display *\fIdisplay\fP\^;
 
1023
.FN
 
1024
.IP \fIdisplay\fP 1i
 
1025
Specifies the connection to the X server.
 
1026
.LP
 
1027
.eM
 
1028
.IN "BitmapPad" "" "@DEF@"
 
1029
.IN "XBitmapPad" "" "@DEF@"
 
1030
Each scanline must be padded to a multiple of bits returned
 
1031
by this macro or function.
 
1032
.LP
 
1033
.sp
 
1034
.sM
 
1035
.FD 0
 
1036
DisplayHeight\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1037
.sp
 
1038
int XDisplayHeight\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1039
.br
 
1040
      Display *\fIdisplay\fP\^;
 
1041
.br
 
1042
      int \fIscreen_number\fP\^;
 
1043
.FN
 
1044
.IP \fIdisplay\fP 1i
 
1045
Specifies the connection to the X server.
 
1046
.IP \fIscreen_number\fP 1i
 
1047
Specifies the appropriate screen number on the host server.
 
1048
.LP
 
1049
.eM
 
1050
.IN "DisplayHeight" "" "@DEF@"
 
1051
.IN "XDisplayHeight" "" "@DEF@"
 
1052
Both return an integer that describes the height of the screen
 
1053
in pixels.
 
1054
.LP
 
1055
.sp
 
1056
.sM
 
1057
.FD 0
 
1058
DisplayHeightMM\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1059
.sp
 
1060
int XDisplayHeightMM\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1061
.br
 
1062
      Display *\fIdisplay\fP\^;
 
1063
.br
 
1064
      int \fIscreen_number\fP\^;
 
1065
.FN
 
1066
.IP \fIdisplay\fP 1i
 
1067
Specifies the connection to the X server.
 
1068
.IP \fIscreen_number\fP 1i
 
1069
Specifies the appropriate screen number on the host server.
 
1070
.LP
 
1071
.eM
 
1072
.IN "DisplayHeightMM" "" "@DEF@"
 
1073
.IN "XDisplayHeightMM" "" "@DEF@"
 
1074
Both return the height of the specified screen in millimeters.
 
1075
.LP
 
1076
.sp
 
1077
.sM
 
1078
.FD 0
 
1079
DisplayWidth\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1080
.sp
 
1081
int XDisplayWidth\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1082
.br
 
1083
      Display *\fIdisplay\fP\^;
 
1084
.br
 
1085
      int \fIscreen_number\fP\^;
 
1086
.FN
 
1087
.IP \fIdisplay\fP 1i
 
1088
Specifies the connection to the X server.
 
1089
.IP \fIscreen_number\fP 1i
 
1090
Specifies the appropriate screen number on the host server.
 
1091
.LP
 
1092
.eM
 
1093
.IN "DisplayWidth" "" "@DEF@"
 
1094
.IN "XDisplayWidth" "" "@DEF@"
 
1095
Both return the width of the screen in pixels.
 
1096
.LP
 
1097
.sp
 
1098
.sM
 
1099
.FD 0
 
1100
DisplayWidthMM\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1101
.sp
 
1102
int XDisplayWidthMM\^(\^\fIdisplay\fP\^, \^\fIscreen_number\fP\^)
 
1103
.br
 
1104
      Display *\fIdisplay\fP\^;
 
1105
.br
 
1106
      int \fIscreen_number\fP\^;
 
1107
.FN
 
1108
.IP \fIdisplay\fP 1i
 
1109
Specifies the connection to the X server.
 
1110
.IP \fIscreen_number\fP 1i
 
1111
Specifies the appropriate screen number on the host server.
 
1112
.LP
 
1113
.eM
 
1114
.IN "DisplayWidthMM" "" "@DEF@"
 
1115
.IN "XDisplayWidthMM" "" "@DEF@"
 
1116
Both return the width of the specified screen in millimeters.
 
1117
.NH 3
 
1118
Screen Information Macros
 
1119
.XS
 
1120
\*(SN Screen Information Macros
 
1121
.XE
 
1122
.LP
 
1123
The following lists the C language macros,
 
1124
their corresponding function equivalents that are for other language bindings,
 
1125
and what data they both can return.
 
1126
These macros or functions all take a pointer to the appropriate screen
 
1127
structure.
 
1128
.LP
 
1129
.sp
 
1130
.sM
 
1131
.FD 0
 
1132
BlackPixelOfScreen\^(\^\fIscreen\fP\^)
 
1133
.sp
 
1134
unsigned long XBlackPixelOfScreen\^(\^\fIscreen\fP\^)
 
1135
.br
 
1136
      Screen *\fIscreen\fP\^;
 
1137
.FN
 
1138
.IP \fIscreen\fP 1i
 
1139
Specifies the appropriate 
 
1140
.PN Screen
 
1141
structure.
 
1142
.LP
 
1143
.eM
 
1144
.IN "BlackPixelOfScreen" "" "@DEF@"
 
1145
.IN "XBlackPixelOfScreen" "" "@DEF@"
 
1146
Both return the black pixel value of the specified screen.
 
1147
.LP
 
1148
.sp
 
1149
.sM
 
1150
.FD 0
 
1151
WhitePixelOfScreen\^(\^\fIscreen\fP\^)
 
1152
.sp
 
1153
unsigned long XWhitePixelOfScreen\^(\^\fIscreen\fP\^)
 
1154
.br
 
1155
      Screen *\fIscreen\fP\^;
 
1156
.FN
 
1157
.IP \fIscreen\fP 1i
 
1158
Specifies the appropriate 
 
1159
.PN Screen
 
1160
structure.
 
1161
.LP
 
1162
.eM
 
1163
.IN "WhitePixelOfScreen" "" "@DEF@"
 
1164
.IN "XWhitePixelOfScreen" "" "@DEF@"
 
1165
Both return the white pixel value of the specified screen.
 
1166
.LP
 
1167
.sp
 
1168
.sM
 
1169
.FD 0
 
1170
CellsOfScreen\^(\^\fIscreen\fP\^)
 
1171
.sp
 
1172
int XCellsOfScreen\^(\^\fIscreen\fP\^)
 
1173
.br
 
1174
      Screen *\fIscreen\fP\^;
 
1175
.FN
 
1176
.IP \fIscreen\fP 1i
 
1177
Specifies the appropriate 
 
1178
.PN Screen
 
1179
structure.
 
1180
.LP
 
1181
.eM
 
1182
.IN "CellsOfScreen" "" "@DEF@"
 
1183
.IN "XCellsOfScreen" "" "@DEF@"
 
1184
Both return the number of colormap cells in the default colormap 
 
1185
of the specified screen.
 
1186
.LP
 
1187
.sp
 
1188
.sM
 
1189
.FD 0
 
1190
DefaultColormapOfScreen\^(\^\fIscreen\fP\^)
 
1191
.sp
 
1192
Colormap XDefaultColormapOfScreen\^(\^\fIscreen\fP\^)
 
1193
.br
 
1194
      Screen *\fIscreen\fP\^;
 
1195
.FN
 
1196
.IP \fIscreen\fP 1i
 
1197
Specifies the appropriate 
 
1198
.PN Screen
 
1199
structure.
 
1200
.LP
 
1201
.eM
 
1202
.IN "DefaultColormapOfScreen" "" "@DEF@"
 
1203
.IN "XDefaultColormapOfScreen" "" "@DEF@"
 
1204
Both return the default colormap of the specified screen.
 
1205
.LP
 
1206
.sp
 
1207
.sM
 
1208
.FD 0
 
1209
DefaultDepthOfScreen\^(\^\fIscreen\fP\^)
 
1210
.sp 
 
1211
int XDefaultDepthOfScreen\^(\^\fIscreen\fP\^)
 
1212
.br
 
1213
      Screen *\fIscreen\fP\^;
 
1214
.FN
 
1215
.IP \fIscreen\fP 1i
 
1216
Specifies the appropriate 
 
1217
.PN Screen
 
1218
structure.
 
1219
.LP
 
1220
.eM
 
1221
.IN "DefaultDepthOfScreen" "" "@DEF@"
 
1222
.IN "XDefaultDepthOfScreen" "" "@DEF@"
 
1223
Both return the depth of the root window.
 
1224
.LP
 
1225
.sp
 
1226
.sM
 
1227
.FD 0
 
1228
DefaultGCOfScreen\^(\^\fIscreen\fP\^)
 
1229
.sp
 
1230
GC XDefaultGCOfScreen\^(\^\fIscreen\fP\^)
 
1231
.br
 
1232
      Screen *\fIscreen\fP\^;
 
1233
.FN
 
1234
.IP \fIscreen\fP 1i
 
1235
Specifies the appropriate 
 
1236
.PN Screen
 
1237
structure.
 
1238
.LP
 
1239
.eM
 
1240
.IN "DefaultGCOfScreen" "" "@DEF@"
 
1241
.IN "XDefaultGCOfScreen" "" "@DEF@"
 
1242
Both return a default graphics context (GC) of the specified screen,
 
1243
which has the same depth as the root window of the screen.
 
1244
The GC must never be freed.
 
1245
.LP
 
1246
.sp
 
1247
.sM
 
1248
.FD 0
 
1249
DefaultVisualOfScreen\^(\^\fIscreen\fP\^)
 
1250
.sp
 
1251
Visual *XDefaultVisualOfScreen\^(\^\fIscreen\fP\^)
 
1252
.br
 
1253
      Screen *\fIscreen\fP\^;
 
1254
.FN
 
1255
.IP \fIscreen\fP 1i
 
1256
Specifies the appropriate 
 
1257
.PN Screen
 
1258
structure.
 
1259
.LP
 
1260
.eM
 
1261
.IN "DefaultVisualOfScreen" "" "@DEF@"
 
1262
.IN "XDefaultVisualOfScreen" "" "@DEF@"
 
1263
Both return the default visual of the specified screen.
 
1264
For information on visual types,
 
1265
see section 3.1.
 
1266
.LP
 
1267
.sp
 
1268
.sM
 
1269
.FD 0
 
1270
DoesBackingStore\^(\^\fIscreen\fP\^)
 
1271
.sp
 
1272
int XDoesBackingStore\^(\^\fIscreen\fP\^)
 
1273
.br
 
1274
      Screen *\fIscreen\fP\^;
 
1275
.FN
 
1276
.IP \fIscreen\fP 1i
 
1277
Specifies the appropriate 
 
1278
.PN Screen
 
1279
structure.
 
1280
.LP
 
1281
.eM
 
1282
.IN "DoesBackingStore" "" "@DEF@"
 
1283
.IN "XDoesBackingStore" "" "@DEF@"
 
1284
Both return a value indicating whether the screen supports backing
 
1285
stores.
 
1286
The value returned can be one of 
 
1287
.PN WhenMapped ,
 
1288
.PN NotUseful ,
 
1289
or
 
1290
.PN Always 
 
1291
(see section 3.2.4).
 
1292
.LP
 
1293
.sp
 
1294
.sM
 
1295
.FD 0
 
1296
DoesSaveUnders\^(\^\fIscreen\fP\^)
 
1297
.sp
 
1298
Bool XDoesSaveUnders\^(\^\fIscreen\fP\^)
 
1299
.br
 
1300
      Screen *\fIscreen\fP\^;
 
1301
.FN
 
1302
.IP \fIscreen\fP 1i
 
1303
Specifies the appropriate 
 
1304
.PN Screen
 
1305
structure.
 
1306
.LP
 
1307
.eM
 
1308
.IN "DoesSaveUnders" "" "@DEF@"
 
1309
.IN "XDoesSaveUnders" "" "@DEF@"
 
1310
Both return a Boolean value indicating whether the
 
1311
screen supports save unders.
 
1312
If
 
1313
.PN True ,
 
1314
the screen supports save unders.
 
1315
If
 
1316
.PN False ,
 
1317
the screen does not support save unders (see section 3.2.5).
 
1318
.LP
 
1319
.sp
 
1320
.sM
 
1321
.FD 0
 
1322
DisplayOfScreen\^(\^\fIscreen\fP\^)
 
1323
.sp
 
1324
Display *XDisplayOfScreen\^(\^\fIscreen\fP\^)
 
1325
.br
 
1326
      Screen *\fIscreen\fP\^;
 
1327
.FN
 
1328
.IP \fIscreen\fP 1i
 
1329
Specifies the appropriate 
 
1330
.PN Screen
 
1331
structure.
 
1332
.LP
 
1333
.eM
 
1334
.IN "DisplayOfScreen" "" "@DEF@"
 
1335
.IN "XDisplayOfScreen" "" "@DEF@"
 
1336
Both return the display of the specified screen.
 
1337
.LP
 
1338
.sp
 
1339
.sM
 
1340
.IN "XScreenNumberOfScreen" "" "@DEF@"
 
1341
.FD 0
 
1342
int XScreenNumberOfScreen\^(\^\fIscreen\fP\^)
 
1343
.br
 
1344
      Screen *\fIscreen\fP\^;
 
1345
.FN
 
1346
.IP \fIscreen\fP 1i
 
1347
Specifies the appropriate 
 
1348
.PN Screen
 
1349
structure.
 
1350
.LP
 
1351
.eM
 
1352
The
 
1353
.PN XScreenNumberOfScreen
 
1354
function returns the screen index number of the specified screen.
 
1355
.LP
 
1356
.sp
 
1357
.sM
 
1358
.FD 0
 
1359
EventMaskOfScreen\^(\^\fIscreen\fP\^)
 
1360
.sp
 
1361
long XEventMaskOfScreen\^(\^\fIscreen\fP\^)
 
1362
.br
 
1363
      Screen *\fIscreen\fP\^;
 
1364
.FN
 
1365
.IP \fIscreen\fP 1i
 
1366
Specifies the appropriate 
 
1367
.PN Screen
 
1368
structure.
 
1369
.LP
 
1370
.eM
 
1371
.IN "EventMaskOfScreen" "" "@DEF@"
 
1372
.IN "XEventMaskOfScreen" "" "@DEF@"
 
1373
Both return the event mask of the root window for the specified screen
 
1374
at connection setup time.
 
1375
.LP
 
1376
.sp
 
1377
.sM
 
1378
.FD 0
 
1379
WidthOfScreen\^(\^\fIscreen\fP\^)
 
1380
.sp
 
1381
int XWidthOfScreen\^(\^\fIscreen\fP\^)
 
1382
.br
 
1383
      Screen *\fIscreen\fP\^;
 
1384
.FN
 
1385
.IP \fIscreen\fP 1i
 
1386
Specifies the appropriate 
 
1387
.PN Screen
 
1388
structure.
 
1389
.LP
 
1390
.eM
 
1391
.IN "WidthOfScreen" "" "@DEF@"
 
1392
.IN "XWidthOfScreen" "" "@DEF@"
 
1393
Both return the width of the specified screen in pixels.
 
1394
.LP
 
1395
.sp
 
1396
.sM
 
1397
.FD 0
 
1398
HeightOfScreen\^(\^\fIscreen\fP\^)
 
1399
.sp
 
1400
int XHeightOfScreen\^(\^\fIscreen\fP\^)
 
1401
.br
 
1402
      Screen *\fIscreen\fP\^;
 
1403
.FN
 
1404
.IP \fIscreen\fP 1i
 
1405
Specifies the appropriate 
 
1406
.PN Screen
 
1407
structure.
 
1408
.LP
 
1409
.eM
 
1410
.IN "HeightOfScreen" "" "@DEF@"
 
1411
.IN "XHeightOfScreen" "" "@DEF@"
 
1412
Both return the height of the specified screen in pixels.
 
1413
.LP
 
1414
.sp
 
1415
.sM
 
1416
.FD 0
 
1417
WidthMMOfScreen\^(\^\fIscreen\fP\^)
 
1418
.sp
 
1419
int XWidthMMOfScreen\^(\^\fIscreen\fP\^)
 
1420
.br
 
1421
      Screen *\fIscreen\fP\^;
 
1422
.FN
 
1423
.IP \fIscreen\fP 1i
 
1424
Specifies the appropriate 
 
1425
.PN Screen
 
1426
structure.
 
1427
.LP
 
1428
.eM
 
1429
.IN "WidthMMOfScreen" "" "@DEF@"
 
1430
.IN "XWidthMMOfScreen" "" "@DEF@"
 
1431
Both return the width of the specified screen in millimeters.
 
1432
.LP
 
1433
.sp
 
1434
.sM
 
1435
.FD 0
 
1436
HeightMMOfScreen\^(\^\fIscreen\fP\^)
 
1437
.sp
 
1438
int XHeightMMOfScreen\^(\^\fIscreen\fP\^)
 
1439
.br
 
1440
      Screen *\fIscreen\fP\^;
 
1441
.FN
 
1442
.IP \fIscreen\fP 1i
 
1443
Specifies the appropriate 
 
1444
.PN Screen
 
1445
structure.
 
1446
.LP
 
1447
.eM
 
1448
.IN "HeightMMOfScreen" "" "@DEF@"
 
1449
.IN "XHeightMMOfScreen" "" "@DEF@"
 
1450
Both return the height of the specified screen in millimeters.
 
1451
.LP
 
1452
.sp
 
1453
.sM
 
1454
.FD 0
 
1455
MaxCmapsOfScreen\^(\^\fIscreen\fP\^)
 
1456
.sp
 
1457
int XMaxCmapsOfScreen\^(\^\fIscreen\fP\^)
 
1458
.br
 
1459
      Screen *\fIscreen\fP\^;
 
1460
.FN
 
1461
.IP \fIscreen\fP 1i
 
1462
Specifies the appropriate 
 
1463
.PN Screen
 
1464
structure.
 
1465
.LP
 
1466
.eM
 
1467
.IN "MaxCmapsOfScreen" "" "@DEF@"
 
1468
.IN "XMaxCmapsOfScreen" "" "@DEF@"
 
1469
Both return the maximum number of installed colormaps supported 
 
1470
by the specified screen (see section 9.3).
 
1471
.LP
 
1472
.sp
 
1473
.sM
 
1474
.FD 0
 
1475
MinCmapsOfScreen\^(\^\fIscreen\fP\^)
 
1476
.sp
 
1477
int XMinCmapsOfScreen\^(\^\fIscreen\fP\^)
 
1478
.br
 
1479
      Screen *\fIscreen\fP\^;
 
1480
.FN
 
1481
.IP \fIscreen\fP 1i
 
1482
Specifies the appropriate 
 
1483
.PN Screen
 
1484
structure.
 
1485
.LP
 
1486
.eM
 
1487
.IN "MinCmapsOfScreen" "" "@DEF@"
 
1488
.IN "XMinCmapsOfScreen" "" "@DEF@"
 
1489
Both return the minimum number of installed colormaps supported 
 
1490
by the specified screen (see section 9.3).
 
1491
.LP
 
1492
.sp
 
1493
.sM
 
1494
.FD 0
 
1495
PlanesOfScreen\^(\^\fIscreen\fP\^)
 
1496
.sp
 
1497
int XPlanesOfScreen\^(\^\fIscreen\fP\^)
 
1498
.br
 
1499
      Screen *\fIscreen\fP\^;
 
1500
.FN
 
1501
.IP \fIscreen\fP 1i
 
1502
Specifies the appropriate 
 
1503
.PN Screen
 
1504
structure.
 
1505
.LP
 
1506
.eM
 
1507
.IN "PlanesOfScreen" "" "@DEF@"
 
1508
.IN "XPlanesOfScreen" "" "@DEF@"
 
1509
Both return the depth of the root window.
 
1510
.LP
 
1511
.sp
 
1512
.sM
 
1513
.FD 0
 
1514
RootWindowOfScreen\^(\^\fIscreen\fP\^)
 
1515
.sp
 
1516
Window XRootWindowOfScreen\^(\^\fIscreen\fP\^)
 
1517
.br
 
1518
      Screen *\fIscreen\fP\^;
 
1519
.FN
 
1520
.IP \fIscreen\fP 1i
 
1521
Specifies the appropriate 
 
1522
.PN Screen
 
1523
structure.
 
1524
.LP
 
1525
.eM
 
1526
.IN "RootWindowOfScreen" "" "@DEF@"
 
1527
.IN "XRootWindowOfScreen" "" "@DEF@"
 
1528
Both return the root window of the specified screen.
 
1529
.NH 2
 
1530
Generating a NoOperation Protocol Request
 
1531
.XS
 
1532
\*(SN Generating a NoOperation Protocol Request
 
1533
.XE
 
1534
.LP
 
1535
To execute a 
 
1536
.PN NoOperation 
 
1537
protocol request, use
 
1538
.PN XNoOp .
 
1539
.IN "XNoOp" "" "@DEF@"
 
1540
.sM
 
1541
.FD 0
 
1542
XNoOp\^(\^\fIdisplay\fP\^)
 
1543
.br
 
1544
      Display *\fIdisplay\fP\^;
 
1545
.FN
 
1546
.IP \fIdisplay\fP 1i
 
1547
Specifies the connection to the X server.
 
1548
.LP
 
1549
.eM
 
1550
The
 
1551
.PN XNoOp
 
1552
function sends a 
 
1553
.PN NoOperation 
 
1554
protocol request to the X server,
 
1555
thereby exercising the connection.
 
1556
.NH 2
 
1557
Freeing Client-Created Data
 
1558
.XS
 
1559
\*(SN Freeing Client-Created Data
 
1560
.XE
 
1561
.LP
 
1562
To free in-memory data that was created by an Xlib function, use
 
1563
.PN XFree .
 
1564
.IN "XFree" "" "@DEF@"
 
1565
.sM
 
1566
.FD 0
 
1567
XFree\^(\^\fIdata\fP\^)
 
1568
.br
 
1569
     void *\fIdata\fP\^; 
 
1570
.FN
 
1571
.IP \fIdata\fP 1i
 
1572
Specifies the data that is to be freed.
 
1573
.LP
 
1574
.eM
 
1575
The
 
1576
.PN XFree
 
1577
function is a general-purpose Xlib routine that frees the specified data.
 
1578
You must use it to free any objects that were allocated by Xlib,
 
1579
unless an alternate function is explicitly specified for the object.
 
1580
A NULL pointer cannot be passed to this function.
 
1581
.NH 2
 
1582
Closing the Display
 
1583
.XS
 
1584
\*(SN Closing the Display
 
1585
.XE
 
1586
.LP
 
1587
To close a display or disconnect from the X server, use
 
1588
.PN XCloseDisplay .
 
1589
.IN "XCloseDisplay" "" "@DEF@"
 
1590
.LP
 
1591
.sM
 
1592
.FD 0
 
1593
XCloseDisplay\^(\fIdisplay\fP\^)
 
1594
.br
 
1595
      Display *\fIdisplay\fP\^;
 
1596
.FN
 
1597
.IP \fIdisplay\fP 1i
 
1598
Specifies the connection to the X server.
 
1599
.LP
 
1600
.eM
 
1601
The
 
1602
.PN XCloseDisplay
 
1603
function closes the connection to the X server for the display specified in the
 
1604
.PN Display
 
1605
structure and destroys all windows, resource IDs
 
1606
.Pn ( Window ,
 
1607
.PN Font ,
 
1608
.PN Pixmap ,
 
1609
.PN Colormap ,
 
1610
.PN Cursor ,
 
1611
and
 
1612
.PN GContext ),
 
1613
or other resources that the client has created
 
1614
on this display, unless the close-down mode of the resource has been changed
 
1615
(see
 
1616
.PN XSetCloseDownMode ).
 
1617
Therefore, these windows, resource IDs, and other resources should never be 
 
1618
referenced again or an error will be generated.
 
1619
Before exiting, you should call
 
1620
.PN XCloseDisplay
 
1621
explicitly so that any pending errors are reported as
 
1622
.PN XCloseDisplay
 
1623
performs a final
 
1624
.PN XSync
 
1625
operation.
 
1626
.IN "Resource IDs"
 
1627
.IN "XCloseDisplay"
 
1628
.LP
 
1629
.PN XCloseDisplay
 
1630
can generate a
 
1631
.PN BadGC
 
1632
error.
 
1633
.sp
 
1634
.LP
 
1635
Xlib provides a function to permit the resources owned by a client
 
1636
to survive after the client's connection is closed.
 
1637
To change a client's close-down mode, use
 
1638
.PN XSetCloseDownMode .
 
1639
.IN "XSetCloseDownMode" "" "@DEF@"
 
1640
.sM
 
1641
.FD 0
 
1642
XSetCloseDownMode\^(\^\fIdisplay\fP, \fIclose_mode\fP\^)
 
1643
.br
 
1644
      Display *\fIdisplay\fP\^;
 
1645
.br
 
1646
      int \fIclose_mode\fP\^;   
 
1647
.FN
 
1648
.IP \fIdisplay\fP 1i
 
1649
Specifies the connection to the X server.
 
1650
.IP \fIclose_mode\fP 1i
 
1651
Specifies the client close-down mode.
 
1652
You can pass 
 
1653
.PN DestroyAll , 
 
1654
.PN RetainPermanent , 
 
1655
or
 
1656
.PN RetainTemporary . 
 
1657
.LP
 
1658
.eM
 
1659
The
 
1660
.PN XSetCloseDownMode
 
1661
defines what will happen to the client's resources at connection close.
 
1662
A connection starts in
 
1663
.PN DestroyAll
 
1664
mode.
 
1665
For information on what happens to the client's resources when the
 
1666
close_mode argument is
 
1667
.PN RetainPermanent
 
1668
or
 
1669
.PN RetainTemporary ,
 
1670
see section 2.6.
 
1671
.LP
 
1672
.PN XSetCloseDownMode
 
1673
can generate a
 
1674
.PN BadValue 
 
1675
error.
 
1676
.NH 2
 
1677
Using X Server Connection Close Operations 
 
1678
.XS
 
1679
\*(SN Using X Server Connection Close Operations
 
1680
.XE
 
1681
.LP
 
1682
When the X server's connection to a client is closed
 
1683
either by an explicit call to
 
1684
.PN XCloseDisplay
 
1685
or by a process that exits, the X server performs the following
 
1686
automatic operations:
 
1687
.IP \(bu 5
 
1688
It disowns all selections owned by the client
 
1689
(see 
 
1690
.PN XSetSelectionOwner ).
 
1691
.IP \(bu 5
 
1692
It performs an
 
1693
.PN XUngrabPointer
 
1694
and
 
1695
.PN XUngrabKeyboard 
 
1696
if the client has actively grabbed the pointer 
 
1697
or the keyboard.
 
1698
.IP \(bu 5
 
1699
It performs an
 
1700
.PN XUngrabServer 
 
1701
if the client has grabbed the server.
 
1702
.IP \(bu 5
 
1703
It releases all passive grabs made by the client.  
 
1704
.IP \(bu 5
 
1705
It marks all resources (including colormap entries) allocated 
 
1706
by the client either as permanent or temporary, 
 
1707
depending on whether the close-down mode is 
 
1708
.PN RetainPermanent
 
1709
or
 
1710
.PN RetainTemporary .
 
1711
However, this does not prevent other client applications from explicitly
 
1712
destroying the resources (see 
 
1713
.PN XSetCloseDownMode ).
 
1714
.LP
 
1715
When the close-down mode is
 
1716
.PN DestroyAll ,
 
1717
the X server destroys all of a client's resources as follows:
 
1718
.IP \(bu 5
 
1719
It examines each window in the client's save-set to determine if it is an inferior
 
1720
(subwindow) of a window created by the client.
 
1721
(The save-set is a list of other clients' windows
 
1722
that are referred to as save-set windows.)
 
1723
If so, the X server reparents the save-set window to the closest ancestor so
 
1724
that the save-set window is not an inferior of a window created by the client.
 
1725
The reparenting leaves unchanged the absolute coordinates (with respect to
 
1726
the root window) of the upper-left outer corner of the save-set
 
1727
window.
 
1728
.IP \(bu 5
 
1729
It performs a
 
1730
.PN MapWindow
 
1731
request on the save-set window if the save-set window is unmapped.
 
1732
The X server does this even if the save-set window was not an inferior of 
 
1733
a window created by the client.
 
1734
.IP \(bu 5
 
1735
It destroys all windows created by the client.
 
1736
.IP \(bu 5
 
1737
It performs the appropriate free request on each nonwindow resource created by
 
1738
the client in the server (for example, 
 
1739
.PN Font , 
 
1740
.PN Pixmap , 
 
1741
.PN Cursor , 
 
1742
.PN Colormap , 
 
1743
and 
 
1744
.PN GContext ).
 
1745
.IP \(bu 5
 
1746
It frees all colors and colormap entries allocated by a client application.
 
1747
.LP
 
1748
Additional processing occurs when the last connection to the X server closes.
 
1749
An X server goes through a cycle of having no connections and having some
 
1750
connections.
 
1751
When the last connection to the X server closes as a result of a connection
 
1752
closing with the close_mode of
 
1753
.PN DestroyAll ,
 
1754
the X server does the following: 
 
1755
.IP \(bu 5
 
1756
It resets its state as if it had just been
 
1757
started.  
 
1758
The X server begins by destroying all lingering resources from
 
1759
clients that have terminated in 
 
1760
.PN RetainPermanent
 
1761
or
 
1762
.PN RetainTemporary
 
1763
mode.
 
1764
.IP \(bu 5
 
1765
It deletes all but the predefined atom identifiers.
 
1766
.IP \(bu 5
 
1767
It deletes all properties on all root windows (see section 4.3).
 
1768
.IP \(bu 5
 
1769
It resets all device maps and attributes 
 
1770
(for example, key click, bell volume, and acceleration) 
 
1771
as well as the access control list.
 
1772
.IP \(bu 5
 
1773
It restores the standard root tiles and cursors.
 
1774
.IP \(bu 5
 
1775
It restores the default font path.
 
1776
.IP \(bu 5
 
1777
It restores the input focus to state
 
1778
.PN PointerRoot .
 
1779
.LP
 
1780
However, the X server does not reset if you close a connection with a close-down
 
1781
mode set to
 
1782
.PN RetainPermanent
 
1783
or
 
1784
.PN RetainTemporary .
 
1785
.NH 2
 
1786
Using Xlib with Threads
 
1787
.XS
 
1788
\*(SN Using Xlib with Threads
 
1789
.XE
 
1790
.LP
 
1791
On systems that have threads, support may be provided to permit
 
1792
multiple threads to use Xlib concurrently.
 
1793
.LP
 
1794
.sp
 
1795
To initialize support for concurrent threads, use
 
1796
.PN XInitThreads .
 
1797
.IN "XInitThreads" "" "@DEF@"
 
1798
.sM
 
1799
.FD 0
 
1800
Status XInitThreads\^(\|);
 
1801
.FN
 
1802
.LP
 
1803
.eM
 
1804
The
 
1805
.PN XInitThreads
 
1806
function initializes Xlib support for concurrent threads.
 
1807
This function must be the first Xlib function a
 
1808
multi-threaded program calls, and it must complete
 
1809
before any other Xlib call is made.
 
1810
This function returns a nonzero status if initialization was
 
1811
successful; otherwise, it returns zero.
 
1812
On systems that do not support threads, this function always returns zero.
 
1813
.LP
 
1814
It is only necessary to call this function if multiple threads
 
1815
might use Xlib concurrently.  If all calls to Xlib functions
 
1816
are protected by some other access mechanism (for example,
 
1817
a mutual exclusion lock in a toolkit or through explicit client
 
1818
programming), Xlib thread initialization is not required.
 
1819
It is recommended that single-threaded programs not call this function.
 
1820
 
 
1821
.LP
 
1822
.sp
 
1823
To lock a display across several Xlib calls, use
 
1824
.PN XLockDisplay .
 
1825
.IN "XLockDisplay" "" "@DEF@"
 
1826
.sM
 
1827
.FD 0
 
1828
void XLockDisplay\^(\^\fIdisplay\fP\^)
 
1829
.br
 
1830
      Display *\fIdisplay\fP\^;
 
1831
.FN
 
1832
.IP \fIdisplay\fP 1i
 
1833
Specifies the connection to the X server.
 
1834
.LP
 
1835
.eM
 
1836
The
 
1837
.PN XLockDisplay
 
1838
function locks out all other threads from using the specified display.
 
1839
Other threads attempting to use the display will block until
 
1840
the display is unlocked by this thread.
 
1841
Nested calls to
 
1842
.PN XLockDisplay
 
1843
work correctly; the display will not actually be unlocked until
 
1844
.PN XUnlockDisplay
 
1845
has been called the same number of times as
 
1846
.PN XLockDisplay .
 
1847
This function has no effect unless Xlib was successfully initialized
 
1848
for threads using
 
1849
.PN XInitThreads .
 
1850
.LP
 
1851
.sp
 
1852
To unlock a display, use
 
1853
.PN XUnlockDisplay .
 
1854
.IN "XUnlockDisplay" "" "@DEF@"
 
1855
.sM
 
1856
.FD 0
 
1857
void XUnlockDisplay\^(\^\fIdisplay\fP\^)
 
1858
.br
 
1859
      Display *\fIdisplay\fP\^;
 
1860
.FN
 
1861
.IP \fIdisplay\fP 1i
 
1862
Specifies the connection to the X server.
 
1863
.LP
 
1864
.eM
 
1865
The
 
1866
.PN XUnlockDisplay
 
1867
function allows other threads to use the specified display again.
 
1868
Any threads that have blocked on the display are allowed to continue.
 
1869
Nested locking works correctly; if
 
1870
.PN XLockDisplay
 
1871
has been called multiple times by a thread, then
 
1872
.PN XUnlockDisplay
 
1873
must be called an equal number of times before the display is
 
1874
actually unlocked.
 
1875
This function has no effect unless Xlib was successfully initialized
 
1876
for threads using
 
1877
.PN XInitThreads .
 
1878
.NH 2
 
1879
Using Internal Connections
 
1880
.XS
 
1881
\*(SN Using Internal Connections
 
1882
.XE
 
1883
.LP
 
1884
In addition to the connection to the X server, an Xlib implementation
 
1885
may require connections to other kinds of servers (for example, to
 
1886
input method servers as described in chapter 13).  Toolkits and clients
 
1887
that use multiple displays, or that use displays in combination with
 
1888
other inputs, need to obtain these additional connections to correctly
 
1889
block until input is available and need to process that input
 
1890
when it is available.  Simple clients that use a single display and
 
1891
block for input in an Xlib event function do not need to use these
 
1892
facilities.
 
1893
.LP
 
1894
To track internal connections for a display, use
 
1895
.PN XAddConnectionWatch .
 
1896
.LP
 
1897
.IN "XWatchProc" "" "@DEF@"
 
1898
.IN "XAddConnectionWatch" "" "@DEF@"
 
1899
.sM
 
1900
.FD 0
 
1901
typedef void (*XConnectionWatchProc)\^(\^\fIdisplay\fP, \fIclient_data\fP, \fIfd\fP, \fIopening\fP, \fIwatch_data\fP\^)
 
1902
.br
 
1903
      Display *\fIdisplay\fP\^;
 
1904
.br
 
1905
      XPointer \fIclient_data\fP\^;
 
1906
.br
 
1907
      int \fIfd\fP\^;
 
1908
.br
 
1909
      Bool \fIopening\fP\^;
 
1910
.br
 
1911
      XPointer *\fIwatch_data\fP\^;
 
1912
.sp
 
1913
Status XAddConnectionWatch\^(\^\fIdisplay\fP, \fIprocedure\fP\^, \fIclient_data\fP\^)
 
1914
.br
 
1915
      Display *\fIdisplay\fP\^;
 
1916
.br
 
1917
      XWatchProc \fIprocedure\fP\^;
 
1918
.br
 
1919
      XPointer \fIclient_data\fP\^;
 
1920
.FN
 
1921
.IP \fIdisplay\fP 1i
 
1922
Specifies the connection to the X server.
 
1923
.IP \fIprocedure\fP 1i
 
1924
Specifies the procedure to be called.
 
1925
.IP \fIclient_data\fP 1i
 
1926
Specifies the additional client data.
 
1927
.LP
 
1928
.eM
 
1929
The
 
1930
.PN XAddConnectionWatch
 
1931
function registers a procedure to be called each time Xlib opens or closes an
 
1932
internal connection for the specified display.  The procedure is passed the
 
1933
display, the specified client_data, the file descriptor for the connection,
 
1934
a Boolean indicating whether the connection is being opened or closed, and a
 
1935
pointer to a location for private watch data.  If opening is
 
1936
.PN True ,
 
1937
the procedure can store a pointer to private data in the location pointed
 
1938
to by watch_data;
 
1939
when the procedure is later called for this same connection and opening is
 
1940
.PN False ,
 
1941
the location pointed to by watch_data will hold this same private data pointer.
 
1942
.LP
 
1943
This function can be called at any time after a display is opened.
 
1944
If internal connections already exist, the registered procedure will
 
1945
immediately be called for each of them, before
 
1946
.PN XAddConnectionWatch
 
1947
returns.
 
1948
.PN XAddConnectionWatch
 
1949
returns a nonzero status if the procedure is successfully registered;
 
1950
otherwise, it returns zero.
 
1951
.LP
 
1952
The registered procedure should not call any Xlib functions.
 
1953
If the procedure directly or indirectly causes the state of internal
 
1954
connections or watch procedures to change, the result is not defined.
 
1955
If Xlib has been initialized for threads, the procedure is called with
 
1956
the display locked and the result of a call by the procedure to any
 
1957
Xlib function that locks the display is not defined unless the executing
 
1958
thread has externally locked the display using
 
1959
.PN XLockDisplay .
 
1960
.LP
 
1961
.sp
 
1962
To stop tracking internal connections for a display, use
 
1963
.PN XRemoveConnectionWatch .
 
1964
.IN "XRemoveConnectionWatch" "" "@DEF@"
 
1965
.sM
 
1966
.FD 0
 
1967
Status XRemoveConnectionWatch\^(\^\fIdisplay\fP, \fIprocedure\fP\^, \fIclient_data\fP\^)
 
1968
.br
 
1969
      Display *\fIdisplay\fP\^;
 
1970
.br
 
1971
      XWatchProc \fIprocedure\fP\^;
 
1972
.br
 
1973
      XPointer \fIclient_data\fP\^;
 
1974
.FN
 
1975
.IP \fIdisplay\fP 1i
 
1976
Specifies the connection to the X server.
 
1977
.IP \fIprocedure\fP 1i
 
1978
Specifies the procedure to be called.
 
1979
.IP \fIclient_data\fP 1i
 
1980
Specifies the additional client data.
 
1981
.LP
 
1982
.eM
 
1983
The
 
1984
.PN XRemoveConnectionWatch
 
1985
function removes a previously registered connection watch procedure.
 
1986
The client_data must match the client_data used when the procedure
 
1987
was initially registered.
 
1988
 
 
1989
.LP
 
1990
.sp
 
1991
To process input on an internal connection, use
 
1992
.PN XProcessInternalConnection .
 
1993
.IN "XProcessInternalConnection" "" "@DEF@"
 
1994
.sM
 
1995
.FD 0
 
1996
void XProcessInternalConnection\^(\^\fIdisplay\fP, \fIfd\fP\^)
 
1997
.br
 
1998
      Display *\fIdisplay\fP\^;
 
1999
.br
 
2000
      int \fIfd\fP\^;
 
2001
.FN
 
2002
.IP \fIdisplay\fP 1i
 
2003
Specifies the connection to the X server.
 
2004
.IP \fIfd\fP 1i
 
2005
Specifies the file descriptor.
 
2006
.LP
 
2007
.eM
 
2008
The
 
2009
.PN XProcessInternalConnection
 
2010
function processes input available on an internal connection.
 
2011
This function should be called for an internal connection only
 
2012
after an operating system facility (for example,
 
2013
.PN select
 
2014
or
 
2015
.PN poll )
 
2016
has indicated that input is available; otherwise,
 
2017
the effect is not defined.
 
2018
.LP
 
2019
.sp
 
2020
To obtain all of the current internal connections for a display, use
 
2021
.PN XInternalConnectionNumbers .
 
2022
.IN "XInternalConnectionNumbers" "" "@DEF@"
 
2023
.sM
 
2024
.FD 0
 
2025
Status XInternalConnectionNumbers\^(\^\fIdisplay\fP, \fIfd_return\fP\^, \fIcount_return\fP\^)
 
2026
.br
 
2027
      Display *\fIdisplay\fP\^;
 
2028
.br
 
2029
      int **\fIfd_return\fP\^;
 
2030
.br
 
2031
      int *\fIcount_return\fP\^;
 
2032
.FN
 
2033
.IP \fIdisplay\fP 1i
 
2034
Specifies the connection to the X server.
 
2035
.IP \fIfd_return\fP 1i
 
2036
Returns the file descriptors.
 
2037
.ds Cn file descriptors
 
2038
.IP \fIcount_return\fP 1i
 
2039
Returns the number of \*(Cn.
 
2040
.LP
 
2041
.eM
 
2042
The
 
2043
.PN XInternalConnectionNumbers
 
2044
function returns a list of the file descriptors for all internal
 
2045
connections currently open for the specified display.
 
2046
When the allocated list is no longer needed,
 
2047
free it by using
 
2048
.PN XFree .
 
2049
This functions returns a nonzero status if the list is successfully allocated;
 
2050
otherwise, it returns zero.
 
2051
.LP
 
2052
.bp