summaryrefslogtreecommitdiff
path: root/specs/libX11/CH04
blob: b964198c2a547033b67483ed689c6fec9ec729db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining
.\" a copy of this software and associated documentation files (the
.\" "Software"), to deal in the Software without restriction, including
.\" without limitation the rights to use, copy, modify, merge, publish,
.\" distribute, sublicense, and/or sell copies of the Software, and to
.\" permit persons to whom the Software is furnished to do so, subject to
.\" the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of the X Consortium shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from the X Consortium.
.\"
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
.\" Digital Equipment Corporation
.\"
.\" Portions Copyright \(co 1990, 1991 by
.\" Tektronix, Inc.
.\"
.\" Permission to use, copy, modify and distribute this documentation for
.\" any purpose and without fee is hereby granted, provided that the above
.\" copyright notice appears in all copies and that both that copyright notice
.\" and this permission notice appear in all copies, and that the names of
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
.\" to this documentation without specific, written prior permission.
.\" Digital and Tektronix makes no representations about the suitability
.\" of this documentation for any purpose.
.\" It is provided ``as is'' without express or implied warranty.
.\" 
\&
.sp 1
.ce 3
\s+1\fBChapter 4\fP\s-1

\s+1\fBWindow Information Functions\fP\s-1
.sp 2
.nr H1 4
.nr H2 0
.nr H3 0
.nr H4 0
.nr H5 0
.na
.LP
.XS
Chapter 4: Window Information Functions 
.XE
After you connect the display to the X server and create a window,
you can use the Xlib window information functions to:
.IP \(bu 5
Obtain information about a window
.IP \(bu 5
Translate screen coordinates
.IP \(bu 5
Manipulate property lists
.IP \(bu 5
Obtain and change window properties
.IP \(bu 5
Manipulate selections
.NH 2
Obtaining Window Information
.XS
\*(SN Obtaining Window Information 
.XE
.LP
Xlib provides functions that you can use to obtain information about 
the window tree, the window's current attributes, 
the window's current geometry, or the current pointer coordinates.
Because they are most frequently used by window managers,
these functions all return a status to indicate whether the window still
exists.
.LP
.sp
To obtain the parent, a list of children, and number of children for 
a given window, use 
.PN XQueryTree .
.IN "Child Window"
.IN "Parent Window"
.IN "XQueryTree" "" "@DEF@"
.sM
.FD 0
Status XQueryTree\^(\^\fIdisplay\fP, \fIw\fP\^, \fIroot_return\fP\^, \fIparent_return\fP\^, \fIchildren_return\fP\^, \fInchildren_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window *\fIroot_return\fP\^;
.br
      Window *\fIparent_return\fP\^;
.br
      Window **\fIchildren_return\fP\^;
.br
      unsigned int *\fInchildren_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose list of children, root, parent, and number of children \
you want to obtain
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fIroot_return\fP 1i
Returns the root window.
.IP \fIparent_return\fP 1i
Returns the parent window.
.IP \fIchildren_return\fP 1i
Returns the list of children.
.IP \fInchildren_return\fP 1i
Returns the number of children.
.LP
.eM
The
.PN XQueryTree
function returns the root ID, the parent window ID, 
a pointer to the list of children windows
(NULL when there are no children), 
and the number of children in the list for the specified window.
The children are listed in current stacking order, from bottom-most 
(first) to top-most (last).
.PN XQueryTree
returns zero if it fails and nonzero if it succeeds.
To free a non-NULL children list when it is no longer needed, use 
.PN XFree .
.LP
.PN XQueryTree
can generate a
.PN BadWindow
error.
.LP
.sp
To obtain the current attributes of a given window, use 
.PN XGetWindowAttributes .
.IN "XGetWindowAttributes" "" "@DEF@"
.sM
.FD 0
Status XGetWindowAttributes\^(\^\fIdisplay\fP, \fIw\fP\^, \fIwindow_attributes_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XWindowAttributes *\fIwindow_attributes_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose current attributes you want to obtain
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fIwindow_attributes_return\fP 1i
Returns the specified window's attributes in the
.PN XWindowAttributes
structure.
.LP
.eM
The
.PN XGetWindowAttributes
function returns the current attributes for the specified window to an
.PN XWindowAttributes
structure.
.LP
.IN "XWindowAttributes" "" "@DEF@"
.sM
.Ds 0
.TA .5i 3i
.ta .5i 3i
typedef struct {
	int x, y;	/* location of window */
	int width, height;	/* width and height of window */
	int border_width;	/* border width of window */
	int depth;	/* depth of window */
	Visual *visual;	/* the associated visual structure */
	Window root;	/* root of screen containing window */
	int class;	/* InputOutput, InputOnly*/
	int bit_gravity;	/* one of the bit gravity values */
	int win_gravity;	/* one of the window gravity values */
	int backing_store;	/* NotUseful, WhenMapped, Always */
	unsigned long backing_planes;	/* planes to be preserved if possible */
	unsigned long backing_pixel;	/* value to be used when restoring planes */
	Bool save_under;	/* boolean, should bits under be saved? */
	Colormap colormap;	/* color map to be associated with window */
	Bool map_installed;	/* boolean, is color map currently installed*/
	int map_state;	/* IsUnmapped, IsUnviewable, IsViewable */
	long all_event_masks;	/* set of events all people have interest in*/
	long your_event_mask;	/* my event mask */
	long do_not_propagate_mask;	/* set of events that should not propagate */
	Bool override_redirect;	/* boolean value for override-redirect */
	Screen *screen;	/* back pointer to correct screen */
} XWindowAttributes;
.De
.LP
.eM
The x and y members are set to the upper-left outer
corner relative to the parent window's origin.
The width and height members are set to the inside size of the window, 
not including the border.
The border_width member is set to the window's border width in pixels.
The depth member is set to the depth of the window 
(that is, bits per pixel for the object).
The visual member is a pointer to the screen's associated
.PN Visual
structure.
The root member is set to the root window of the screen containing the window.
The class member is set to the window's class and can be either
.PN InputOutput
or
.PN InputOnly .
.LP
The bit_gravity member is set to the window's bit gravity
and can be one of the following:
.LP
.TS
lw(1.5i) lw(1.5i).
T{
.PN ForgetGravity
T}	T{
.PN EastGravity
T}
T{
.PN NorthWestGravity
T}	T{
.PN SouthWestGravity
T}
T{
.PN NorthGravity
T}	T{
.PN SouthGravity
T}
T{
.PN NorthEastGravity
T}	T{
.PN SouthEastGravity
T}
T{
.PN WestGravity
T}	T{
.PN StaticGravity
T}
.PN CenterGravity
.TE
.LP
The win_gravity member is set to the window's window gravity
and can be one of the following:
.LP
.TS
lw(1.5i) lw(1.5i).
T{
.PN UnmapGravity
T}	T{
.PN EastGravity
T}
T{
.PN NorthWestGravity
T}	T{
.PN SouthWestGravity
T}
T{
.PN NorthGravity
T}	T{
.PN SouthGravity
T}
T{
.PN NorthEastGravity
T}	T{
.PN SouthEastGravity
T}
T{
.PN WestGravity
T}	T{
.PN StaticGravity
T}
.PN CenterGravity
.TE
.LP
For additional information on gravity,
see section 3.2.3.
.LP
The backing_store member is set to indicate how the X server should maintain
the contents of a window 
and can be 
.PN WhenMapped ,
.PN Always ,
or
.PN NotUseful .
The backing_planes member is set to indicate (with bits set to 1) which bit 
planes of the window hold dynamic data that must be preserved in backing_stores 
and during save_unders.
The backing_pixel member is set to indicate what values to use 
for planes not set in backing_planes.
.LP
The save_under member is set to 
.PN True
or
.PN False .
The colormap member is set to the colormap for the specified window and can be
a colormap ID or 
.PN None .
The map_installed member is set to indicate whether the colormap is 
currently installed and can be 
.PN True
or
.PN False .
The map_state member is set to indicate the state of the window and can be
.PN IsUnmapped ,
.PN IsUnviewable ,
or
.PN IsViewable .
.PN IsUnviewable
is used if the window is mapped but some ancestor is unmapped.
.LP
The all_event_masks member is set to the bitwise inclusive OR of all event 
masks selected on the window by all clients.
The your_event_mask member is set to the bitwise inclusive OR of all event 
masks selected by the querying client.
The do_not_propagate_mask member is set to the bitwise inclusive OR of the 
set of events that should not propagate.
.LP
The override_redirect member is set to indicate whether this window overrides
structure control facilities and can be 
.PN True
or
.PN False .
Window manager clients should ignore the window if this member is
.PN True .
.LP
The screen member is set to a screen pointer that gives you a back pointer 
to the correct screen.
This makes it easier to obtain the screen information without
having to loop over the root window fields to see which field matches.
.LP
.PN XGetWindowAttributes
can generate
.PN BadDrawable
and
.PN BadWindow
errors.
.LP
.sp
To obtain the current geometry of a given drawable, use 
.PN XGetGeometry .
.IN "XGetGeometry" "" "@DEF@"
.sM
.FD 0
Status XGetGeometry\^(\^\fIdisplay\fP, \fId\fP\^, \^\fIroot_return\fP\^, \fIx_return\fP\^, \fIy_return\fP\^, \fIwidth_return\fP\^, 
.br
                      \fIheight_return\fP\^, \fIborder_width_return\fP\^, \fIdepth_return\fP\^)
.br
        Display *\fIdisplay\fP\^;
.br
        Drawable \fId\fP\^;
.br
        Window *\fIroot_return\fP\^;
.br
        int *\fIx_return\fP\^, *\fIy_return\fP\^;
.br
        unsigned int *\fIwidth_return\fP\^, *\fIheight_return\fP\^;
.br
        unsigned int *\fIborder_width_return\fP\^;
.br
        unsigned int *\fIdepth_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Dr , which can be a window or a pixmap
.IP \fId\fP 1i
Specifies the drawable\*(Dr. 
.IP \fIroot_return\fP 1i
Returns the root window.
.IP \fIx_return\fP 1i
.br
.ns
.IP \fIy_return\fP 1i
Return the x and y coordinates that define the location of the drawable.
For a window, 
these coordinates specify the upper-left outer corner relative to
its parent's origin.
For pixmaps, these coordinates are always zero.
.IP \fIwidth_return\fP 1i
.br
.ns
.IP \fIheight_return\fP 1i
Return the drawable's dimensions (width and height).
For a window, 
these dimensions specify the inside size, not including the border.
.IP \fIborder_width_return\fP 1i
Returns the border width in pixels. 
If the drawable is a pixmap, it returns zero.
.IP \fIdepth_return\fP 1i
Returns the depth of the drawable (bits per pixel for the object).
.LP
.eM
The
.PN XGetGeometry
function returns the root window and the current geometry of the drawable.
The geometry of the drawable includes the x and y coordinates, width and height,
border width, and depth.
These are described in the argument list.
It is legal to pass to this function a window whose class is
.PN InputOnly .
.LP
.PN XGetGeometry
can generate a
.PN BadDrawable
error.
.NH 2
Translating Screen Coordinates
.XS
\*(SN Translating Screen Coordinates 
.XE
.LP
Applications sometimes
need to perform a coordinate transformation from the coordinate
space of one window to another window or need to determine which
window the pointing device is in.
.PN XTranslateCoordinates
and
.PN XQueryPointer
fulfill these needs (and avoid any race conditions) by
asking the X server to perform these operations.
.LP
.sp
To translate a coordinate in one window to the coordinate
space of another window, use
.PN XTranslateCoordinates .
.IN "XTranslateCoordinates" "" "@DEF@"
.sM
.FD 0
Bool XTranslateCoordinates\^(\^\fIdisplay\fP, \fIsrc_w\fP\^, \fIdest_w\fP\^, \fIsrc_x\fP\^, \fIsrc_y\fP\^, \fIdest_x_return\fP\^, 
.br
                            \fIdest_y_return\fP\^, \fIchild_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIsrc_w\fP\^, \fIdest_w\fP\^;
.br
      int \fIsrc_x\fP\^, \fIsrc_y\fP\^;
.br
      int *\fIdest_x_return\fP\^, *\fIdest_y_return\fP\^;
.br
      Window *\fIchild_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIsrc_w\fP 1i
Specifies the source window.
.IP \fIdest_w\fP 1i
Specifies the destination window.
.IP \fIsrc_x\fP 1i
.br
.ns
.IP \fIsrc_y\fP 1i
Specify the x and y coordinates within the source window.
.IP \fIdest_x_return\fP 1i
.br
.ns
.IP \fIdest_y_return\fP 1i
Return the x and y coordinates within the destination window.
.IP \fIchild_return\fP 1i
Returns the child if the coordinates are contained in a mapped child of the
destination window.
.LP
.eM
If
.PN XTranslateCoordinates
returns
.PN True ,
it takes the src_x and src_y coordinates relative
to the source window's origin and returns these coordinates to 
dest_x_return and dest_y_return
relative to the destination window's origin.
If
.PN XTranslateCoordinates
returns 
.PN False , 
src_w and dest_w are on different screens,
and dest_x_return and dest_y_return are zero.
If the coordinates are contained in a mapped child of dest_w,
that child is returned to child_return.
Otherwise, child_return is set to
.PN None .
.LP
.PN XTranslateCoordinates
can generate a
.PN BadWindow 
error.
.LP
.sp
To obtain the screen coordinates of the pointer
or to determine the pointer coordinates relative to a specified window, use 
.PN XQueryPointer .
.IN "XQueryPointer" "" "@DEF@"
.sM
.FD 0
Bool XQueryPointer\^(\^\fIdisplay\fP, \fIw\fP\^, \fIroot_return\fP\^, \fIchild_return\fP\^, \fIroot_x_return\fP\^, \fIroot_y_return\fP\^, 
.br
                     \fIwin_x_return\fP\^, \fIwin_y_return\fP\^, \fImask_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Window *\fIroot_return\fP\^, *\fIchild_return\fP\^;
.br
      int *\fIroot_x_return\fP\^, *\fIroot_y_return\fP\^;
.br
      int *\fIwin_x_return\fP\^, *\fIwin_y_return\fP\^;
.br
      unsigned int *\fImask_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.ds Ro that the pointer is in
.IP \fIroot_return\fP 1i
Returns the root window \*(Ro.
.IP \fIchild_return\fP 1i
Returns the child window that the pointer is located in, if any.
.IP \fIroot_x_return\fP 1i
.br
.ns
.IP \fIroot_y_return\fP 1i
Return the pointer coordinates relative to the root window's origin.
.IP \fIwin_x_return\fP 1i
.br
.ns
.IP \fIwin_y_return\fP 1i
Return the pointer coordinates relative to the specified window.
.IP \fImask_return\fP 1i
Returns the current state of the modifier keys and pointer buttons.
.LP
.eM
The
.PN XQueryPointer
function returns the root window the pointer is logically on and the pointer
coordinates relative to the root window's origin.
If
.PN XQueryPointer
returns 
.PN False , 
the pointer is not on the same screen as the specified window, and
.PN XQueryPointer
returns 
.PN None
to child_return and zero to win_x_return and win_y_return.
If 
.PN XQueryPointer
returns 
.PN True , 
the pointer coordinates returned to win_x_return and win_y_return
are relative to the origin of the specified window.
In this case, 
.PN XQueryPointer
returns the child that contains the pointer, if any,
or else
.PN None
to child_return.
.LP
.PN XQueryPointer
returns the current logical state of the keyboard buttons 
and the modifier keys in mask_return.
It sets mask_return to the bitwise inclusive OR of one or more
of the button or modifier key bitmasks to match 
the current state of the mouse buttons and the modifier keys.
.LP
Note that the logical state of a device (as seen through Xlib)
may lag the physical state if device event processing is frozen
(see section 12.1).
.LP
.PN XQueryPointer
can generate a
.PN BadWindow 
error.
.NH 2
Properties and Atoms
.XS
\*(SN Properties and Atoms 
.XE
.LP
A property is a collection of named, typed data.
The window system has a set of predefined properties
.IN "Atom" "predefined"
(for example, the name of a window, size hints, and so on), and users can
define any other arbitrary information and associate it with windows.
Each property has a name,
which is an ISO Latin-1 string.
For each named property,
a unique identifier (atom) is associated with it. 
A property also has a type, for example, string or integer.
These types are also indicated using atoms, so arbitrary new
types can be defined.
Data of only one type may be associated with a single
property name.
Clients can store and retrieve properties associated with windows.
For efficiency reasons,
an atom is used rather than a character string.
.PN XInternAtom
can be used to obtain the atom for property names.
.IN "Atom" 
.LP
A property is also stored in one of several possible formats.
The X server can store the information as 8-bit quantities, 16-bit
quantities, or 32-bit quantities.
This permits the X server to present the data in the byte order that the
client expects.
.NT Note
If you define further properties of complex type, 
you must encode and decode them yourself.
These functions must be carefully written if they are to be portable.
For further information about how to write a library extension,
see appendix C.
.NE
The type of a property is defined by an atom, which allows for
arbitrary extension in this type scheme.
.IN "Atom" 
.LP
Certain property names are
predefined in the server for commonly used functions.
The atoms for these properties are defined in 
.hN X11/Xatom.h .
To avoid name clashes with user symbols, the 
.PN #define 
name for each atom has the XA_ prefix.
For an explanation of the functions that let you get and set
much of the information stored in these predefined properties,
see chapter 14.
.LP
The core protocol imposes no semantics on these property names,
but semantics are specified in other X Consortium standards,
such as the \fIInter-Client Communication Conventions Manual\fP
and the \fIX Logical Font Description Conventions\fP.
.LP
You can use properties to communicate other information between
applications.
The functions described in this section let you define new properties 
and get the unique atom IDs in your applications.
.LP
Although any particular atom can have some client interpretation 
within each of the name spaces, 
atoms occur in five distinct name spaces within the protocol: 
.IP \(bu 5
Selections
.IP \(bu 5
Property names
.IP \(bu 5
Property types
.IP \(bu 5
Font properties 
.IP \(bu 5
Type of a 
.PN ClientMessage 
event (none are built into the X server)
.LP
.LP
The built-in selection property names are:
.LP
.Ds 0
.TA .5i 1.5i 3i
.ta .5i 1.5i 3i
.R
PRIMARY
SECONDARY
.De
.LP
The built-in property names are: 
.TS
lw(2i) lw(2i).
.sp 6p
CUT_BUFFER0	RESOURCE_MANAGER
CUT_BUFFER1	WM_CLASS
CUT_BUFFER2	WM_CLIENT_MACHINE
CUT_BUFFER3	WM_COLORMAP_WINDOWS
CUT_BUFFER4	WM_COMMAND
CUT_BUFFER5	WM_HINTS
CUT_BUFFER6	WM_ICON_NAME
CUT_BUFFER7	WM_ICON_SIZE
RGB_BEST_MAP	WM_NAME
RGB_BLUE_MAP	WM_NORMAL_HINTS
RGB_DEFAULT_MAP	WM_PROTOCOLS
RGB_GRAY_MAP	WM_STATE
RGB_GREEN_MAP	WM_TRANSIENT_FOR
RGB_RED_MAP	WM_ZOOM_HINTS
.sp 6p
.TE
.LP
The built-in property types are: 
.LP
.TS
lw(2i) lw(2i).
.sp 6p
ARC	POINT
ATOM	RGB_COLOR_MAP
BITMAP	RECTANGLE
CARDINAL	STRING
COLORMAP	VISUALID
CURSOR	WINDOW
DRAWABLE	WM_HINTS
FONT	WM_SIZE_HINTS
INTEGER	
PIXMAP
.sp 6p
.TE
.LP
The built-in font property names are: 
.TS
lw(2i) lw(2i).
.sp 6p
MIN_SPACE	STRIKEOUT_DESCENT
NORM_SPACE	STRIKEOUT_ASCENT
MAX_SPACE	ITALIC_ANGLE
END_SPACE	X_HEIGHT
SUPERSCRIPT_X	QUAD_WIDTH
SUPERSCRIPT_Y	WEIGHT
SUBSCRIPT_X	POINT_SIZE
SUBSCRIPT_Y	RESOLUTION
UNDERLINE_POSITION	COPYRIGHT
UNDERLINE_THICKNESS	NOTICE
FONT_NAME	FAMILY_NAME
FULL_NAME	CAP_HEIGHT
.sp 6p
.TE
.LP
For further information about font properties,
see section 8.5.
.LP
.sp
To return an atom for a given name, use 
.PN XInternAtom .
.IN "Atom" "interning"
.IN "XInternAtom" "" "@DEF@"
.sM
.FD 0
Atom XInternAtom\^(\^\fIdisplay\fP, \fIatom_name\fP\^, \fIonly_if_exists\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      char *\fIatom_name\fP\^;
.br
      Bool \fIonly_if_exists\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIatom_name\fP 1i
Specifies the name associated with the atom you want returned.
.IP \fIonly_if_exists\fP 1i
Specifies a Boolean value that indicates whether the atom must be created.
.LP
.eM
The
.PN XInternAtom
function returns the atom identifier associated with the specified atom_name
string.
If only_if_exists is 
.PN False ,
the atom is created if it does not exist.
Therefore,
.PN XInternAtom
can return
.PN None .
If the atom name is not in the Host Portable Character Encoding, 
the result is implementation-dependent.
Uppercase and lowercase matter;
the strings ``thing'', ``Thing'', and ``thinG'' 
all designate different atoms.  
The atom will remain defined even after the client's connection closes.
It will become undefined only when the last connection to
the X server closes.
.LP
.PN XInternAtom
can generate
.PN BadAlloc
and
.PN BadValue 
errors.
.LP
.sp
To return atoms for an array of names, use 
.PN XInternAtoms .
.IN "Atom" "interning"
.IN "XInternAtoms" "" "@DEF@"
.sM
.FD 0
Status XInternAtoms\^(\^\fIdisplay\fP, \fInames\fP\^, \fIcount\fP\^, \fIonly_if_exists\fP, \fIatoms_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      char **\fInames\fP\^;
.br
      int \fIcount\fP\^;
.br
      Bool \fIonly_if_exists\fP\^;
.br
      Atom *\fIatoms_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fInames\fP 1i
Specifies the array of atom names.
.ds Cn atom names in the array
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.IP \fIonly_if_exists\fP 1i
Specifies a Boolean value that indicates whether the atom must be created.
.IP \fIatoms_return\fP 1i
Returns the atoms.
.LP
.eM
The
.PN XInternAtoms
function returns the atom identifiers associated with the specified names.
The atoms are stored in the atoms_return array supplied by the caller.
Calling this function is equivalent to calling
.PN XInternAtom
for each of the names in turn with the specified value of only_if_exists,
but this function minimizes the number of round-trip protocol exchanges
between the client and the X server.
.LP
This function returns a nonzero status if atoms are returned for
all of the names;
otherwise, it returns zero.
.LP
.PN XInternAtoms
can generate
.PN BadAlloc
and
.PN BadValue 
errors.
.LP
.sp
To return a name for a given atom identifier, use 
.PN XGetAtomName .
.IN "Atom" "getting name"
.IN "XGetAtomName" "" "@DEF@"
.sM
.FD 0
char *XGetAtomName\^(\^\fIdisplay\fP, \fIatom\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Atom \fIatom\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIatom\fP 1i
Specifies the atom for the property name you want returned.
.LP
.eM
The
.PN XGetAtomName
function returns the name associated with the specified atom.
If the data returned by the server is in the Latin Portable Character Encoding,
then the returned string is in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
To free the resulting string,
call
.PN XFree .
.LP
.PN XGetAtomName
can generate a
.PN BadAtom 
error.
.LP
.sp
To return the names for an array of atom identifiers, use 
.PN XGetAtomNames .
.IN "Atom" "getting name"
.IN "XGetAtomNames" "" "@DEF@"
.sM
.FD 0
Status XGetAtomNames\^(\^\fIdisplay\fP, \fIatoms\fP, \fIcount\fP\^, \fInames_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Atom *\fIatoms\fP\^;
.br
      int \fIcount\fP\^;
.br
      char **\fInames_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIatoms\fP 1i
Specifies the array of atoms.
.ds Cn atoms in the array
.IP \fIcount\fP 1i
Specifies the number of \*(Cn.
.IP \fInames_return\fP 1i
Returns the atom names.
.LP
.eM
The
.PN XGetAtomNames
function returns the names associated with the specified atoms.
The names are stored in the names_return array supplied by the caller.
Calling this function is equivalent to calling
.PN XGetAtomName
for each of the atoms in turn,
but this function minimizes the number of round-trip protocol exchanges
between the client and the X server.
.LP
This function returns a nonzero status if names are returned for
all of the atoms;
otherwise, it returns zero.
.LP
.PN XGetAtomNames
can generate a
.PN BadAtom 
error.
.NH 2
Obtaining and Changing Window Properties
.XS
\*(SN Obtaining and Changing Window Properties 
.XE
.LP
You can attach a property list to every window.
Each property has a name, a type, and a value (see section 4.3).
The value is an array of 8-bit, 16-bit, or 32-bit quantities,
whose interpretation is left to the clients.  The type
.PN char
is used to represent 8-bit quantities, the type
.PN short
is used to represent 16-bit quantities, and the type
.PN long
is used to represent 32-bit quantities.
.LP
Xlib provides functions that you can use to obtain, 
change, update, or interchange window properties.
In addition, Xlib provides other utility functions for inter-client
communication (see chapter 14).
.LP
.sp
To obtain the type, format, and value of a property of a given window, use 
.PN XGetWindowProperty .
.IN "Property" "getting"
.LP
.IN "XGetWindowProperty" "" "@DEF@"
.sM
.FD 0
int XGetWindowProperty\^(\^\fIdisplay\fP, \fIw\fP\^, \fIproperty\fP\^, \fIlong_offset\fP\^, \fIlong_length\fP\^, \fIdelete\fP\^, \fIreq_type\fP\^, 
.br
                        \fIactual_type_return\fP\^, \fIactual_format_return\fP\^, \fInitems_return\fP\^, \fIbytes_after_return\fP\^, 
.br
                        \fIprop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom \fIproperty\fP\^;
.br
      long \fIlong_offset\fP\^, \fIlong_length\fP\^;
.br
      Bool \fIdelete\fP\^;
.br
      Atom \fIreq_type\fP\^; 
.br
      Atom *\fIactual_type_return\fP\^;
.br
      int *\fIactual_format_return\fP\^;
.br
      unsigned long *\fInitems_return\fP\^;
.br
      unsigned long *\fIbytes_after_return\fP\^;
.br
      unsigned char **\fIprop_return\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose property you want to obtain
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fIproperty\fP 1i
Specifies the property name.
.IP \fIlong_offset\fP 1i
Specifies the offset in the specified property (in 32-bit quantities) 
where the data is to be retrieved.
.IP \fIlong_length\fP 1i
Specifies the length in 32-bit multiples of the data to be retrieved.
.IP \fIdelete\fP 1i
Specifies a Boolean value that determines whether the property is deleted.
.IP \fIreq_type\fP 1i
Specifies the atom identifier associated with the property type or
.PN AnyPropertyType .
.IP \fIactual_type_return\fP 1i
Returns the atom identifier  that defines the actual type of the property.
.IP \fIactual_format_return\fP 1i
Returns the actual format of the property.
.IP \fInitems_return\fP 1i
Returns the actual number of 8-bit, 16-bit, or 32-bit items 
stored in the prop_return data.
.IP \fIbytes_after_return\fP 1i
Returns the number of bytes remaining to be read in the property if 
a partial read was performed.
.IP \fIprop_return\fP 1i
Returns the data in the specified format.
.LP
.eM
The
.PN XGetWindowProperty
function returns the actual type of the property; the actual format of the property;
the number of 8-bit, 16-bit, or 32-bit items transferred; the number of bytes remaining
to be read in the property; and a pointer to the data actually returned.
.PN XGetWindowProperty
sets the return arguments as follows:
.IP \(bu 5
If the specified property does not exist for the specified window,
.PN XGetWindowProperty 
returns 
.PN None
to actual_type_return and the value zero to 
actual_format_return and bytes_after_return.
The nitems_return argument is empty.
In this case, the delete argument is ignored.
.IP \(bu 5
If the specified property exists 
but its type does not match the specified type,
.PN XGetWindowProperty 
returns the actual property type to actual_type_return, 
the actual property format (never zero) to actual_format_return, 
and the property length in bytes
(even if the actual_format_return is 16 or 32) 
to bytes_after_return.
It also ignores the delete argument.
The nitems_return argument is empty.
.IP \(bu 5
If the specified property exists and either you assign 
.PN AnyPropertyType 
to the req_type argument or the specified type matches the actual property type,
.PN XGetWindowProperty 
returns the actual property type to actual_type_return and the actual
property format (never zero) to actual_format_return. 
It also returns a value to bytes_after_return and nitems_return, by 
defining the following
values:
.IP
.nf
	N = actual length of the stored property in bytes
	     (even if the format is 16 or 32)
	I = 4 * long_offset
	T = N - I
	L = MINIMUM(T, 4 * long_length)
	A = N - (I + L)
.fi
.IP
The returned value starts at byte index I in the property (indexing
from zero), and its length in bytes is L.
If the value for long_offset causes L to be negative,
a
.PN BadValue
error results. 
The value of bytes_after_return is A, 
giving the number of trailing unread bytes in the stored property.
.LP
If the returned format is 8, the returned data is represented as a
.PN char
array.
If the returned format is 16, the returned data is represented as a
.PN short
array and should be cast to that type to obtain the elements.
If the returned format is 32, the returned data is represented as a
.PN long
array and should be cast to that type to obtain the elements.
.LP
.PN XGetWindowProperty
always allocates one extra byte in prop_return 
(even if the property is zero length) 
and sets it to zero so that simple properties consisting of characters
do not have to be copied into yet another string before use.
.LP
If delete is 
.PN True 
and bytes_after_return is zero, 
.PN XGetWindowProperty
deletes the property 
from the window and generates a 
.PN PropertyNotify 
event on the window.
.LP
The function returns
.PN Success
if it executes successfully.
To free the resulting data,
use
.PN XFree .
.LP
.PN XGetWindowProperty
can generate
.PN BadAtom ,
.PN BadValue ,
and
.PN BadWindow 
errors.
.LP
.sp
To obtain a given window's property list, use 
.PN XListProperties .
.IN "Property" "listing"
.IN "XListProperties" "" "@DEF@"
.sM
.FD 0
Atom *XListProperties\^(\^\fIdisplay\fP, \fIw\fP\^, \fInum_prop_return\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      int *\fInum_prop_return\fP\^; 
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose property list you want to obtain
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fInum_prop_return\fP 1i
Returns the length of the properties array.
.LP
.eM
The
.PN XListProperties
function returns a pointer to an array of atom properties that are defined for 
the specified window or returns NULL if no properties were found.
To free the memory allocated by this function, use
.PN XFree .
.LP
.PN XListProperties
can generate a
.PN BadWindow 
error.
.LP
.sp
To change a property of a given window, use
.PN XChangeProperty .
.IN "Property" "changing"
.IN "Property" "appending"
.IN "Property" "prepending"
.IN "Property" "replacing"
.IN "Property" "format"
.IN "Property" "type"
.IN "XChangeProperty" "" "@DEF@"
.sM
.FD 0
XChangeProperty\^(\^\fIdisplay\fP, \fIw\fP\^, \fIproperty\fP\^, \fItype\fP\^, \fIformat\fP\^, \fImode\fP\^, \fIdata\fP\^, \fInelements\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom \fIproperty\fP\^, \fItype\fP\^;
.br
      int \fIformat\fP\^;
.br
      int \fImode\fP\^;
.br
      unsigned char *\fIdata\fP\^;
.br
      int \fInelements\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose property you want to change
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fIproperty\fP 1i
Specifies the property name.
.IP \fItype\fP 1i
Specifies the type of the property.
The X server does not interpret the type but simply
passes it back to an application that later calls 
.PN XGetWindowProperty .
.IP \fIformat\fP 1i
Specifies whether the data should be viewed as a list
of 8-bit, 16-bit, or 32-bit quantities.
Possible values are 8, 16, and 32.
This information allows the X server to correctly perform
byte-swap operations as necessary.
If the format is 16-bit or 32-bit,
you must explicitly cast your data pointer to an (unsigned char *) in the call
to 
.PN XChangeProperty .
.\" Changed name of this file to prop_mode.a on 1/13/87
.IP \fImode\fP 1i
Specifies the mode of the operation.
You can pass
.PN PropModeReplace ,
.PN PropModePrepend ,
or
.PN PropModeAppend .
.IP \fIdata\fP 1i
Specifies the property data.
.IP \fInelements\fP 1i
Specifies the number of elements of the specified data format.
.LP
.eM
The
.PN XChangeProperty
function alters the property for the specified window and
causes the X server to generate a
.PN PropertyNotify
event on that window.
.PN XChangeProperty
performs the following:
.IP \(bu 5
If mode is
.PN PropModeReplace ,
.PN XChangeProperty
discards the previous property value and stores the new data.
.IP \(bu 5
If mode is
.PN PropModePrepend
or
.PN PropModeAppend ,
.PN XChangeProperty
inserts the specified data before the beginning of the existing data
or onto the end of the existing data, respectively.
The type and format must match the existing property value,
or a
.PN BadMatch
error results.
If the property is undefined, 
it is treated as defined with the correct type and
format with zero-length data.
.LP
If the specified format is 8, the property data must be a
.PN char
array.
If the specified format is 16, the property data must be a
.PN short
array.
If the specified format is 32, the property data must be a
.PN long
array.
.LP
The lifetime of a property is not tied to the storing client.
Properties remain until explicitly deleted, until the window is destroyed,
or until the server resets.
For a discussion of what happens when the connection to the X server is closed,
see section 2.6. 
The maximum size of a property is server dependent and can vary dynamically
depending on the amount of memory the server has available.
(If there is insufficient space, a
.PN BadAlloc
error results.)
.LP
.PN XChangeProperty
can generate
.PN BadAlloc ,
.PN BadAtom ,
.PN BadMatch ,
.PN BadValue ,
and
.PN BadWindow 
errors.
.LP
.sp
To rotate a window's property list, use
.PN XRotateWindowProperties .
.LP
.IN "XRotateWindowProperties" "" "@DEF@"
.sM
.FD 0
XRotateWindowProperties\^(\^\fIdisplay\fP, \fIw\fP, \fIproperties\fP, \fInum_prop\fP, \fInpositions\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom \fIproperties\fP\^[]\^;
.br
      int \fInum_prop\fP\^;
.br
      int \fInpositions\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIw\fP 1i
Specifies the window.
.IP \fIproperties\fP 1i
Specifies the array of properties that are to be rotated.
.IP \fInum_prop\fP 1i
Specifies the length of the properties array.
.IP \fInpositions\fP 1i
Specifies the rotation amount.
.LP
.eM
The
.PN XRotateWindowProperties
function allows you to rotate properties on a window and causes
the X server to generate
.PN PropertyNotify
events.
If the property names in the properties array are viewed as being numbered 
starting from zero and if there are num_prop property names in the list,
then the value associated with property name I becomes the value associated 
with property name (I + npositions) mod N for all I from zero to N \- 1.
The effect is to rotate the states by npositions places around the virtual ring
of property names (right for positive npositions, 
left for negative npositions).
If npositions mod N is nonzero,
the X server generates a
.PN PropertyNotify
event for each property in the order that they are listed in the array.
If an atom occurs more than once in the list or no property with that 
name is defined for the window,
a 
.PN BadMatch 
error results.
If a 
.PN BadAtom 
or 
.PN BadMatch 
error results,
no properties are changed.
.LP
.PN XRotateWindowProperties
can generate
.PN BadAtom ,
.PN BadMatch ,
and
.PN BadWindow 
errors.
.LP
.sp
To delete a property on a given window, use 
.PN XDeleteProperty .
.IN "Property" "deleting"
.IN "XDeleteProperty" "" "@DEF@"
.sM
.FD 0
XDeleteProperty\^(\^\fIdisplay\fP, \fIw\fP\^, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      Atom \fIproperty\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Wi whose property you want to delete
.IP \fIw\fP 1i
Specifies the window \*(Wi.
.IP \fIproperty\fP 1i
Specifies the property name.
.LP
.eM
The
.PN XDeleteProperty
function deletes the specified property only if the
property was defined on the specified window
and causes the X server to generate a
.PN PropertyNotify
event on the window unless the property does not exist.
.LP
.PN XDeleteProperty
can generate
.PN BadAtom
and
.PN BadWindow 
errors.
.NH 2
Selections
.XS
\*(SN Selections
.XE
.LP
.IN "Selection"
Selections are one method used by applications to exchange data.
By using the property mechanism,
applications can exchange data of arbitrary types and can negotiate
the type of the data.
A selection can be thought of as an indirect property with a dynamic type.
That is, rather than having the property stored in the X server,
the property is maintained by some client (the owner).
A selection is global in nature (considered to belong to the user 
but be maintained by clients) rather than being private to a particular 
window subhierarchy or a particular set of clients.
.LP
Xlib provides functions that you can use to set, get, or request conversion
of selections.
This allows applications to implement the notion of current selection,
which requires that notification be sent to applications when they no 
longer own the selection.
Applications that support selection often highlight the current selection
and so must be informed when another application has
acquired the selection so that they can unhighlight the selection.
.LP
When a client asks for the contents of
a selection, it specifies a selection target type.
This target type
can be used to control the transmitted representation of the contents.
For example, if the selection is ``the last thing the user clicked on''
and that is currently an image, then the target type might specify
whether the contents of the image should be sent in XY format or Z format.
.LP
The target type can also be used to control the class of
contents transmitted, for example, 
asking for the ``looks'' (fonts, line
spacing, indentation, and so forth) of a paragraph selection, not the
text of the paragraph.
The target type can also be used for other
purposes.
The protocol does not constrain the semantics.
.LP
.sp
To set the selection owner, use 
.PN XSetSelectionOwner .
.IN "Selection" "setting the owner"
.IN "XSetSelectionOwner" "" "@DEF@"
.sM
.FD 0
XSetSelectionOwner\^(\^\fIdisplay\fP, \fIselection\fP\^, \fIowner\fP\^, \fItime\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Atom \fIselection\fP\^;
.br
      Window \fIowner\fP\^; 
.br
      Time \fItime\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIselection\fP 1i
Specifies the selection atom.
.IP \fIowner\fP 1i
Specifies the owner of the specified selection atom.
You can pass a window or
.PN None .
.IP \fItime\fP 1i
Specifies the time.
You can pass either a timestamp or
.PN CurrentTime .
.LP
.eM
The
.PN XSetSelectionOwner
function changes the owner and last-change time for the specified selection
and has no effect if the specified time is earlier than the current
last-change time of the specified selection 
or is later than the current X server time.
Otherwise, the last-change time is set to the specified time,
with
.PN CurrentTime
replaced by the current server time.
If the owner window is specified as
.PN None ,
then the owner of the selection becomes 
.PN None
(that is, no owner).
Otherwise, the owner of the selection becomes the client executing
the request.
.LP 
If the new owner (whether a client or
.PN None )
is not
the same as the current owner of the selection and the current
owner is not
.PN None ,
the current owner is sent a 
.PN SelectionClear 
event.
If the client that is the owner of a selection is later
terminated (that is, its connection is closed)
or if the owner window it has specified in the request is later
destroyed,
the owner of the selection automatically
reverts to
.PN None ,
but the last-change time is not affected.
The selection atom is uninterpreted by the X server.
.PN XGetSelectionOwner
returns the owner window, which is reported in 
.PN SelectionRequest
and
.PN SelectionClear
events.
Selections are global to the X server.
.LP
.PN XSetSelectionOwner
can generate
.PN BadAtom
and
.PN BadWindow 
errors.
.LP
.sp
To return the selection owner, use 
.PN XGetSelectionOwner .
.IN "Selection" "getting the owner"
.IN "XGetSelectionOwner" "" "@DEF@"
.sM
.FD 0
Window XGetSelectionOwner\^(\^\fIdisplay\fP, \fIselection\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Atom \fIselection\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.ds Se whose owner you want returned
.IP \fIselection\fP 1i
Specifies the selection atom \*(Se.
.LP
.eM
The
.PN XGetSelectionOwner
function
returns the window ID associated with the window that currently owns the
specified selection.
If no selection was specified, the function returns the constant
.PN None .
If
.PN None
is returned,
there is no owner for the selection.
.LP
.PN XGetSelectionOwner
can generate a
.PN BadAtom 
error.
.LP
.sp
To request conversion of a selection, use 
.PN XConvertSelection .
.IN "Selection" "converting"
.IN "XConvertSelection" "" "@DEF@"
.sM
.FD 0
XConvertSelection\^(\^\fIdisplay\fP, \fIselection\fP\^, \fItarget\fP\^, \fIproperty\fP\^, \fIrequestor\fP\^, \fItime\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Atom \fIselection\fP\^, \fItarget\fP\^;
.br
      Atom \fIproperty\fP\^;
.br
      Window \fIrequestor\fP\^;
.br
      Time \fItime\fP\^;
.FN
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIselection\fP 1i
Specifies the selection atom.
.IP \fItarget\fP 1i
Specifies the target atom.
.IP \fIproperty\fP 1i
Specifies the property name.
You also can pass 
.PN None .
.IP \fIrequestor\fP 1i
Specifies the requestor.
.IP \fItime\fP 1i
Specifies the time.
You can pass either a timestamp or
.PN CurrentTime .
.LP
.eM
.PN XConvertSelection
requests that the specified selection be converted to the specified target
type:
.IP \(bu 5
If the specified selection has an owner, the X server sends a
.PN SelectionRequest
event to that owner.
.IP \(bu 5
If no owner for the specified
selection exists, the X server generates a
.PN SelectionNotify
event to the
requestor with property
.PN None .
.LP
The arguments are passed on unchanged in either of the events.
There are two predefined selection atoms: PRIMARY and SECONDARY.
.LP
.PN XConvertSelection
can generate
.PN BadAtom
and
.PN BadWindow 
errors.
.bp