home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xlib / CH03 < prev    next >
Encoding:
Text File  |  1991-08-18  |  83.6 KB  |  3,214 lines

  1. \&
  2. .sp 1
  3. .ce 3
  4. \s+1\fBChapter 3\fP\s-1
  5.  
  6. \s+1\fBWindow Functions\fP\s-1
  7. .sp 2
  8. .nr H1 3
  9. .nr H2 0
  10. .nr H3 0
  11. .nr H4 0
  12. .nr H5 0
  13. .na
  14. .LP
  15. .XS
  16. Chapter 3: Window Functions
  17. .XE
  18. In the X Window System, 
  19. a window is a rectangular area on the screen that lets you
  20. view graphic output.
  21. Client applications
  22. can display overlapping and nested windows on one or more
  23. screens that are driven by X servers on one or more machines.
  24. Clients who want to create windows must first 
  25. connect their program to the X server
  26. by calling 
  27. .PN XOpenDisplay .
  28. This chapter begins with a discussion of 
  29. visual types and window attributes.
  30. The chapter continues with a discussion of the Xlib functions you can use to:
  31. .IP \(bu 5
  32. Create windows 
  33. .IP \(bu 5
  34. Destroy windows
  35. .IP \(bu 5
  36. Map windows
  37. .IP \(bu 5
  38. Unmap windows
  39. .IP \(bu 5
  40. Configure windows
  41. .IP \(bu 5
  42. Change the stacking order
  43. .IP \(bu 5
  44. Change window attributes
  45. .RE
  46. .LP
  47. This chapter also identifies the window actions that may generate events.
  48. .LP
  49. Note that it is vital that your application conform to the
  50. established conventions for communicating with window managers
  51. for it to work well with the various window managers in use (see section 14.1).
  52. Toolkits generally adhere to these conventions for you,
  53. relieving you of the burden.
  54. Toolkits also often supersede many functions in this chapter
  55. with versions of their own.
  56. Refer to the documentation for the toolkit you are using
  57. for more information.
  58. .NH 2
  59. Visual Types
  60. .XS
  61. \*(SN Visual Types
  62. .XE
  63. .LP
  64. .IN "Visual Type" "" "@DEF@"
  65. On some display hardware, 
  66. it may be possible to deal with color resources in more than one way.
  67. For example, you may be able to deal with a screen of either 12-bit depth
  68. with arbitrary mapping of pixel to color (pseudo-color) or 24-bit depth
  69. with 8 bits of the pixel dedicated to each of red, green, and blue.
  70. These different ways of dealing with the visual aspects of the screen
  71. are called visuals.
  72. For each screen of the display, there may be a list of valid visual types
  73. supported at different depths of the screen.
  74. Because default windows and visual types are defined for each screen,
  75. most simple applications need not deal with this complexity.
  76. Xlib provides macros and functions that return the default root window, 
  77. the default depth of the default root window, and the default visual type
  78. (see sections 2.2.1 and 16.7).
  79. .LP
  80. Xlib uses an opaque 
  81. .PN Visual 
  82. .IN "Visual" "" "@DEF@"
  83. structure that contains information about the possible color mapping.
  84. The visual utility functions (see section 16.7) use an
  85. .PN XVisualInfo
  86. structure to return this information to an application.
  87. The members of this structure pertinent to this discussion are class, red_mask,
  88. green_mask, blue_mask, bits_per_rgb, and colormap_size.
  89. The class member specifies one of the possible visual classes of the screen
  90. and can be 
  91. .IN "Visual Classes" "StaticGray"
  92. .IN "Visual Classes" "StaticColor"
  93. .IN "Visual Classes" "TrueColor"
  94. .IN "Visual Classes" "StaticColor"
  95. .IN "Visual Classes" "GrayScale"
  96. .IN "Visual Classes" "PseudoColor"
  97. .PN StaticGray ,
  98. .PN StaticColor ,
  99. .PN TrueColor ,
  100. .PN GrayScale ,
  101. .PN PseudoColor ,
  102. or
  103. .PN DirectColor .
  104. .LP
  105. The following concepts may serve to make the explanation of
  106. visual types clearer. 
  107. The screen can be color or grayscale,
  108. can have a colormap that is writable or read-only,
  109. and can also have a colormap whose indices are decomposed into separate 
  110. RGB pieces, provided one is not on a grayscale screen.
  111. This leads to the following diagram:
  112. .LP
  113. .DS 0
  114. .TA 1.1i 1.6i 2.2i 2.7i 3.2i
  115. .ta 1.1i 1.6i 2.2i 2.7i 3.2i
  116.         Color          GrayScale
  117.     \ \ R/O      \ R/W     \ R/O    \ R/W
  118. +-------------------+----------------------------------------+
  119. \|| Undecomposed    |\ Static    |\ Pseudo    |\ Static    |\ Gray    |  
  120. \||  Colormap    |\ Color    |\ Color    |\ Gray    |\ Scale    |
  121. +-------------------+----------------------------------------+
  122. \|| Decomposed    |\ True    |\ Direct    |
  123. \||  Colormap    |\ Color    |\ Color    |
  124. +-------------------+--------------------+
  125. .DE
  126. .LP
  127. Conceptually, 
  128. as each pixel is read out of video memory for display on the screen,
  129. it goes through a look-up stage by indexing into a colormap.
  130. Colormaps can be manipulated arbitrarily on some hardware, 
  131. in limited ways on other hardware, and not at all on other hardware.  
  132. The visual types affect the colormap and 
  133. the RGB values in the following ways:
  134. .LP
  135. .IP \(bu 5
  136. For 
  137. .PN PseudoColor , 
  138. a pixel value indexes a colormap to produce
  139. independent RGB values, and the RGB values can be changed dynamically.
  140. .IP \(bu 5
  141. .PN GrayScale 
  142. is treated the same way as 
  143. .PN PseudoColor  
  144. except that the primary that drives the screen is undefined. 
  145. Thus, the client should always store the
  146. same value for red, green, and blue in the colormaps.  
  147. .IP \(bu 5
  148. For 
  149. .PN DirectColor ,
  150. a pixel value is decomposed into separate RGB subfields, and each
  151. subfield separately indexes the colormap for the corresponding value.
  152. The RGB values can be changed dynamically.  
  153. .IP \(bu 5
  154. .PN TrueColor
  155. is treated the same way as 
  156. .PN DirectColor 
  157. except that the colormap has predefined, read-only RGB values.
  158. These RGB values are server-dependent but provide linear or near-linear
  159. ramps in each primary.  
  160. .IP \(bu 5
  161. .PN StaticColor
  162. is treated the same way as 
  163. .PN PseudoColor 
  164. except that the colormap has predefined, 
  165. read-only, server-dependent RGB values.
  166. .IP \(bu 5
  167. .PN StaticGray 
  168. is treated the same way as 
  169. .PN StaticColor 
  170. except that the RGB values are equal for any single pixel
  171. value, thus resulting in shades of gray.  
  172. .PN StaticGray 
  173. with a two-entry
  174. colormap can be thought of as monochrome.
  175. .LP
  176. The red_mask, green_mask, and blue_mask members are only defined for
  177. .PN DirectColor
  178. and 
  179. .PN TrueColor . 
  180. Each has one contiguous set of bits with no
  181. intersections.
  182. The bits_per_rgb member specifies the log base 2 of the
  183. number of distinct color values (individually) of red, green, and blue.
  184. Actual RGB values are unsigned 16-bit numbers.
  185. The colormap_size member defines the number of available colormap entries
  186. in a newly created colormap.  
  187. For 
  188. .PN DirectColor 
  189. and 
  190. .PN TrueColor , 
  191. this is the size of an individual pixel subfield.
  192. .sp
  193. .LP
  194. To obtain the visual ID from a 
  195. .PN Visual ,
  196. use
  197. .PN XVisualIDFromVisual .
  198. .IN "XVisualIDFromVisual" "" "@DEF@"
  199. .\" Start marker code here
  200. .FD 0
  201. VisualID XVisualIDFromVisual\^(\^\fIvisual\fP\^)
  202. .br
  203.        Visual *\^\fIvisual\fP\^;
  204. .FN
  205. .\" $Header: visual_gen.a,v 1.1 88/07/10 10:05:08 mento Exp $
  206. .IP \fIvisual\fP 1i
  207. Specifies the visual type.
  208. .\" End marker code here
  209. .LP
  210. The
  211. .PN XVisualIDFromVisual
  212. function returns the visual ID for the specified visual type.
  213. .NH 2
  214. Window Attributes
  215. .XS
  216. \*(SN Window Attributes
  217. .XE
  218. .LP
  219. .IN "Window"
  220. .IN "Window" "attributes"
  221. All 
  222. .PN InputOutput
  223. windows have a border width of zero or more pixels, an optional background, 
  224. an event suppression mask (which suppresses propagation of events from 
  225. children), and a property list (see section 4.3).
  226. The window border and background can be a solid color or a pattern, called
  227. a tile.
  228. All windows except the root have a parent and are clipped by their parent.
  229. If a window is stacked on top of another window, it obscures that other
  230. window for the purpose of input.
  231. If a window has a background (almost all do), it obscures the other
  232. window for purposes of output.
  233. Attempts to output to the obscured area do nothing, 
  234. and no input events (for example, pointer motion) are generated for the 
  235. obscured area.
  236. .LP
  237. Windows also have associated property lists (see section 4.3).
  238. .LP
  239. Both
  240. .PN InputOutput
  241. and
  242. .PN InputOnly
  243. windows have the following common attributes,
  244. which are the only attributes of an
  245. .PN InputOnly
  246. window:
  247. .IP \(bu 5
  248. win-gravity
  249. .IP \(bu 5
  250. event-mask
  251. .IP \(bu 5
  252. do-not-propagate-mask
  253. .IP \(bu 5
  254. override-redirect
  255. .IP \(bu 5
  256. cursor
  257. .LP
  258. If you specify any other attributes for an
  259. .PN InputOnly
  260. window,
  261. a
  262. .PN BadMatch
  263. error results.
  264. .LP
  265. .PN InputOnly
  266. windows are used for controlling input events in situations where
  267. .PN InputOutput
  268. windows are unnecessary.
  269. .PN InputOnly
  270. windows are invisible; can only be used to control such things as
  271. cursors, input event generation, and grabbing;
  272. and cannot be used in any graphics requests.
  273. Note that
  274. .PN InputOnly
  275. windows cannot have
  276. .PN InputOutput
  277. windows as inferiors.
  278. .LP
  279. Windows have borders of a programmable width and pattern
  280. as well as a background pattern or tile.
  281. .IN "Tile" "pixmaps"
  282. Pixel values can be used for solid colors.
  283. .IN "Resource IDs" "freeing"
  284. .IN "Freeing" "resources"
  285. The background and border pixmaps can be destroyed immediately after
  286. creating the window if no further explicit references to them
  287. are to be made.
  288. .IN "Tile" "mode" 
  289. The pattern can either be relative to the parent 
  290. or absolute.
  291. If
  292. .PN ParentRelative ,
  293. the parent's background is used.
  294. .LP
  295. When windows are first created, 
  296. they are not visible (not mapped) on the screen.
  297. Any output to a window that is not visible on the screen 
  298. and that does not have backing store will be discarded.
  299. .IN "Window" "mapping"
  300. An application may wish to create a window long before it is
  301. mapped to the screen.
  302. When a window is eventually mapped to the screen 
  303. (using
  304. .PN XMapWindow ),
  305. .IN "XMapWindow"
  306. the X server generates an 
  307. .PN Expose 
  308. event for the window if backing store has not been maintained.
  309. .LP
  310. A window manager can override your choice of size, 
  311. border width, and position for a top-level window.
  312. Your program must be prepared to use the actual size and position
  313. of the top window.
  314. It is not acceptable for a client application to resize itself
  315. unless in direct response to a human command to do so.
  316. Instead, either your program should use the space given to it,
  317. or if the space is too small for any useful work, your program
  318. might ask the user to resize the window.
  319. The border of your top-level window is considered fair game 
  320. for window managers.
  321. .LP
  322. To set an attribute of a window,
  323. set the appropriate member of the
  324. .PN XSetWindowAttributes
  325. structure and OR in the corresponding value bitmask in your subsequent calls to
  326. .PN XCreateWindow
  327. and
  328. .PN XChangeWindowAttributes ,
  329. or use one of the other convenience functions that set the appropriate 
  330. attribute.
  331. The symbols for the value mask bits and the
  332. .PN XSetWindowAttributes
  333. structure are:
  334. .\" Start marker code here
  335. .LP
  336. /* Window attribute value mask bits */
  337. .TS
  338. lw(.5i) lw(2.5i) lw(.8i).
  339. T{
  340. #define
  341. T}    T{
  342. .PN CWBackPixmap
  343. T}    T{
  344. (1L<<0)
  345. T}
  346. T{
  347. #define
  348. T}    T{
  349. .PN CWBackPixel
  350. T}    T{
  351. (1L<<1)
  352. T}
  353. T{
  354. #define
  355. T}    T{
  356. .PN CWBorderPixmap
  357. T}    T{
  358. (1L<<2)
  359. T}
  360. T{
  361. #define
  362. T}    T{
  363. .PN CWBorderPixel
  364. T}    T{
  365. (1L<<3)
  366. T}
  367. T{
  368. #define
  369. T}    T{
  370. .PN CWBitGravity
  371. T}    T{
  372. (1L<<4)
  373. T}
  374. T{
  375. #define
  376. T}    T{
  377. .PN CWWinGravity
  378. T}    T{
  379. (1L<<5)
  380. T}
  381. T{
  382. #define
  383. T}    T{
  384. .PN CWBackingStore
  385. T}    T{
  386. (1L<<6)
  387. T}
  388. T{
  389. #define
  390. T}    T{
  391. .PN CWBackingPlanes
  392. T}    T{
  393. (1L<<7)
  394. T}
  395. T{
  396. #define
  397. T}    T{
  398. .PN CWBackingPixel
  399. T}    T{
  400. (1L<<8)
  401. T}
  402. T{
  403. #define
  404. T}    T{
  405. .PN CWOverrideRedirect
  406. T}    T{
  407. (1L<<9)
  408. T}
  409. T{
  410. #define
  411. T}    T{
  412. .PN CWSaveUnder
  413. T}    T{
  414. (1L<<10)
  415. T}
  416. T{
  417. #define
  418. T}    T{
  419. .PN CWEventMask
  420. T}    T{
  421. (1L<<11)
  422. T}
  423. T{
  424. #define
  425. T}    T{
  426. .PN CWDontPropagate
  427. T}    T{
  428. (1L<<12)
  429. T}
  430. T{
  431. #define
  432. T}    T{
  433. .PN CWColormap
  434. T}    T{
  435. (1L<<13)
  436. T}
  437. T{
  438. #define
  439. T}    T{
  440. .PN CWCursor
  441. T}    T{
  442. (1L<<14)
  443. T}
  444. .TE
  445. .IN "XSetWindowAttributes" "" "@DEF@"
  446. .Ds 0
  447. .TA .5i 3i
  448. .ta .5i 3i
  449. /* Values */
  450.  
  451. typedef struct {
  452.     Pixmap background_pixmap;    /* background, None, or ParentRelative */
  453.     unsigned long background_pixel;    /* background pixel */
  454.     Pixmap border_pixmap;        /* border of the window or CopyFromParent */
  455.     unsigned long border_pixel;    /* border pixel value */
  456.     int bit_gravity;    /* one of bit gravity values */
  457.     int win_gravity;    /* one of the window gravity values */
  458.     int backing_store;    /* NotUseful, WhenMapped, Always */
  459.     unsigned long backing_planes;    /* planes to be preserved if possible */
  460.     unsigned long backing_pixel;    /* value to use in restoring planes */
  461.     Bool save_under;    /* should bits under be saved? (popups) */
  462.     long event_mask;    /* set of events that should be saved */
  463.     long do_not_propagate_mask;    /* set of events that should not propagate */
  464.     Bool override_redirect;    /* boolean value for override_redirect */
  465.     Colormap colormap;    /* color map to be associated with window */
  466.     Cursor cursor;        /* cursor to be displayed (or None) */
  467. } XSetWindowAttributes;
  468. .De
  469. .\" End marker code here
  470. .LP
  471. The following lists the defaults for each window attribute and indicates
  472. whether the attribute is applicable to
  473. .PN InputOutput
  474. and
  475. .PN InputOnly
  476. windows:
  477. .TS H
  478. l l l l
  479. lw(1.4i) lw(1.3i) cw(.9i) cw(.8i).
  480. _
  481. .sp 6p
  482. T{
  483. .B Attribute
  484. T}    T{
  485. .B Default 
  486. T}    T{
  487. .PN InputOutput
  488. T}    T{
  489. .PN InputOnly
  490. T}
  491. .sp 6p
  492. _
  493. .sp 6p
  494. .TH
  495. .R
  496. T{
  497. background-pixmap
  498. T}    T{
  499. .PN None
  500. T}    T{
  501. Yes
  502. T}    T{
  503. No
  504. T}
  505. background-pixel    Undefined    Yes    No
  506. T{
  507. border-pixmap
  508. T}    T{
  509. .PN CopyFromParent
  510. T}    T{
  511. Yes
  512. T}    T{
  513. No
  514. T}
  515. border-pixel    Undefined    Yes    No
  516. T{
  517. bit-gravity
  518. T}    T{
  519. .PN ForgetGravity
  520. T}    T{
  521. Yes
  522. T}    T{
  523. No
  524. T}
  525. T{
  526. win-gravity
  527. T}    T{
  528. .PN NorthWestGravity
  529. T}    T{
  530. Yes
  531. T}    T{
  532. Yes
  533. T}
  534. T{
  535. backing-store
  536. T}    T{
  537. .PN NotUseful
  538. T}    T{
  539. Yes
  540. T}    T{
  541. No
  542. T}
  543. backing-planes    All ones    Yes    No
  544. backing-pixel    zero    Yes    No
  545. T{
  546. save-under
  547. T}    T{
  548. .PN False
  549. T}    T{
  550. Yes
  551. T}    T{
  552. No
  553. T}
  554. event-mask    empty set    Yes    Yes
  555. do-not-propagate-mask    empty set    Yes    Yes
  556. T{
  557. override-redirect
  558. T}    T{
  559. .PN False
  560. T}    T{
  561. Yes
  562. T}    T{
  563. Yes
  564. T}
  565. T{
  566. colormap
  567. T}    T{
  568. .PN CopyFromParent
  569. T}    T{
  570. Yes
  571. T}    T{
  572. No
  573. T}
  574. T{
  575. cursor
  576. T}    T{
  577. .PN None
  578. T}    T{
  579. Yes
  580. T}    T{
  581. Yes
  582. T}
  583. _
  584. .TE
  585. .NH 3
  586. Background Attribute
  587. .XS
  588. \*(SN Background Attribute
  589. .XE
  590. .LP
  591. Only
  592. .PN InputOutput
  593. windows can have a background.
  594. You can set the background of an
  595. .PN InputOutput
  596. window by using a pixel or a pixmap.
  597. .LP
  598. The background-pixmap attribute of a window specifies the pixmap to be used for 
  599. a window's background.
  600. This pixmap can be of any size, although some sizes may be faster than others.
  601. The background-pixel attribute of a window specifies a pixel value used to paint
  602. a window's background in a single color.
  603. .LP
  604. You can set the background-pixmap to a pixmap,  
  605. .PN None 
  606. (default), or 
  607. .PN ParentRelative .
  608. You can set the background-pixel of a window to any pixel value (no default).
  609. If you specify a background-pixel, 
  610. it overrides either the default background-pixmap
  611. or any value you may have set in the background-pixmap.
  612. A pixmap of an undefined size that is filled with the background-pixel is used 
  613. for the background.
  614. Range checking is not performed on the background pixel;
  615. it simply is truncated to the appropriate number of bits.
  616. .LP
  617. If you set the background-pixmap,
  618. it overrides the default.
  619. The background-pixmap and the window must have the same depth,
  620. or a
  621. .PN BadMatch
  622. error results.
  623. If you set background-pixmap to
  624. .PN None ,
  625. the window has no defined background.  
  626. If you set the background-pixmap to
  627. .PN ParentRelative :
  628. .IP \(bu 5
  629. The parent window's background-pixmap is used. 
  630. The child window, however, must have the same depth as 
  631. its parent,
  632. or a
  633. .PN BadMatch
  634. error results.
  635. .IP \(bu 5
  636. If the parent window has a background-pixmap of
  637. .PN None ,
  638. the window also has a background-pixmap of
  639. .PN None . 
  640. .IP \(bu 5
  641. A copy of the parent window's background-pixmap is not made.
  642. The parent's background-pixmap is examined each time the child window's 
  643. background-pixmap is required.  
  644. .IP \(bu 5
  645. The background tile origin always aligns with the parent window's
  646. background tile origin. 
  647. If the background-pixmap is not
  648. .PN ParentRelative ,
  649. the background tile origin is the child window's origin.
  650. .LP
  651. Setting a new background, whether by setting background-pixmap or
  652. background-pixel, overrides any previous background.
  653. The background-pixmap can be freed immediately if no further explicit reference
  654. is made to it (the X server will keep a copy to use when needed).
  655. If you later draw into the pixmap used for the background,
  656. what happens is undefined because the
  657. X implementation is free to make a copy of the pixmap or
  658. to use the same pixmap.
  659. .LP
  660. When no valid contents are available for regions of a window
  661. and either the regions are visible or the server is maintaining backing store,
  662. the server automatically tiles the regions with the window's background
  663. unless the window has a background of
  664. .PN None .
  665. If the background is
  666. .PN None ,
  667. the previous screen contents from other windows of the same depth as the window
  668. are simply left in place as long as the contents come from the parent of the
  669. window or an inferior of the parent.
  670. Otherwise, the initial contents of the exposed regions are undefined.
  671. .PN Expose 
  672. events are then generated for the regions, even if the background-pixmap
  673. is
  674. .PN None 
  675. (see section 10.9).
  676. .NH 3
  677. Border Attribute
  678. .XS
  679. \*(SN Border Attribute
  680. .XE
  681. .LP
  682. Only
  683. .PN InputOutput
  684. windows can have a border.
  685. You can set the border of an
  686. .PN InputOutput
  687. window by using a pixel or a pixmap.
  688. .LP
  689. The border-pixmap attribute of a window specifies the pixmap to be used 
  690. for a window's border.
  691. The border-pixel attribute of a window specifies a pixmap of undefined size 
  692. filled with that pixel be used for a window's border. 
  693. Range checking is not performed on the background pixel;
  694. it simply is truncated to the appropriate number of bits.
  695. The border tile origin is always the same as the background tile origin.
  696. .LP
  697. You can also set the border-pixmap to a pixmap of any size (some may be faster
  698. than others) or to
  699. .PN CopyFromParent 
  700. (default).
  701. You can set the border-pixel to any pixel value (no default).
  702. .LP
  703. If you set a border-pixmap, 
  704. it overrides the default.
  705. The border-pixmap and the window must have the same depth,
  706. or a
  707. .PN BadMatch
  708. error results.
  709. If you set the border-pixmap to 
  710. .PN CopyFromParent ,
  711. the parent window's border-pixmap is copied.
  712. Subsequent changes to the parent window's border attribute do not affect 
  713. the child window.
  714. However, the child window must have the same depth as the parent window,
  715. or a
  716. .PN BadMatch
  717. error results.
  718. .LP
  719. The border-pixmap can be freed immediately if no further explicit reference
  720. is made to it.
  721. If you later draw into the pixmap used for the border,
  722. what happens is undefined because the
  723. X implementation is free either to make a copy of the pixmap or
  724. to use the same pixmap.
  725. If you specify a border-pixel, 
  726. it overrides either the default border-pixmap
  727. or any value you may have set in the border-pixmap.
  728. All pixels in the window's border will be set to the border-pixel.
  729. Setting a new border, whether by setting border-pixel or by setting
  730. border-pixmap, overrides any previous border.
  731. .LP
  732. Output to a window is always clipped to the inside of the window. 
  733. Therefore, graphics operations never affect the window border.
  734. .NH 3
  735. Gravity Attributes
  736. .XS
  737. \*(SN Gravity Attributes
  738. .XE
  739. .LP
  740. The bit gravity of a window defines which region of the window should be 
  741. retained when an
  742. .PN InputOutput
  743. window is resized. 
  744. The default value for the bit-gravity attribute is 
  745. .PN ForgetGravity .
  746. The window gravity of a window allows you to define how the 
  747. .PN InputOutput
  748. or
  749. .PN InputOnly
  750. window should be repositioned if its parent is resized.  
  751. The default value for the win-gravity attribute is 
  752. .PN NorthWestGravity .
  753. .LP
  754. If the inside width or height of a window is not changed 
  755. and if the window is moved or its border is changed, 
  756. then the contents of the window are not lost but move with the window.
  757. Changing the inside width or height of the window causes its contents to be
  758. moved or lost (depending on the bit-gravity of the window) and causes
  759. children to be reconfigured (depending on their win-gravity).
  760. For a
  761. change of width and height, the (x, y) pairs are defined:
  762. .LP
  763. .TS
  764. l l
  765. l l.
  766. _
  767. .sp 6p
  768. .B
  769. Gravity Direction    Coordinates
  770. .sp 6p
  771. _
  772. .sp 6p
  773. .R
  774. T{
  775. .PN NorthWestGravity
  776. T}    T{
  777. (0, 0)
  778. T}
  779. T{
  780. .PN NorthGravity
  781. T}    T{
  782. (Width/2, 0)
  783. T}
  784. T{
  785. .PN NorthEastGravity
  786. T}    T{
  787. (Width, 0)
  788. T}
  789. T{
  790. .PN WestGravity
  791. T}    T{
  792. (0, Height/2)
  793. T}
  794. T{
  795. .PN CenterGravity
  796. T}    T{
  797. (Width/2, Height/2)
  798. T}
  799. T{
  800. .PN EastGravity
  801. T}    T{
  802. (Width, Height/2)
  803. T}
  804. T{
  805. .PN SouthWestGravity
  806. T}    T{
  807. (0, Height)
  808. T}
  809. T{
  810. .PN SouthGravity
  811. T}    T{
  812. (Width/2, Height)
  813. T}
  814. T{
  815. .PN SouthEastGravity
  816. T}    T{
  817. (Width, Height)
  818. T}
  819. .sp 6p
  820. _
  821. .TE
  822. .LP
  823. When a window with one of these bit-gravity values is resized, 
  824. the corresponding pair
  825. defines the change in position of each pixel in the window.
  826. When a window with one of these win-gravities has its parent window resized,
  827. the corresponding pair defines the change in position of the window 
  828. within the parent.
  829. When a window is so repositioned, a
  830. .PN GravityNotify
  831. event is generated (see section 10.10.5).
  832. .LP
  833. A bit-gravity of
  834. .PN StaticGravity 
  835. indicates that the contents or origin should not move relative to the 
  836. origin of the root window.
  837. If the change in size of the window is coupled with a change in position (x, y),
  838. then for bit-gravity the change in position of each pixel is (\-x, \-y), and for
  839. win-gravity the change in position of a child when its parent is so resized is
  840. (\-x, \-y).
  841. Note that
  842. .PN StaticGravity
  843. still only takes effect when the width or height of the window is changed, 
  844. not when the window is moved.
  845. .LP
  846. A bit-gravity of 
  847. .PN ForgetGravity 
  848. indicates that the window's contents are always discarded after a size change, 
  849. even if a backing store or save under has been requested.
  850. The window is tiled with its background
  851. and zero or more 
  852. .PN Expose 
  853. events are generated. 
  854. If no background is defined, the existing screen contents are not
  855. altered.
  856. Some X servers may also ignore the specified bit-gravity and 
  857. always generate 
  858. .PN Expose
  859. events.
  860. .LP
  861. The contents and borders of inferiors are not affected by their parent's
  862. bit-gravity.
  863. A server is permitted to ignore the specified bit-gravity and use
  864. .PN Forget
  865. instead.
  866. .LP
  867. A win-gravity of 
  868. .PN UnmapGravity 
  869. is like 
  870. .PN NorthWestGravity
  871. (the window is not moved),
  872. except the child is also
  873. unmapped when the parent is resized,
  874. and an 
  875. .PN UnmapNotify 
  876. event is
  877. generated.
  878. .NH 3
  879. Backing Store Attribute
  880. .XS
  881. \*(SN Backing Store Attribute
  882. .XE
  883. .LP
  884. Some implementations of the X server may choose to maintain the contents of 
  885. .PN InputOutput
  886. windows.
  887. If the X server maintains the contents of a window, 
  888. the off-screen saved pixels
  889. are known as backing store.
  890. The backing store advises the X server on what to do 
  891. with the contents of a window.
  892. The backing-store attribute can be set to
  893. .PN NotUseful 
  894. (default),
  895. .PN WhenMapped ,
  896. or
  897. .PN Always .
  898. .LP
  899. A backing-store attribute of 
  900. .PN NotUseful 
  901. advises the X server that 
  902. maintaining contents is unnecessary, 
  903. although some X implementations may
  904. still choose to maintain contents and, therefore, not generate 
  905. .PN Expose
  906. events.
  907. A backing-store attribute of 
  908. .PN WhenMapped 
  909. advises the X server that maintaining contents of 
  910. obscured regions when the window is mapped would be beneficial.
  911. In this case,
  912. the server may generate an 
  913. .PN Expose 
  914. event when the window is created.
  915. A backing-store attribute of 
  916. .PN Always 
  917. advises the X server that maintaining contents even when 
  918. the window is unmapped would be beneficial.  
  919. Even if the window is larger than its parent, 
  920. this is a request to the X server to maintain complete contents, 
  921. not just the region within the parent window boundaries.  
  922. While the X server maintains the window's contents, 
  923. .PN Expose 
  924. events normally are not generated, 
  925. but the X server may stop maintaining 
  926. contents at any time.  
  927. .LP
  928. When the contents of obscured regions of a window are being maintained,
  929. regions obscured by noninferior windows are included in the destination
  930. of graphics requests (and source, when the window is the source).
  931. However, regions obscured by inferior windows are not included.
  932. .NH 3
  933. Save Under Flag
  934. .XS
  935. \*(SN Save Under Flag
  936. .XE
  937. .IN "Save Unders"
  938. .LP
  939. Some server implementations may preserve contents of 
  940. .PN InputOutput
  941. windows under other 
  942. .PN InputOutput
  943. windows.
  944. This is not the same as preserving the contents of a window for you.
  945. You may get better visual
  946. appeal if transient windows (for example, pop-up menus) request that the system
  947. preserve the screen contents under them, 
  948. so the temporarily obscured applications do not have to repaint.
  949. .LP
  950. You can set the save-under flag to
  951. .PN True
  952. or
  953. .PN False 
  954. (default).
  955. If save-under is 
  956. .PN True , 
  957. the X server is advised that, when this window is mapped, 
  958. saving the contents of windows it obscures would be beneficial.
  959. .NH 3
  960. Backing Planes and Backing Pixel Attributes
  961. .XS
  962. \*(SN Backing Planes and Backing Pixel Attributes
  963. .XE
  964. .LP
  965. You can set backing planes to indicate (with bits set to 1) 
  966. which bit planes of an
  967. .PN InputOutput
  968. window hold dynamic data that must be preserved in backing store 
  969. and during save unders.
  970. The default value for the backing-planes attribute is all bits set to 1.
  971. You can set backing pixel to specify what bits to use in planes not 
  972. covered by backing planes.
  973. The default value for the backing-pixel attribute is all bits set to 0.
  974. The X server is free to save only the specified bit planes in the backing store
  975. or the save under and is free to regenerate the remaining planes with 
  976. the specified pixel value.
  977. Any extraneous bits in these values (that is, those bits beyond 
  978. the specified depth of the window) may be simply ignored.
  979. If you request backing store or save unders,
  980. you should use these members to minimize the amount of off-screen memory 
  981. required to store your window.
  982. .NH 3
  983. Event Mask and Do Not Propagate Mask Attributes
  984. .XS
  985. \*(SN Event Mask and Do Not Propagate Mask Attributes
  986. .XE
  987. .LP
  988. The event mask defines which events the client is interested in for this 
  989. .PN InputOutput
  990. or
  991. .PN InputOnly
  992. window (or, for some event types, inferiors of this window).
  993. The event mask is the bitwise inclusive OR of zero or more of the 
  994. valid event mask bits.
  995. You can specify that no maskable events are reported by setting 
  996. .PN NoEventMask 
  997. (default).
  998. .LP
  999. The do-not-propagate-mask attribute
  1000. defines which events should not be propagated to 
  1001. ancestor windows when no client has the event type selected in this 
  1002. .PN InputOutput
  1003. or
  1004. .PN InputOnly
  1005. window.
  1006. The do-not-propagate-mask is the bitwise inclusive OR of zero or more
  1007. of the following masks:
  1008. .PN KeyPress , 
  1009. .PN KeyRelease ,
  1010. .PN ButtonPress , 
  1011. .PN ButtonRelease ,
  1012. .PN PointerMotion ,
  1013. .PN Button1Motion , 
  1014. .PN Button2Motion , 
  1015. .PN Button3Motion ,
  1016. .PN Button4Motion , 
  1017. .PN Button5Motion , 
  1018. and
  1019. .PN ButtonMotion .
  1020. You can specify that all events are propagated by setting 
  1021. .PN NoEventMask 
  1022. (default).
  1023. .NH 3
  1024. Override Redirect Flag
  1025. .XS
  1026. \*(SN Override Redirect Flag
  1027. .XE
  1028. .LP
  1029. To control window placement or to add decoration,
  1030. a window manager often needs to intercept (redirect) any map or configure
  1031. request.
  1032. Pop-up windows, however, often need to be mapped without a window manager
  1033. getting in the way.
  1034. To control whether an
  1035. .PN InputOutput
  1036. or
  1037. .PN InputOnly
  1038. window is to ignore these structure control facilities,
  1039. use the override-redirect flag.
  1040. .LP
  1041. The override-redirect flag specifies whether map and configure requests 
  1042. on this window should override a 
  1043. .PN SubstructureRedirectMask 
  1044. on the parent.
  1045. You can set the override-redirect flag to
  1046. .PN True
  1047. or
  1048. .PN False 
  1049. (default).
  1050. Window managers use this information to avoid tampering with pop-up windows
  1051. (see also chapter 14).
  1052. .NH 3
  1053. Colormap Attribute
  1054. .XS
  1055. \*(SN Colormap Attribute
  1056. .XE
  1057. .LP
  1058. The colormap attribute specifies which colormap best reflects the true
  1059. colors of the 
  1060. .PN InputOutput
  1061. window.  
  1062. The colormap must have the same visual type as the window,
  1063. or a 
  1064. .PN BadMatch 
  1065. error results.  
  1066. X servers capable of supporting multiple 
  1067. hardware colormaps can use this information, 
  1068. and window managers can use it for calls to
  1069. .PN XInstallColormap .
  1070. You can set the colormap attribute to a colormap or to
  1071. .PN CopyFromParent
  1072. (default).
  1073. .LP
  1074. If you set the colormap to
  1075. .PN CopyFromParent ,
  1076. the parent window's colormap is copied and used by its child.
  1077. However, the child window must have the same visual type as the parent, 
  1078. or a 
  1079. .PN BadMatch 
  1080. error results. 
  1081. The parent window must not have a colormap of 
  1082. .PN None ,
  1083. or a 
  1084. .PN BadMatch 
  1085. error results.
  1086. The colormap is copied by sharing the colormap object between the child 
  1087. and parent, not by making a complete copy of the colormap contents.
  1088. Subsequent changes to the parent window's colormap attribute do
  1089. not affect the child window.
  1090. .NH 3
  1091. Cursor Attribute
  1092. .XS
  1093. \*(SN Cursor Attribute
  1094. .XE
  1095. .LP
  1096. The cursor attribute specifies which cursor is to be used when the pointer is
  1097. in the 
  1098. .PN InputOutput
  1099. or
  1100. .PN InputOnly
  1101. window.
  1102. You can set the cursor to a cursor or
  1103. .PN None
  1104. (default).
  1105. .LP
  1106. If you set the cursor to
  1107. .PN None ,
  1108. the parent's cursor is used when the 
  1109. pointer is in the 
  1110. .PN InputOutput
  1111. or
  1112. .PN InputOnly
  1113. window, and any change in the parent's cursor will cause an
  1114. immediate change in the displayed cursor.
  1115. By calling
  1116. .PN XFreeCursor ,
  1117. the cursor can be freed immediately as long as no further explicit reference 
  1118. to it is made.
  1119. .NH 2
  1120. Creating Windows
  1121. .XS
  1122. \*(SN Creating Windows
  1123. .XE
  1124. .LP
  1125. Xlib provides basic ways for creating windows,
  1126. and toolkits often supply higher-level functions specifically for
  1127. creating and placing top-level windows,
  1128. which are discussed in the appropriate toolkit documentation.
  1129. If you do not use a toolkit, however,
  1130. you must provide some standard information or hints for the window
  1131. manager by using the Xlib inter-client communication functions
  1132. (see chapter 14).
  1133. .LP
  1134. If you use Xlib to create your own top-level windows
  1135. (direct children of the root window),
  1136. you must observe the following rules so that all applications interact
  1137. reasonably across the different styles of window management:
  1138. .IP \(bu 5
  1139. You must never fight with the window manager for the size or
  1140. placement of your top-level window.
  1141. .IP \(bu 5
  1142. You must be able to deal with whatever size window you get, 
  1143. even if this means that your application just prints a message 
  1144. like ``Please make me bigger'' in its window.
  1145. .IP \(bu 5
  1146. You should only attempt to resize or move top-level windows in
  1147. direct response to a user request.
  1148. If a request to change the size of a top-level window fails,
  1149. you must be prepared to live with what you get.
  1150. You are free to resize or move the children of top-level
  1151. windows as necessary.
  1152. (Toolkits often have facilities for automatic relayout.)
  1153. .IP \(bu 5
  1154. If you do not use a toolkit that automatically sets standard window properties,
  1155. you should set these properties for top-level windows before mapping them.
  1156. .LP
  1157. For further information,
  1158. see chapter 14 and the \fIInter-Client Communication Conventions Manual\fP.
  1159. .LP
  1160. .PN XCreateWindow
  1161. is the more general function that allows you to set specific window attributes 
  1162. when you create a window.
  1163. .PN XCreateSimpleWindow 
  1164. creates a window that inherits its attributes from its parent window.
  1165. .LP
  1166. .IN "Window" "InputOnly"
  1167. The X server acts as if 
  1168. .PN InputOnly 
  1169. windows do not exist for
  1170. the purposes of graphics requests, exposure processing, and
  1171. .PN VisibilityNotify 
  1172. events.
  1173. An 
  1174. .PN InputOnly 
  1175. window cannot be used as a
  1176. drawable (that is, as a source or destination for graphics requests).
  1177. .PN InputOnly
  1178. and 
  1179. .PN InputOutput 
  1180. windows act identically in other respects (properties,
  1181. grabs, input control, and so on).
  1182. Extension packages can define other classes of windows.
  1183. .LP
  1184. To create an unmapped window and set its window attributes, use
  1185. .PN XCreateWindow .
  1186. .IN "XCreateWindow" "" "@DEF@"
  1187. .\" Start marker code here
  1188. .FD 0
  1189. .\" $Header: XWindow.f,v 1.1 88/02/26 10:04:14 mento Exp $
  1190. Window XCreateWindow\^(\^\fIdisplay\fP, \fIparent\fP\^, \fIx\fP\^, \fIy\fP\^, \fIwidth\fP\^, \fIheight\fP\^, \fIborder_width\fP\^, \fIdepth\fP\^, 
  1191. .br
  1192.                        \fIclass\fP\^, \fIvisual\fP\^, \fIvaluemask\fP\^, \fIattributes\fP\^)
  1193. .br
  1194.       Display *\fIdisplay\fP\^;
  1195. .br
  1196.       Window \fIparent\fP\^;
  1197. .br
  1198.       int \fIx\fP\^, \fIy\fP\^; 
  1199. .br
  1200.       unsigned int \fIwidth\fP\^, \fIheight\fP\^;
  1201. .br
  1202.       unsigned int \fIborder_width\fP\^;
  1203. .br
  1204.       int \fIdepth\fP\^;
  1205. .br
  1206.       unsigned int \fIclass\fP\^;
  1207. .br
  1208.       Visual *\fIvisual\fP\^
  1209. .br
  1210.       unsigned long \fIvaluemask\fP\^;
  1211. .br
  1212.       XSetWindowAttributes *\fIattributes\fP\^;
  1213. .FN
  1214. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1215. .IP \fIdisplay\fP 1i
  1216. Specifies the connection to the X server.
  1217. .\" $Header: parent.a,v 1.2 88/05/07 11:34:55 mento Exp $
  1218. .IP \fIparent\fP 1i
  1219. Specifies the parent window.
  1220. .ds Xy , which are the top-left outside corner of the created window's \
  1221. borders and are relative to the inside of the parent window's borders
  1222. .\" $Header: xy_gen.a,v 1.2 88/08/04 11:22:37 mento Exp $
  1223. .IP \fIx\fP 1i
  1224. .br
  1225. .ns
  1226. .IP \fIy\fP 1i
  1227. Specify the x and y coordinates\*(Xy.
  1228. .ds Wh , which are the created window's inside dimensions \
  1229. and do not include the created window's borders
  1230. .\" $Header: w+h_gen.a,v 1.2 88/08/04 11:21:28 mento Exp $
  1231. .IP \fIwidth\fP 1i
  1232. .br
  1233. .ns
  1234. .IP \fIheight\fP 1i
  1235. Specify the width and height\*(Wh.
  1236. The dimensions must be nonzero,
  1237. or a
  1238. .PN BadValue
  1239. error results.
  1240. .\" $Header: borderwidth.a,v 1.4 88/05/07 11:43:25 mento Exp $
  1241. .IP \fIborder_width\fP 1i
  1242. Specifies the width of the created window's border in pixels.
  1243. .\" $Header: depth.a,v 1.3 88/05/07 11:48:11 mento Exp $
  1244. .IP \fIdepth\fP 1i
  1245. Specifies the window's depth.
  1246. A depth of 
  1247. .PN CopyFromParent
  1248. means the depth is taken from the parent.
  1249. .\" $Header: class.a,v 1.2 88/04/04 11:10:33 mento Exp $
  1250. .IP \fIclass\fP 1i
  1251. Specifies the created window's class.
  1252. You can pass
  1253. .PN InputOutput , 
  1254. .PN InputOnly , 
  1255. or 
  1256. .PN CopyFromParent .
  1257. A class of 
  1258. .PN CopyFromParent
  1259. means the class
  1260. is taken from the parent.
  1261. .\" $Header: visual.a,v 1.1 88/02/26 10:32:16 mento Exp $
  1262. .IP \fIvisual\fP 1i
  1263. Specifies the visual type.
  1264. A visual of 
  1265. .PN CopyFromParent 
  1266. means the visual type is taken from the 
  1267. parent.
  1268. .\" $Header: valuemask.a,v 1.1 88/02/26 10:32:07 mento Exp $
  1269. .IP \fIvaluemask\fP 1i
  1270. Specifies which window attributes are defined in the attributes
  1271. argument.
  1272. This mask is the bitwise inclusive OR of the valid attribute mask bits.
  1273. If valuemask is zero,
  1274. the attributes are ignored and are not referenced.
  1275. .\" $Header: attributes.a,v 1.4 88/05/07 11:49:37 mento Exp $
  1276. .IP \fIattributes\fP 1i
  1277. Specifies the structure from which the values (as specified by the value mask)
  1278. are to be taken.
  1279. The value mask should have the appropriate bits
  1280. set to indicate which attributes have been set in the structure.
  1281. .\" End marker code here
  1282. .LP
  1283. .\" $Header: XWindow.d,v 1.3 88/08/17 08:19:17 mento Exp $
  1284. The
  1285. .PN XCreateWindow
  1286. function creates an unmapped subwindow for a specified parent window, 
  1287. returns the window ID of the created window, 
  1288. and causes the X server to generate a
  1289. .PN CreateNotify
  1290. event.
  1291. The created window is placed on top in the stacking order 
  1292. with respect to siblings.
  1293. .LP
  1294. The coordinate system has the X axis horizontal and the Y axis vertical, 
  1295. with the origin [0, 0] at the upper left.
  1296. Coordinates are integral,
  1297. in terms of pixels,
  1298. and coincide with pixel centers.
  1299. Each window and pixmap has its own coordinate system.
  1300. For a window, 
  1301. the origin is inside the border at the inside upper left.
  1302. .LP
  1303. The border_width for an
  1304. .PN InputOnly
  1305. window must be zero, or a
  1306. .PN BadMatch
  1307. error results.
  1308. For class
  1309. .PN InputOutput ,
  1310. the visual type and depth must be a combination supported for the screen,
  1311. or a
  1312. .PN BadMatch
  1313. error results.
  1314. The depth need not be the same as the parent,
  1315. but the parent must not be a window of class 
  1316. .PN InputOnly ,
  1317. or a
  1318. .PN BadMatch
  1319. error results.
  1320. For an
  1321. .PN InputOnly
  1322. window,
  1323. the depth must be zero, and the visual must be one supported by the screen.
  1324. If either condition is not met,
  1325. a
  1326. .PN BadMatch
  1327. error results.
  1328. The parent window, however, may have any depth and class.
  1329. If you specify any invalid window attribute for a window, a
  1330. .PN BadMatch
  1331. error results.
  1332. .LP
  1333. The created window is not yet displayed (mapped) on the user's display.
  1334. To display the window, call
  1335. .PN XMapWindow .
  1336. The new window initially uses the same cursor as
  1337. its parent. 
  1338. A new cursor can be defined for the new window by calling
  1339. .PN XDefineCursor .
  1340. .IN "Cursor" "Initial State"
  1341. .IN "XDefineCursor" 
  1342. The window will not be visible on the screen unless it and all of its
  1343. ancestors are mapped and it is not obscured by any of its ancestors.
  1344. .LP
  1345. .PN XCreateWindow
  1346. can generate
  1347. .PN BadAlloc ,
  1348. .PN BadColor ,
  1349. .PN BadCursor ,
  1350. .PN BadMatch ,
  1351. .PN BadPixmap ,
  1352. .PN BadValue ,
  1353. and
  1354. .PN BadWindow 
  1355. errors.
  1356. .LP
  1357. .sp
  1358. To create an unmapped 
  1359. .PN InputOutput
  1360. subwindow of a given parent window, use
  1361. .PN XCreateSimpleWindow .
  1362. .IN "XCreateSimpleWindow" "" "@DEF@"
  1363. .\" Start marker code here
  1364. .FD 0
  1365. .\" $Header: XCreWin.f,v 1.2 88/04/05 13:35:18 mento Exp $
  1366. Window XCreateSimpleWindow\^(\^\fIdisplay\fP, \fIparent\fP\^, \fIx\fP\^, \fIy\fP\^, \fIwidth\fP\^, \fIheight\fP\^, \fIborder_width\fP\^, 
  1367. .br
  1368.                              \fIborder\fP\^, \fIbackground\fP\^)
  1369. .br
  1370.       Display *\fIdisplay\fP\^;
  1371. .br
  1372.       Window \fIparent\fP\^;
  1373. .br
  1374.       int \fIx\fP\^, \fIy\fP\^;
  1375. .br
  1376.       unsigned int \fIwidth\fP\^, \fIheight\fP\^;
  1377. .br
  1378.       unsigned int \fIborder_width\fP\^;
  1379. .br
  1380.       unsigned long \fIborder\fP\^;
  1381. .br
  1382.       unsigned long \fIbackground\fP\^;
  1383. .FN
  1384. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1385. .IP \fIdisplay\fP 1i
  1386. Specifies the connection to the X server.
  1387. .\" $Header: parent.a,v 1.2 88/05/07 11:34:55 mento Exp $
  1388. .IP \fIparent\fP 1i
  1389. Specifies the parent window.
  1390. .ds Xy , which are the top-left outside corner of the new window's borders \
  1391. and are relative to the inside of the parent window's borders
  1392. .\" $Header: xy_gen.a,v 1.2 88/08/04 11:22:37 mento Exp $
  1393. .IP \fIx\fP 1i
  1394. .br
  1395. .ns
  1396. .IP \fIy\fP 1i
  1397. Specify the x and y coordinates\*(Xy.
  1398. .ds Wh , which are the created window's inside dimensions \
  1399. and do not include the created window's borders
  1400. .\" $Header: w+h_gen.a,v 1.2 88/08/04 11:21:28 mento Exp $
  1401. .IP \fIwidth\fP 1i
  1402. .br
  1403. .ns
  1404. .IP \fIheight\fP 1i
  1405. Specify the width and height\*(Wh.
  1406. The dimensions must be nonzero,
  1407. or a
  1408. .PN BadValue
  1409. error results.
  1410. .\" $Header: borderwidth.a,v 1.4 88/05/07 11:43:25 mento Exp $
  1411. .IP \fIborder_width\fP 1i
  1412. Specifies the width of the created window's border in pixels.
  1413. .\" $Header: border.a,v 1.1 88/02/26 10:05:15 mento Exp $
  1414. .IP \fIborder\fP 1i
  1415. Specifies the border pixel value of the window.
  1416. .\" $Header: backpixel.a,v 1.1 88/02/26 10:05:04 mento Exp $
  1417. .IP \fIbackground\fP 1i
  1418. Specifies the background pixel value of the window.
  1419.  
  1420. .\" End marker code here
  1421. .LP
  1422. .\" $Header: XCreWin.d,v 1.2 88/06/11 07:49:39 mento Exp $
  1423. The
  1424. .PN XCreateSimpleWindow
  1425. function creates an unmapped
  1426. .PN InputOutput
  1427. subwindow for a specified parent window, returns the
  1428. window ID of the created window, and causes the X server to generate a
  1429. .PN CreateNotify
  1430. event.
  1431. The created window is placed on top in the stacking order with respect to 
  1432. siblings.
  1433. Any part of the window that extends outside its parent window is clipped.
  1434. The border_width for an
  1435. .PN InputOnly
  1436. window must be zero, or a
  1437. .PN BadMatch
  1438. error results.
  1439. .PN XCreateSimpleWindow
  1440. inherits its depth, class, and visual from its parent.
  1441. All other window attributes, except background and border, 
  1442. have their default values.
  1443. .LP
  1444. .PN XCreateSimpleWindow
  1445. can generate
  1446. .PN BadAlloc ,
  1447. .PN BadMatch ,
  1448. .PN BadValue ,
  1449. and
  1450. .PN BadWindow 
  1451. errors.
  1452. .NH 2
  1453. Destroying Windows
  1454. .XS
  1455. \*(SN Destroying Windows 
  1456. .XE
  1457. .LP
  1458. Xlib provides functions that you can use to destroy a window or destroy all
  1459. subwindows of a window.
  1460. .LP
  1461. .sp
  1462. To destroy a window and all of its subwindows, use
  1463. .PN XDestroyWindow .
  1464. .IN "XDestroyWindow" "" "@DEF@"
  1465. .\" Start marker code here
  1466. .FD 0
  1467. .\" $Header: XDestroyWind.f,v 1.1 88/02/26 09:59:40 mento Exp $
  1468. XDestroyWindow\^(\^\fIdisplay\fP, \fIw\fP\^)
  1469. .br
  1470.       Display *\fIdisplay\fP\^;
  1471. .br
  1472.       Window \fIw\fP\^;
  1473. .FN
  1474. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1475. .IP \fIdisplay\fP 1i
  1476. Specifies the connection to the X server.
  1477. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1478. .IP \fIw\fP 1i
  1479. Specifies the window.
  1480. .\" End marker code here
  1481. .LP
  1482. .\" $Header: XDestroyWind.d,v 1.3 88/08/17 08:20:48 mento Exp $
  1483. The
  1484. .PN XDestroyWindow
  1485. function destroys the specified window as well as all of its subwindows and causes
  1486. the X server to generate a
  1487. .PN DestroyNotify
  1488. event for each window.
  1489. The window should never be referenced again.
  1490. If the window specified by the w argument is mapped,
  1491. it is unmapped automatically.
  1492. The ordering of the
  1493. .PN DestroyNotify
  1494. events is such that for any given window being destroyed,
  1495. .PN DestroyNotify
  1496. is generated on any inferiors of the window before being generated on
  1497. the window itself.
  1498. The ordering among siblings and across subhierarchies is not otherwise
  1499. constrained.
  1500. If the window you specified is a root window, no windows are destroyed.
  1501. Destroying a mapped window will generate 
  1502. .PN Expose 
  1503. events on other windows that were obscured by the window being destroyed.
  1504. .LP
  1505. .PN XDestroyWindow
  1506. can generate a
  1507. .PN BadWindow 
  1508. error.
  1509. .LP
  1510. .sp
  1511. To destroy all subwindows of a specified window, use 
  1512. .PN XDestroySubwindows .
  1513. .IN "XDestroySubwindows" "" "@DEF@"
  1514. .\" Start marker code here
  1515. .FD 0
  1516. .\" $Header: XDestroySubs.f,v 1.1 88/02/26 09:59:40 mento Exp $
  1517. XDestroySubwindows\^(\^\fIdisplay\fP, \fIw\fP\^)
  1518. .br
  1519.       Display *\fIdisplay\fP\^;
  1520. .br
  1521.       Window \fIw\fP\^;
  1522. .FN
  1523. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1524. .IP \fIdisplay\fP 1i
  1525. Specifies the connection to the X server.
  1526. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1527. .IP \fIw\fP 1i
  1528. Specifies the window.
  1529. .\" End marker code here
  1530. .LP
  1531. .\" $Header: XDestroySubs.d,v 1.4 88/06/11 07:50:01 mento Exp $
  1532. The
  1533. .PN XDestroySubwindows
  1534. function destroys all inferior windows of the specified window, 
  1535. in bottom-to-top stacking order.
  1536. It causes the X server to generate a
  1537. .PN DestroyNotify
  1538. event for each window.
  1539. If any mapped
  1540. subwindows were actually destroyed,
  1541. .PN XDestroySubwindows
  1542. causes the X server to generate 
  1543. .PN Expose 
  1544. events on the specified window.
  1545. This is much more efficient than deleting many windows
  1546. one at a time because much of the work need be performed only once for all
  1547. of the windows, rather than for each window.
  1548. The subwindows should never be referenced again.  
  1549. .LP
  1550. .PN XDestroySubwindows
  1551. can generate a
  1552. .PN BadWindow 
  1553. error.
  1554. .NH 2
  1555. Mapping Windows 
  1556. .XS
  1557. \*(SN Mapping Windows 
  1558. .XE
  1559. .LP
  1560. A window is considered mapped if an 
  1561. .PN XMapWindow
  1562. call has been made on it.
  1563. It may not be visible on the screen for one of the following reasons:
  1564. .IP \(bu 5
  1565. It is obscured by another opaque window.
  1566. .IP \(bu 5
  1567. One of its ancestors is not mapped.
  1568. .IP \(bu 5
  1569. It is entirely clipped by an ancestor.
  1570. .LP
  1571. .PN Expose 
  1572. events are generated for the window when part or all of
  1573. it becomes visible on the screen. 
  1574. A client receives the
  1575. .PN Expose 
  1576. events only if it has asked for them.
  1577. Windows retain their position in the stacking order when they are unmapped.
  1578. .LP
  1579. A window manager may want to control the placement of subwindows.
  1580. If 
  1581. .PN SubstructureRedirectMask 
  1582. has been selected by a window manager
  1583. on a parent window (usually a root window),
  1584. a map request initiated by other clients on a child window is not performed,
  1585. and the window manager is sent a 
  1586. .PN MapRequest 
  1587. event.
  1588. However, if the override-redirect flag on the child had been set to
  1589. .PN True
  1590. (usually only on pop-up menus),
  1591. the map request is performed.
  1592. .LP
  1593. A tiling window manager might decide to reposition and resize other clients' 
  1594. windows and then decide to map the window to its final location.
  1595. A window manager that wants to provide decoration might
  1596. reparent the child into a frame first.
  1597. For further information,
  1598. see section 3.2.8 and section 10.10.
  1599. Only a single client at a time can select for 
  1600. .PN SubstructureRedirectMask .
  1601. .LP
  1602. Similarly, a single client can select for 
  1603. .PN ResizeRedirectMask 
  1604. on a parent window.
  1605. Then, any attempt to resize the window by another client is suppressed, and
  1606. the client receives a 
  1607. .PN ResizeRequest 
  1608. event.
  1609. .LP
  1610. .sp
  1611. To map a given window, use 
  1612. .PN XMapWindow .
  1613. .IN "XMapWindow" "" "@DEF@"
  1614. .\" Start marker code here
  1615. .FD 0
  1616. .\" $Header: XMapWindow.f,v 1.1 88/02/26 10:01:30 mento Exp $
  1617. XMapWindow\^(\^\fIdisplay\fP, \fIw\fP\^)
  1618. .br
  1619.       Display *\fIdisplay\fP\^;
  1620. .br
  1621.       Window \fIw\fP\^;
  1622. .FN
  1623. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1624. .IP \fIdisplay\fP 1i
  1625. Specifies the connection to the X server.
  1626. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1627. .IP \fIw\fP 1i
  1628. Specifies the window.
  1629. .\" End marker code here
  1630. .LP
  1631. .\" $Header: XMapWindow.d,v 1.3 88/06/11 07:51:58 mento Exp $
  1632. The
  1633. .PN XMapWindow
  1634. function
  1635. maps the window and all of its
  1636. subwindows that have had map requests.
  1637. Mapping a window that has an unmapped ancestor does not display the
  1638. window but marks it as eligible for display when the ancestor becomes
  1639. mapped.
  1640. Such a window is called unviewable.
  1641. When all its ancestors are mapped,
  1642. the window becomes viewable
  1643. and will be visible on the screen if it is not obscured by another window.
  1644. This function has no effect if the window is already mapped.
  1645. .LP
  1646. If the override-redirect of the window is
  1647. .PN False 
  1648. and if some other client has selected
  1649. .PN SubstructureRedirectMask
  1650. on the parent window, then the X server generates a
  1651. .PN MapRequest
  1652. event, and the
  1653. .PN XMapWindow
  1654. function does not map the window.
  1655. Otherwise, the window is mapped, and the X server generates a
  1656. .PN MapNotify
  1657. event.
  1658. .LP
  1659. If the window becomes viewable and no earlier contents for it are remembered,
  1660. the X server tiles the window with its background.
  1661. If the window's background is undefined,
  1662. the existing screen contents are not
  1663. altered, and the X server generates zero or more 
  1664. .PN Expose
  1665. events.
  1666. If backing-store was maintained while the window was unmapped, no 
  1667. .PN Expose
  1668. events
  1669. are generated.
  1670. If backing-store will now be maintained, 
  1671. a full-window exposure is always generated.
  1672. Otherwise, only visible regions may be reported.
  1673. Similar tiling and exposure take place for any newly viewable inferiors.
  1674. .LP
  1675. .IN "XMapWindow"
  1676. If the window is an
  1677. .PN InputOutput 
  1678. window,
  1679. .PN XMapWindow
  1680. generates 
  1681. .PN Expose 
  1682. events on each 
  1683. .PN InputOutput
  1684. window that it causes to be displayed.
  1685. If the client maps and paints the window 
  1686. and if the client begins processing events, 
  1687. the window is painted twice.
  1688. To avoid this,
  1689. first ask for 
  1690. .PN Expose 
  1691. events and then map the window,
  1692. so the client processes input events as usual.
  1693. The event list will include 
  1694. .PN Expose 
  1695. for each
  1696. window that has appeared on the screen. 
  1697. The client's normal response to
  1698. an 
  1699. .PN Expose 
  1700. event should be to repaint the window.
  1701. This method usually leads to simpler programs and to proper interaction
  1702. with window managers.
  1703. .LP
  1704. .PN XMapWindow
  1705. can generate a
  1706. .PN BadWindow 
  1707. error.
  1708. .LP
  1709. .sp
  1710. To map and raise a window, use
  1711. .PN XMapRaised .
  1712. .IN "XMapRaised" "" "@DEF@"
  1713. .\" Start marker code here
  1714. .FD 0
  1715. XMapRaised\^(\^\fIdisplay\fP, \fIw\fP\^)
  1716. .br
  1717.       Display *\fIdisplay\fP\^;
  1718. .br
  1719.       Window \fIw\fP\^;
  1720. .FN
  1721. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1722. .IP \fIdisplay\fP 1i
  1723. Specifies the connection to the X server.
  1724. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1725. .IP \fIw\fP 1i
  1726. Specifies the window.
  1727. .\" End marker code here
  1728. .LP
  1729. .\" $Header: XMapRaised.d,v 1.2 88/05/07 12:22:21 mento Exp $
  1730. The
  1731. .PN XMapRaised
  1732. function
  1733. essentially is similar to
  1734. .PN XMapWindow
  1735. in that it maps the window and all of its
  1736. subwindows that have had map requests.
  1737. However, it also raises the specified window to the top of the stack.
  1738. For additional information,
  1739. see 
  1740. .PN XMapWindow .
  1741. .LP
  1742. .PN XMapRaised
  1743. can generate multiple
  1744. .PN BadWindow 
  1745. errors.
  1746. .LP
  1747. .sp
  1748. To map all subwindows for a specified window, use 
  1749. .PN XMapSubwindows .
  1750. .IN "XMapSubwindows" "" "@DEF@"
  1751. .\" Start marker code here
  1752. .FD 0
  1753. .\" $Header: XMapSubs.f,v 1.1 88/02/26 10:01:30 mento Exp $
  1754. XMapSubwindows\^(\^\fIdisplay\fP, \fIw\fP\^)
  1755. .br
  1756.       Display *\fIdisplay\fP\^;
  1757. .br
  1758.       Window \fIw\fP\^;
  1759. .FN
  1760. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1761. .IP \fIdisplay\fP 1i
  1762. Specifies the connection to the X server.
  1763. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1764. .IP \fIw\fP 1i
  1765. Specifies the window.
  1766. .\" End marker code here
  1767. .LP
  1768. .\" $Header: XMapSubs.d,v 1.3 88/06/11 07:51:57 mento Exp $
  1769. The
  1770. .PN XMapSubwindows
  1771. .IN "XMapSubwindows"
  1772. function maps all subwindows for a specified window in top-to-bottom stacking 
  1773. order.
  1774. The X server generates
  1775. .PN Expose
  1776. events on each newly displayed window.
  1777. This may be much more efficient than mapping many windows
  1778. one at a time because the server needs to perform much of the work
  1779. only once, for all of the windows, rather than for each window.
  1780. .LP
  1781. .PN XMapSubwindows
  1782. can generate a
  1783. .PN BadWindow 
  1784. error.
  1785. .NH 2
  1786. Unmapping Windows
  1787. .XS
  1788. \*(SN Unmapping Windows 
  1789. .XE
  1790. .LP
  1791. Xlib provides functions that you can use to unmap a window or all subwindows.
  1792. .LP
  1793. .sp
  1794. To unmap a window, use 
  1795. .PN XUnmapWindow .
  1796. .IN "XUnmapWindow" "" "@DEF@"
  1797. .\" Start marker code here
  1798. .FD 0
  1799. .\" $Header: XUnmapWindow.f,v 1.1 88/02/26 10:04:09 mento Exp $
  1800. XUnmapWindow\^(\^\fIdisplay\fP, \fIw\fP\^)
  1801. .br
  1802.       Display *\fIdisplay\fP\^;
  1803. .br
  1804.       Window \fIw\fP\^;
  1805. .FN
  1806. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1807. .IP \fIdisplay\fP 1i
  1808. Specifies the connection to the X server.
  1809. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1810. .IP \fIw\fP 1i
  1811. Specifies the window.
  1812. .\" End marker code here
  1813. .LP
  1814. .\" $Header: XUnmapWindow.d,v 1.2 88/06/11 07:54:34 mento Exp $
  1815. The
  1816. .PN XUnmapWindow
  1817. function unmaps the specified window and causes the X server to generate an
  1818. .PN UnmapNotify
  1819. .IN "UnmapNotify Event"
  1820. .IN "XUnmapWindow"
  1821. event.
  1822. If the specified window is already unmapped, 
  1823. .PN XUnmapWindow 
  1824. has no effect.
  1825. Normal exposure processing on formerly obscured windows is performed.
  1826. Any child window will no longer be visible until another map call is
  1827. made on the parent.
  1828. In other words, the subwindows are still mapped but are not visible
  1829. until the parent is mapped.
  1830. Unmapping a window will generate 
  1831. .PN Expose 
  1832. events on windows that were formerly obscured by it.
  1833. .LP
  1834. .PN XUnmapWindow
  1835. can generate a
  1836. .PN BadWindow 
  1837. error.
  1838. .LP
  1839. .sp
  1840. To unmap all subwindows for a specified window, use 
  1841. .PN XUnmapSubwindows .
  1842. .IN "XUnmapSubwindows" "" "@DEF@"
  1843. .\" Start marker code here
  1844. .FD 0
  1845. .\" $Header: XUnmapSubs.f,v 1.1 88/02/26 10:04:09 mento Exp $
  1846. XUnmapSubwindows\^(\^\fIdisplay\fP, \fIw\fP\^)
  1847. .br
  1848.       Display *\fIdisplay\fP\^;
  1849. .br
  1850.       Window \fIw\fP\^;
  1851. .FN
  1852. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  1853. .IP \fIdisplay\fP 1i
  1854. Specifies the connection to the X server.
  1855. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  1856. .IP \fIw\fP 1i
  1857. Specifies the window.
  1858. .\" End marker code here
  1859. .LP
  1860. .\" $Header: XUnmapSubs.d,v 1.4 88/06/11 07:54:33 mento Exp $
  1861. The
  1862. .PN XUnmapSubwindows
  1863. function unmaps all subwindows for the specified window in bottom-to-top
  1864. stacking order.
  1865. It causes the X server to generate an
  1866. .PN UnmapNotify
  1867. event on each subwindow and 
  1868. .PN Expose 
  1869. events on formerly obscured windows.
  1870. .IN "UnmapNotify Event"
  1871. Using this function is much more efficient than unmapping multiple windows
  1872. one at a time because the server needs to perform much of the work
  1873. only once, for all of the windows, rather than for each window.
  1874. .LP
  1875. .PN XUnmapSubwindows
  1876. can generate a
  1877. .PN BadWindow 
  1878. error.
  1879. .NH 2
  1880. Configuring Windows
  1881. .XS
  1882. \*(SN Configuring Windows 
  1883. .XE
  1884. .LP
  1885. .LP
  1886. Xlib provides functions that you can use to
  1887. move a window, resize a window, move and resize a window, or
  1888. change a window's border width.
  1889. To change one of these parameters,
  1890. set the appropriate member of the
  1891. .PN XWindowChanges
  1892. structure and OR in the corresponding value mask in subsequent calls to
  1893. .PN XConfigureWindow .
  1894. The symbols for the value mask bits and the
  1895. .PN XWindowChanges
  1896. structure are:
  1897. .\" Start marker code here
  1898. .LP
  1899. /* Configure window value mask bits */
  1900. .TS
  1901. lw(.5i) lw(2.5i) lw(.8i).
  1902. T{
  1903. #define
  1904. T}    T{
  1905. .PN CWX
  1906. T}    T{
  1907. (1<<0)
  1908. T}
  1909. T{
  1910. #define
  1911. T}    T{
  1912. .PN CWY
  1913. T}    T{
  1914. (1<<1)
  1915. T}
  1916. T{
  1917. #define
  1918. T}    T{
  1919. .PN CWWidth
  1920. T}    T{
  1921. (1<<2)
  1922. T}
  1923. T{
  1924. #define
  1925. T}    T{
  1926. .PN CWHeight
  1927. T}    T{
  1928. (1<<3)
  1929. T}
  1930. T{
  1931. #define
  1932. T}    T{
  1933. .PN CWBorderWidth
  1934. T}    T{
  1935. (1<<4)
  1936. T}
  1937. T{
  1938. #define
  1939. T}    T{
  1940. .PN CWSibling
  1941. T}    T{
  1942. (1<<5)
  1943. T}
  1944. T{
  1945. #define
  1946. T}    T{
  1947. .PN CWStackMode
  1948. T}    T{
  1949. (1<<6)
  1950. T}
  1951. .TE
  1952. .IN "XWindowChanges" "" "@DEF@"
  1953. .Ds 0
  1954. .TA .5i 3i
  1955. .ta .5i 3i
  1956. /* Values */
  1957.  
  1958. typedef struct {
  1959.     int x, y;
  1960.     int width, height;
  1961.     int border_width;
  1962.     Window sibling;
  1963.     int stack_mode;
  1964. } XWindowChanges;
  1965. .De
  1966. .\" End marker code here
  1967. .LP
  1968. The x and y members are used to set the window's x and y coordinates,
  1969. which are relative to the parent's origin
  1970. and indicate the position of the upper-left outer corner of the window.
  1971. The width and height members are used to set the inside size of the window,
  1972. not including the border, and must be nonzero, or a
  1973. .PN BadValue
  1974. error results.
  1975. Attempts to configure a root window have no effect.
  1976. .LP
  1977. The border_width member is used to set the width of the border in pixels.
  1978. Note that setting just the border width leaves the outer-left corner of the window
  1979. in a fixed position but moves the absolute position of the window's origin.
  1980. If you attempt to set the border-width attribute of an
  1981. .PN InputOnly
  1982. window nonzero, a
  1983. .PN BadMatch
  1984. error results. 
  1985. .LP
  1986. The sibling member is used to set the sibling window for stacking operations.
  1987. The stack_mode member is used to set how the window is to be restacked 
  1988. and can be set to
  1989. .PN Above , 
  1990. .PN Below , 
  1991. .PN TopIf , 
  1992. .PN BottomIf ,
  1993. or 
  1994. .PN Opposite .
  1995. .LP
  1996. If the override-redirect flag of the window is
  1997. .PN False 
  1998. and if some other client has selected
  1999. .PN SubstructureRedirectMask
  2000. on the parent, the X server generates a
  2001. .PN ConfigureRequest
  2002. event, and no further processing is performed.
  2003. Otherwise, 
  2004. if some other client has selected 
  2005. .PN ResizeRedirectMask 
  2006. on the window and the inside
  2007. width or height of the window is being changed,
  2008. .PN ResizeRequest
  2009. event is generated, and the current inside width and height are
  2010. used instead.
  2011. Note that the override-redirect flag of the window has no effect
  2012. on
  2013. .PN ResizeRedirectMask 
  2014. and that
  2015. .PN SubstructureRedirectMask
  2016. on the parent has precedence over
  2017. .PN ResizeRedirectMask 
  2018. on the window.
  2019. .LP
  2020. When the geometry of the window is changed as specified, 
  2021. the window is restacked among siblings, and a
  2022. .PN ConfigureNotify 
  2023. event is generated if the state of the window actually changes.
  2024. .PN GravityNotify
  2025. events are generated after 
  2026. .PN ConfigureNotify 
  2027. events.
  2028. If the inside width or height of the window has actually changed, 
  2029. children of the window are affected as specified.
  2030. .LP
  2031. If a window's size actually changes,
  2032. the window's subwindows move according to their window gravity.
  2033. Depending on the window's bit gravity,
  2034. the contents of the window also may be moved (see section 3.2.3).
  2035. .LP
  2036. If regions of the window were obscured but now are not,
  2037. exposure processing is performed on these formerly obscured windows, 
  2038. including the window itself and its inferiors. 
  2039. As a result of increasing the width or height,
  2040. exposure processing is also performed on any new regions of the window 
  2041. and any regions where window contents are lost.
  2042. .LP
  2043. The restack check (specifically, the computation for 
  2044. .PN BottomIf ,
  2045. .PN TopIf ,
  2046. and 
  2047. .PN Opposite )
  2048. is performed with respect to the window's final size and position (as
  2049. controlled by the other arguments of the request), not its initial position.
  2050. If a sibling is specified without a stack_mode,
  2051. a
  2052. .PN BadMatch
  2053. error results.
  2054. .LP
  2055. If a sibling and a stack_mode are specified, 
  2056. the window is restacked as follows:
  2057. .TS
  2058. lw(1i) lw(5i).
  2059. T{
  2060. .PN Above
  2061. T}    T{
  2062. The window is placed just above the sibling.
  2063. T}
  2064. .sp 6p
  2065. T{
  2066. .PN Below
  2067. T}    T{
  2068. The window is placed just below the sibling.
  2069. T}
  2070. .sp 6p
  2071. T{
  2072. .PN TopIf
  2073. T}    T{
  2074. If the sibling occludes the window, the window is placed
  2075. at the top of the stack.
  2076. T}
  2077. .sp 6p
  2078. T{
  2079. .PN BottomIf
  2080. T}    T{
  2081. If the window occludes the sibling, the window is
  2082. placed at the bottom of the stack.
  2083. T}
  2084. .sp 6p
  2085. T{
  2086. .PN Opposite
  2087. T}    T{
  2088. If the sibling occludes the window, the window 
  2089. is placed at the top of the stack.
  2090. If the window occludes the sibling, 
  2091. the window is placed at the bottom of the stack.
  2092. T}
  2093. .TE
  2094. .LP
  2095. If a stack_mode is specified but no sibling is specified,
  2096. the window is restacked as follows:
  2097. .TS
  2098. lw(1i) lw(5i).
  2099. T{
  2100. .PN Above
  2101. T}    T{
  2102. The window is placed at the top of the stack.
  2103. T}
  2104. .sp 6p
  2105. T{
  2106. .PN Below
  2107. T}    T{
  2108. The window is placed at the bottom of the stack.
  2109. T}
  2110. .sp 6p
  2111. T{
  2112. .PN TopIf
  2113. T}    T{
  2114. If any sibling occludes the window, the window is placed at
  2115. the top of the stack.
  2116. T}
  2117. .sp 6p
  2118. T{
  2119. .PN BottomIf
  2120. T}    T{
  2121. If the window occludes any sibling, the window is placed at
  2122. the bottom of the stack.
  2123. T}
  2124. .sp 6p
  2125. T{
  2126. .PN Opposite
  2127. T}    T{
  2128. If any sibling occludes the window, the window 
  2129. is placed at the top of the stack. 
  2130. If the window occludes any sibling, 
  2131. the window is placed at the bottom of the stack.
  2132. T}
  2133. .TE
  2134. .LP
  2135. Attempts to configure a root window have no effect.
  2136. .LP
  2137. .sp
  2138. To configure a window's size, location, stacking, or border, use
  2139. .PN XConfigureWindow .
  2140. .IN "XConfigureWindow" "" "@DEF@"
  2141. .\" Start marker code here
  2142. .FD 0
  2143. .\" $Header: XReconfWin.f,v 1.1 88/02/26 10:02:36 mento Exp $
  2144. XConfigureWindow\^(\^\fIdisplay\fP, \fIw\fP\^, \fIvalue_mask\fP\^, \fIvalues\fP\^)
  2145. .br
  2146.       Display *\fIdisplay\fP\^;
  2147. .br
  2148.       Window \fIw\fP\^;
  2149. .br
  2150.       unsigned int \fIvalue_mask\fP\^;
  2151. .br
  2152.       XWindowChanges *\fIvalues\fP\^;
  2153. .FN
  2154. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2155. .IP \fIdisplay\fP 1i
  2156. Specifies the connection to the X server.
  2157. .ds Wi to be reconfigured
  2158. .\" $Header: w_gen.a,v 1.4 88/08/04 11:21:56 mento Exp $
  2159. .IP \fIw\fP 1i
  2160. Specifies the window \*(Wi.
  2161. .\" $Header: value_mask.a,v 1.2 88/05/07 12:39:38 mento Exp $
  2162. .IP \fIvalue_mask\fP 1i
  2163. Specifies which values are to be set using information in
  2164. the values structure.
  2165. This mask is the bitwise inclusive OR of the valid configure window values bits.
  2166. .\" $Header: values.a,v 1.2 88/05/07 12:41:05 mento Exp $
  2167. .IP \fIvalues\fP 1i
  2168. Specifies the 
  2169. .PN XWindowChanges 
  2170. structure.
  2171. .\" End marker code here
  2172. .LP
  2173. .\" $Header: XReconfWin.d,v 1.2 88/06/11 07:52:46 mento Exp $
  2174. The
  2175. .PN XConfigureWindow
  2176. function uses the values specified in the
  2177. .PN XWindowChanges
  2178. structure to reconfigure a window's size, position, border, and stacking order.
  2179. Values not specified are taken from the existing geometry of the window.
  2180. .LP
  2181. If a sibling is specified without a stack_mode or if the window
  2182. is not actually a sibling,
  2183. a
  2184. .PN BadMatch
  2185. error results. 
  2186. Note that the computations for
  2187. .PN BottomIf ,
  2188. .PN TopIf ,
  2189. and
  2190. .PN Opposite
  2191. are performed with respect to the window's final geometry (as controlled by the
  2192. other arguments passed to
  2193. .PN XConfigureWindow ),
  2194. not its initial geometry.
  2195. Any backing store contents of the window, its
  2196. inferiors, and other newly visible windows are either discarded or
  2197. changed to reflect the current screen contents 
  2198. (depending on the implementation).
  2199. .LP
  2200. .PN XConfigureWindow
  2201. can generate
  2202. .PN BadMatch ,
  2203. .PN BadValue ,
  2204. and
  2205. .PN BadWindow 
  2206. errors.
  2207. .LP
  2208. .sp
  2209. To move a window without changing its size, use 
  2210. .PN XMoveWindow .
  2211. .IN "XMoveWindow" "" "@DEF@"
  2212. .\" Start marker code here
  2213. .FD 0 
  2214. .\" $Header: XMoveWindow.f,v 1.1 88/02/26 10:01:32 mento Exp $
  2215. XMoveWindow\^(\^\fIdisplay\fP, \fIw\fP\^, \fIx\fP\^, \fIy\fP\^)
  2216. .br
  2217.       Display *\fIdisplay\fP\^;
  2218. .br
  2219.       Window \fIw\fP\^;
  2220. .br
  2221.       int \fIx\fP\^, \fIy\fP\^;
  2222. .FN    
  2223. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2224. .IP \fIdisplay\fP 1i
  2225. Specifies the connection to the X server.
  2226. .ds Wi to be moved
  2227. .\" $Header: w_gen.a,v 1.4 88/08/04 11:21:56 mento Exp $
  2228. .IP \fIw\fP 1i
  2229. Specifies the window \*(Wi.
  2230. .ds Xy , which define the new location of the top-left pixel \
  2231. of the window's border or the window itself if it has no border
  2232. .\" $Header: xy_gen.a,v 1.2 88/08/04 11:22:37 mento Exp $
  2233. .IP \fIx\fP 1i
  2234. .br
  2235. .ns
  2236. .IP \fIy\fP 1i
  2237. Specify the x and y coordinates\*(Xy.
  2238. .\" End marker code here
  2239. .LP
  2240. .\" $Header: XMoveWindow.d,v 1.3 88/06/11 07:52:00 mento Exp $
  2241. The
  2242. .PN XMoveWindow
  2243. function moves the specified window to the specified x and y coordinates,
  2244. but it does not change the window's size, raise the window, or
  2245. change the mapping state of the window.
  2246. Moving a mapped window may or may not lose the window's contents 
  2247. depending on if the window is obscured by nonchildren 
  2248. and if no backing store exists.
  2249. If the contents of the window are lost, 
  2250. the X server generates
  2251. .PN Expose 
  2252. events.
  2253. Moving a mapped window generates
  2254. .PN Expose 
  2255. events on any formerly obscured windows. 
  2256. .LP
  2257. If the override-redirect flag of the window is 
  2258. .PN False 
  2259. and some
  2260. other client has selected 
  2261. .PN SubstructureRedirectMask 
  2262. on the parent, the X server generates a
  2263. .PN ConfigureRequest 
  2264. event, and no further processing is
  2265. performed.  
  2266. Otherwise, the window is moved.
  2267. .LP
  2268. .PN XMoveWindow
  2269. can generate a
  2270. .PN BadWindow 
  2271. error.
  2272. .LP
  2273. .sp
  2274. To change a window's size without changing the upper-left coordinate, use 
  2275. .PN XResizeWindow .
  2276. .IN "XResizeWindow" "" "@DEF@"
  2277. .\" Start marker code here
  2278. .FD 0
  2279. .\" $Header: XChWindow.f,v 1.1 88/02/26 09:58:36 mento Exp $
  2280. XResizeWindow\^(\^\fIdisplay\fP, \fIw\fP\^, \fIwidth\fP\^, \fIheight\fP\^)
  2281. .br
  2282.       Display *\fIdisplay\fP\^;
  2283. .br
  2284.       Window \fIw\fP\^;
  2285. .br
  2286.       unsigned int \fIwidth\fP\^, \fIheight\fP\^;
  2287. .FN
  2288. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2289. .IP \fIdisplay\fP 1i
  2290. Specifies the connection to the X server.
  2291. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2292. .IP \fIw\fP 1i
  2293. Specifies the window.
  2294. .ds Wh , which are the interior dimensions of the window \
  2295. after the call completes
  2296. .\" $Header: w+h_gen.a,v 1.2 88/08/04 11:21:28 mento Exp $
  2297. .IP \fIwidth\fP 1i
  2298. .br
  2299. .ns
  2300. .IP \fIheight\fP 1i
  2301. Specify the width and height\*(Wh.
  2302. .\" End marker code here
  2303. .LP
  2304. .\" $Header: XChWindow.d,v 1.3 88/06/11 07:49:12 mento Exp $
  2305. The
  2306. .PN XResizeWindow
  2307. function changes the inside dimensions of the specified window, not including
  2308. its borders.
  2309. This function does not change the window's upper-left coordinate or
  2310. the origin and does not restack the window.
  2311. Changing the size of a mapped window may lose its contents and generate
  2312. .PN Expose 
  2313. events.
  2314. If a mapped window is made smaller, 
  2315. changing its size generates
  2316. .PN Expose 
  2317. events on windows that the mapped window formerly obscured.
  2318. .LP
  2319. If the override-redirect flag of the window is 
  2320. .PN False 
  2321. and some
  2322. other client has selected 
  2323. .PN SubstructureRedirectMask 
  2324. on the parent, the X server generates a
  2325. .PN ConfigureRequest 
  2326. event, and no further processing is performed.  
  2327. If either width or height is zero,
  2328. a
  2329. .PN BadValue
  2330. error results.
  2331. .LP
  2332. .PN XResizeWindow
  2333. can generate
  2334. .PN BadValue
  2335. and
  2336. .PN BadWindow 
  2337. errors.
  2338. .LP
  2339. .sp
  2340. To change the size and location of a window, use 
  2341. .PN XMoveResizeWindow .
  2342. .IN "XMoveResizeWindow" "" "@DEF@"
  2343. .\" Start marker code here
  2344. .FD 0
  2345. .\" $Header: XConfWindow.f,v 1.1 88/02/26 09:58:51 mento Exp $
  2346. XMoveResizeWindow\^(\^\fIdisplay\fP, \fIw\fP\^, \fIx\fP\^, \fIy\fP\^, \fIwidth\fP\^, \fIheight\fP\^)
  2347. .br
  2348.       Display *\fIdisplay\fP\^;
  2349. .br
  2350.       Window \fIw\fP\^;
  2351. .br
  2352.       int \fIx\fP\^, \fIy\fP\^;
  2353. .br
  2354.       unsigned int \fIwidth\fP\^, \fIheight\fP\^;
  2355. .FN
  2356. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2357. .IP \fIdisplay\fP 1i
  2358. Specifies the connection to the X server.
  2359. .ds Wi to be reconfigured
  2360. .\" $Header: w_gen.a,v 1.4 88/08/04 11:21:56 mento Exp $
  2361. .IP \fIw\fP 1i
  2362. Specifies the window \*(Wi.
  2363. .ds Xy , which define the new position of the window relative to its parent
  2364. .\" $Header: xy_gen.a,v 1.2 88/08/04 11:22:37 mento Exp $
  2365. .IP \fIx\fP 1i
  2366. .br
  2367. .ns
  2368. .IP \fIy\fP 1i
  2369. Specify the x and y coordinates\*(Xy.
  2370. .ds Wh , which define the interior size of the window
  2371. .\" $Header: w+h_gen.a,v 1.2 88/08/04 11:21:28 mento Exp $
  2372. .IP \fIwidth\fP 1i
  2373. .br
  2374. .ns
  2375. .IP \fIheight\fP 1i
  2376. Specify the width and height\*(Wh.
  2377. .\" End marker code here
  2378. .LP
  2379. .\" $Header: XConfWindow.d,v 1.2 88/06/11 07:49:24 mento Exp $
  2380. The
  2381. .PN XMoveResizeWindow
  2382. function changes the size and location of the specified window 
  2383. without raising it.
  2384. Moving and resizing a mapped window may generate an
  2385. .PN Expose 
  2386. event on the window.
  2387. Depending on the new size and location parameters,
  2388. moving and resizing a window may generate 
  2389. .PN Expose 
  2390. events on windows that the window formerly obscured. 
  2391. .LP
  2392. If the override-redirect flag of the window is 
  2393. .PN False 
  2394. and some
  2395. other client has selected 
  2396. .PN SubstructureRedirectMask 
  2397. on the parent, the X server generates a
  2398. .PN ConfigureRequest 
  2399. event, and no further processing is performed.  
  2400. Otherwise, the window size and location are changed.
  2401. .LP
  2402. .PN XMoveResizeWindow
  2403. can generate
  2404. .PN BadValue 
  2405. and
  2406. .PN BadWindow 
  2407. errors.
  2408. .LP
  2409. .sp
  2410. To change the border width of a given window, use
  2411. .PN XSetWindowBorderWidth .
  2412. .IN "XSetWindowBorderWidth" "" "@DEF@"
  2413. .\" Start marker code here
  2414. .FD 0
  2415. XSetWindowBorderWidth\^(\^\fIdisplay\fP, \fIw\fP, \fIwidth\fP\^)
  2416. .br
  2417.       Display *\fIdisplay\fP\^;
  2418. .br
  2419.       Window \fIw\fP\^;
  2420. .br
  2421.       unsigned int \fIwidth\fP\^;
  2422. .FN
  2423. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2424. .IP \fIdisplay\fP 1i
  2425. Specifies the connection to the X server.
  2426. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2427. .IP \fIw\fP 1i
  2428. Specifies the window.
  2429. .IP \fIwidth\fP 1i
  2430. Specifies the width of the window border.
  2431. .\" End marker code here
  2432. .LP
  2433. .\" $Header: XBdrWidth.d,v 1.1 88/02/26 10:41:07 mento Exp $
  2434. The
  2435. .PN XSetWindowBorderWidth
  2436. function sets the specified window's border width to the specified width.
  2437. .LP
  2438. .PN XSetWindowBorderWidth
  2439. can generate a
  2440. .PN BadWindow 
  2441. error.
  2442. .NH 2
  2443. Changing Window Stacking Order
  2444. .XS
  2445. \*(SN Changing Window Stacking Order 
  2446. .XE
  2447. .LP
  2448. .LP
  2449. Xlib provides functions that you can use to raise, lower, circulate,
  2450. or restack windows.
  2451. .LP
  2452. .sp
  2453. To raise a window so that no sibling window obscures it, use 
  2454. .PN XRaiseWindow .
  2455. .IN "XRaiseWindow" "" "@DEF@"
  2456. .\" Start marker code here
  2457. .FD 0
  2458. .\" $Header: XRaiseWindow.f,v 1.1 88/02/26 10:02:34 mento Exp $
  2459. XRaiseWindow\^(\^\fIdisplay\fP, \fIw\fP\^)
  2460. .br
  2461.       Display *\fIdisplay\fP\^;
  2462. .br
  2463.       Window \fIw\fP\^;
  2464. .FN
  2465. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2466. .IP \fIdisplay\fP 1i
  2467. Specifies the connection to the X server.
  2468. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2469. .IP \fIw\fP 1i
  2470. Specifies the window.
  2471. .\" End marker code here
  2472. .LP
  2473. .\" $Header: XRaiseWindow.d,v 1.2 88/06/11 07:52:45 mento Exp $
  2474. The
  2475. .PN XRaiseWindow
  2476. function
  2477. raises the specified window to the top of the stack so that no sibling window
  2478. obscures it.
  2479. If the windows are regarded as overlapping sheets of paper stacked 
  2480. on a desk,
  2481. then raising a window is analogous to moving the sheet to the top of
  2482. the stack but leaving its x and y location on the desk constant.
  2483. Raising a mapped window may generate 
  2484. .PN Expose
  2485. events for the window and any mapped subwindows that were formerly obscured.  
  2486. .LP
  2487. If the override-redirect attribute of the window is 
  2488. .PN False 
  2489. and some
  2490. other client has selected 
  2491. .PN SubstructureRedirectMask 
  2492. on the parent, the X server generates a
  2493. .PN ConfigureRequest 
  2494. event, and no processing is performed.
  2495. Otherwise, the window is raised.
  2496. .LP
  2497. .PN XRaiseWindow
  2498. can generate a
  2499. .PN BadWindow 
  2500. error.
  2501. .LP
  2502. .sp
  2503. To lower a window so that it does not obscure any sibling windows, use 
  2504. .PN XLowerWindow .
  2505. .IN "XLowerWindow" "" "@DEF@"
  2506. .\" Start marker code here
  2507. .FD 0
  2508. .\" $Header: XLowerWindow.f,v 1.1 88/02/26 10:01:27 mento Exp $
  2509. XLowerWindow\^(\^\fIdisplay\fP, \fIw\fP\^)
  2510. .br
  2511.       Display *\fIdisplay\fP\^;
  2512. .br
  2513.       Window \fIw\fP\^;
  2514. .FN
  2515. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2516. .IP \fIdisplay\fP 1i
  2517. Specifies the connection to the X server.
  2518. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2519. .IP \fIw\fP 1i
  2520. Specifies the window.
  2521. .\" End marker code here
  2522. .LP
  2523. .\" $Header: XLowerWindow.d,v 1.2 88/06/11 07:51:55 mento Exp $
  2524. The
  2525. .PN XLowerWindow
  2526. function lowers the specified window to the bottom of the stack
  2527. so that it does not obscure any sibling
  2528. windows.
  2529. If the windows are regarded as overlapping sheets of paper
  2530. stacked on a desk, then lowering a window is analogous to moving the
  2531. sheet to the bottom of the stack but leaving its x and y location on
  2532. the desk constant.
  2533. Lowering a mapped window will generate 
  2534. .PN Expose 
  2535. events on any windows it formerly obscured.
  2536. .LP
  2537. If the override-redirect attribute of the window is 
  2538. .PN False 
  2539. and some
  2540. other client has selected 
  2541. .PN SubstructureRedirectMask 
  2542. on the parent, the X server generates a
  2543. .PN ConfigureRequest 
  2544. event, and no processing is performed.  
  2545. Otherwise, the window is lowered to the bottom of the
  2546. stack.
  2547. .LP
  2548. .PN XLowerWindow
  2549. can generate a
  2550. .PN BadWindow 
  2551. error.
  2552. .LP
  2553. .sp
  2554. To circulate a subwindow up or down, use
  2555. .PN XCirculateSubwindows .
  2556. .IN "XCirculateSubwindows" "" "@DEF@"
  2557. .\" Start marker code here
  2558. .FD 0
  2559. .\" $Header: XCircWindow.f,v 1.1 88/02/26 09:58:44 mento Exp $
  2560. XCirculateSubwindows\^(\^\fIdisplay\fP, \fIw\fP\^, \fIdirection\fP\^)
  2561. .br
  2562.       Display *\fIdisplay\fP\^;
  2563. .br
  2564.       Window \fIw\fP\^;
  2565. .br
  2566.       int \fIdirection\fP\^;
  2567. .FN
  2568. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2569. .IP \fIdisplay\fP 1i
  2570. Specifies the connection to the X server.
  2571. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2572. .IP \fIw\fP 1i
  2573. Specifies the window.
  2574. .\" $Header: direction.a,v 1.2 88/04/04 11:12:47 mento Exp $
  2575. .IP \fIdirection\fP 1i
  2576. Specifies the direction (up or down) that you want to circulate
  2577. the window. 
  2578. You can pass 
  2579. .PN RaiseLowest
  2580. or
  2581. .PN LowerHighest .
  2582. .\" End marker code here
  2583. .LP
  2584. .\" $Header: XCircWindow.d,v 1.4 88/06/11 07:49:20 mento Exp $
  2585. The
  2586. .PN XCirculateSubwindows
  2587. function circulates children of the specified window in the specified 
  2588. direction.
  2589. If you specify
  2590. .PN RaiseLowest ,
  2591. .PN XCirculateSubwindows
  2592. raises the lowest mapped child (if any) that is occluded 
  2593. by another child to the top of the stack.
  2594. If you specify
  2595. .PN LowerHighest ,
  2596. .PN XCirculateSubwindows
  2597. lowers the highest mapped child (if any) that occludes another child
  2598. to the bottom of the stack.
  2599. Exposure processing is then performed on formerly obscured windows.
  2600. If some other client has selected 
  2601. .PN SubstructureRedirectMask 
  2602. on the window, the X server generates a 
  2603. .PN CirculateRequest 
  2604. event, and no further processing is performed.
  2605. If a child is actually restacked,
  2606. the X server generates a
  2607. .PN CirculateNotify
  2608. event. 
  2609. .LP
  2610. .PN XCirculateSubwindows
  2611. can generate
  2612. .PN BadValue
  2613. and
  2614. .PN BadWindow 
  2615. errors.
  2616. .LP
  2617. .sp
  2618. To raise the lowest mapped child of a window that is partially or completely
  2619. occluded by another child, use
  2620. .PN XCirculateSubwindowsUp .
  2621. .IN "XCirculateSubwindowsUp" "" "@DEF@"
  2622. .\" Start marker code here
  2623. .FD 0
  2624. .\" $Header: XCircWinUp.f,v 1.1 88/02/26 09:58:43 mento Exp $
  2625. XCirculateSubwindowsUp\^(\^\fIdisplay\fP, \fIw\fP\^)
  2626. .br
  2627.       Display *\fIdisplay\fP\^;
  2628. .br
  2629.       Window \fIw\fP\^;
  2630. .FN
  2631. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2632. .IP \fIdisplay\fP 1i
  2633. Specifies the connection to the X server.
  2634. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2635. .IP \fIw\fP 1i
  2636. Specifies the window.
  2637. .\" End marker code here
  2638. .LP
  2639. .\" $Header: XCircWinUp.d,v 1.3 88/08/17 08:27:23 mento Exp $
  2640. The
  2641. .PN XCirculateSubwindowsUp
  2642. function raises the lowest mapped child of the specified window that
  2643. is partially
  2644. or completely
  2645. occluded by another child.
  2646. Completely unobscured children are not affected.
  2647. This is a convenience function equivalent to
  2648. .PN XCirculateSubwindows
  2649. with
  2650. .PN RaiseLowest
  2651. specified.
  2652. .LP
  2653. .PN XCirculateSubwindowsUp
  2654. can generate a
  2655. .PN BadWindow 
  2656. error.
  2657. .LP
  2658. .sp
  2659. To lower the highest mapped child of a window that partially or 
  2660. completely occludes another child, use 
  2661. .PN XCirculateSubwindowsDown .
  2662. .IN "XCirculateSubwindowsDown" "" "@DEF@"
  2663. .\" Start marker code here
  2664. .FD 0
  2665. .\" $Header: XCircWinDn.f,v 1.1 88/02/26 09:58:42 mento Exp $
  2666. XCirculateSubwindowsDown\^(\^\fIdisplay\fP, \fIw\fP\^)
  2667. .br
  2668.       Display *\fIdisplay\fP\^;
  2669. .br
  2670.       Window \fIw\fP\^;
  2671. .FN
  2672. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2673. .IP \fIdisplay\fP 1i
  2674. Specifies the connection to the X server.
  2675. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2676. .IP \fIw\fP 1i
  2677. Specifies the window.
  2678. .\" End marker code here
  2679. .LP
  2680. .\" $Header: XCircWinDn.d,v 1.3 88/08/17 08:28:27 mento Exp $
  2681. The
  2682. .PN XCirculateSubwindowsDown
  2683. function lowers the highest mapped child of the specified window that partially
  2684. or completely occludes another child.
  2685. Completely unobscured children are not affected.
  2686. This is a convenience function equivalent to
  2687. .PN XCirculateSubwindows
  2688. with
  2689. .PN LowerHighest
  2690. specified.
  2691. .LP
  2692. .PN XCirculateSubwindowsDown
  2693. can generate a
  2694. .PN BadWindow 
  2695. error.
  2696. .LP
  2697. .sp
  2698. To restack a set of windows from top to bottom, use 
  2699. .PN XRestackWindows .
  2700. .IN "XRestackWindows" "" "@DEF@"
  2701. .\" Start marker code here
  2702. .FD 0
  2703. .\" $Header: XRestackWins.f,v 1.1 88/02/26 10:02:42 mento Exp $
  2704. XRestackWindows\^(\^\fIdisplay\fP, \fIwindows\fP\^, \^\fInwindows\fP\^);
  2705. .br
  2706.       Display *\fIdisplay\fP\^;
  2707. .br
  2708.       Window \fIwindows\fP\^[];
  2709. .br
  2710.       int \fInwindows\fP\^;
  2711. .FN
  2712. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2713. .IP \fIdisplay\fP 1i
  2714. Specifies the connection to the X server.
  2715. .\" $Header: windows.a,v 1.2 88/04/05 14:11:11 mento Exp $
  2716. .IP \fIwindows\fP 1i
  2717. Specifies an array containing the windows to be restacked.
  2718. .\" $Header: nwindows.a,v 1.1 88/02/26 10:29:55 mento Exp $
  2719. .IP \fInwindows\fP 1i
  2720. Specifies the number of windows to be restacked.
  2721. .\" End marker code here
  2722. .LP
  2723. .\" $Header: XRestackWins.d,v 1.4 88/06/11 07:52:50 mento Exp $
  2724. The
  2725. .PN XRestackWindows
  2726. function restacks the windows in the order specified,
  2727. from top to bottom.
  2728. The stacking order of the first window in the windows array is unaffected,
  2729. but the other windows in the array are stacked underneath the first window,
  2730. in the order of the array.
  2731. The stacking order of the other windows is not affected.
  2732. For each window in the window array that is not a child of the specified window,
  2733. a
  2734. .PN BadMatch
  2735. error results.
  2736. .LP
  2737. If the override-redirect attribute of a window is 
  2738. .PN False 
  2739. and some
  2740. other client has selected 
  2741. .PN SubstructureRedirectMask 
  2742. on the parent, the X server generates 
  2743. .PN ConfigureRequest 
  2744. events for each window whose override-redirect flag is not set, 
  2745. and no further processing is performed.
  2746. Otherwise, the windows will be restacked in top to bottom order.
  2747. .LP
  2748. .PN XRestackWindows
  2749. can generate a
  2750. .PN BadWindow 
  2751. error.
  2752. .NH 2
  2753. Changing Window Attributes
  2754. .XS
  2755. \*(SN Changing Window Attributes 
  2756. .XE
  2757. .LP
  2758. .LP
  2759. Xlib provides functions that you can use to set window attributes.
  2760. .PN XChangeWindowAttributes
  2761. is the more general function that allows you to set one or more window
  2762. attributes provided by the
  2763. .PN XSetWindowAttributes
  2764. structure.
  2765. The other functions described in this section allow you to set one specific
  2766. window attribute, such as a window's background.
  2767. .LP
  2768. .sp
  2769. To change one or more attributes for a given window, use
  2770. .PN XChangeWindowAttributes .
  2771. .IN "XChangeWindowAttributes" "" "@DEF@"
  2772. .\" Start marker code here
  2773. .FD 0
  2774. .\" $Header: XChWAttr.f,v 1.1 88/02/26 09:58:34 mento Exp $
  2775. XChangeWindowAttributes\^(\^\fIdisplay\fP, \fIw\fP\^, \fIvaluemask\fP\^, \fIattributes\fP\^)
  2776. .br
  2777.       Display *\fIdisplay\fP\^;
  2778. .br
  2779.       Window \fIw\fP\^;
  2780. .br
  2781.       unsigned long \fIvaluemask\fP\^;
  2782. .br
  2783.       XSetWindowAttributes *\fIattributes\fP\^;
  2784. .FN
  2785. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2786. .IP \fIdisplay\fP 1i
  2787. Specifies the connection to the X server.
  2788. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2789. .IP \fIw\fP 1i
  2790. Specifies the window.
  2791. .\" $Header: valuemask.a,v 1.1 88/02/26 10:32:07 mento Exp $
  2792. .IP \fIvaluemask\fP 1i
  2793. Specifies which window attributes are defined in the attributes
  2794. argument.
  2795. This mask is the bitwise inclusive OR of the valid attribute mask bits.
  2796. If valuemask is zero,
  2797. the attributes are ignored and are not referenced.
  2798. The values and restrictions are
  2799. the same as for
  2800. .PN XCreateWindow .
  2801. .IP
  2802. .IP \fIattributes\fP 1i
  2803. Specifies the structure from which the values (as specified by the value mask)
  2804. are to be taken.
  2805. The value mask should have the appropriate bits
  2806. set to indicate which attributes have been set in the structure 
  2807. (see section 3.2).
  2808. .\" End marker code here
  2809. .LP
  2810. .\" $Header: XChWAttr.d,v 1.2 88/06/11 07:49:11 mento Exp $
  2811. Depending on the valuemask,
  2812. the
  2813. .PN XChangeWindowAttributes
  2814. function uses the window attributes in the
  2815. .PN XSetWindowAttributes
  2816. structure to change the specified window attributes.
  2817. Changing the background does not cause the window contents to be
  2818. changed.
  2819. To repaint the window and its background, use 
  2820. .PN XClearWindow .
  2821. Setting the border or changing the background such that the
  2822. border tile origin changes causes the border to be repainted.
  2823. Changing the background of a root window to 
  2824. .PN None 
  2825. or 
  2826. .PN ParentRelative
  2827. restores the default background pixmap.
  2828. Changing the border of a root window to
  2829. .PN CopyFromParent
  2830. restores the default border pixmap.
  2831. Changing the win-gravity does not affect the current position of the
  2832. window.
  2833. Changing the backing-store of an obscured window to 
  2834. .PN WhenMapped 
  2835. or
  2836. .PN Always , 
  2837. or changing the backing-planes, backing-pixel, or
  2838. save-under of a mapped window may have no immediate effect.
  2839. Changing the colormap of a window (that is, defining a new map, not
  2840. changing the contents of the existing map) generates a 
  2841. .PN ColormapNotify
  2842. event.
  2843. Changing the colormap of a visible window may have no
  2844. immediate effect on the screen because the map may not be installed
  2845. (see
  2846. .PN XInstallColormap ).
  2847. Changing the cursor of a root window to 
  2848. .PN None 
  2849. restores the default
  2850. cursor.
  2851. Whenever possible, you are encouraged to share colormaps.
  2852. .LP
  2853. Multiple clients can select input on the same window. 
  2854. Their event masks are maintained separately.
  2855. When an event is generated, 
  2856. it is reported to all interested clients. 
  2857. However, only one client at a time can select for 
  2858. .PN SubstructureRedirectMask , 
  2859. .PN ResizeRedirectMask , 
  2860. and
  2861. .PN ButtonPressMask .
  2862. If a client attempts to select any of these event masks 
  2863. and some other client has already selected one, 
  2864. a
  2865. .PN BadAccess
  2866. error results.
  2867. There is only one do-not-propagate-mask for a window, 
  2868. not one per client.
  2869. .LP
  2870. .PN XChangeWindowAttributes
  2871. can generate
  2872. .PN BadAccess ,
  2873. .PN BadColor ,
  2874. .PN BadCursor ,
  2875. .PN BadMatch ,
  2876. .PN BadPixmap ,
  2877. .PN BadValue ,
  2878. and
  2879. .PN BadWindow 
  2880. errors.
  2881. .LP
  2882. .sp
  2883. To set the background of a window to a given pixel, use 
  2884. .PN XSetWindowBackground .
  2885. .IN "XSetWindowBackground" "" "@DEF@"
  2886. .\" Start marker code here
  2887. .FD 0
  2888. .\" $Header: XBackground.f,v 1.1 88/02/26 09:58:16 mento Exp $
  2889. XSetWindowBackground\^(\^\fIdisplay\fP, \fIw\fP\^, \fIbackground_pixel\fP\^)
  2890. .br
  2891.       Display *\fIdisplay\fP\^;
  2892. .br
  2893.       Window \fIw\fP\^;
  2894. .br
  2895.       unsigned long \fIbackground_pixel\fP\^;
  2896. .FN
  2897. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2898. .IP \fIdisplay\fP 1i
  2899. Specifies the connection to the X server.
  2900. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2901. .IP \fIw\fP 1i
  2902. Specifies the window.
  2903. .\" $Header: back_pix.a,v 1.2 88/04/05 14:24:47 mento Exp $
  2904. .IP \fIbackground_pixel\fP 1i
  2905. Specifies the pixel that is to be used for the background.
  2906. .\" End marker code here
  2907. .LP
  2908. .\" $Header: XBackground.d,v 1.4 88/06/11 07:48:45 mento Exp $
  2909. The
  2910. .PN XSetWindowBackground
  2911. function sets the background of the window to the specified pixel value.
  2912. Changing the background does not cause the window contents to be changed.
  2913. .PN XSetWindowBackground
  2914. uses a pixmap of undefined size filled with the pixel value you passed.
  2915. If you try to change the background of an 
  2916. .PN InputOnly
  2917. window, a
  2918. .PN BadMatch
  2919. error results.
  2920. .LP
  2921. .PN XSetWindowBackground
  2922. can generate
  2923. .PN BadMatch
  2924. and
  2925. .PN BadWindow 
  2926. errors.
  2927. .LP
  2928. .sp
  2929. .LP
  2930. To set the background of a window to a given pixmap, use 
  2931. .PN XSetWindowBackgroundPixmap .
  2932. .IN "Window" "background"
  2933. .IN "XSetWindowBackgroundPixmap" "" "@DEF@"
  2934. .\" Start marker code here
  2935. .FD 0
  2936. .\" $Header: XPmapBgnd.f,v 1.1 88/02/26 10:01:52 mento Exp $
  2937. XSetWindowBackgroundPixmap\^(\^\fIdisplay\fP, \fIw\fP\^, \fIbackground_pixmap\fP\^)
  2938. .br
  2939.       Display *\fIdisplay\fP\^;
  2940. .br
  2941.       Window \fIw\fP\^;
  2942. .br
  2943.       Pixmap \fIbackground_pixmap\fP\^;
  2944. .FN
  2945. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  2946. .IP \fIdisplay\fP 1i
  2947. Specifies the connection to the X server.
  2948. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  2949. .IP \fIw\fP 1i
  2950. Specifies the window.
  2951. .\" $Header: tile.a,v 1.3 88/05/07 13:12:11 mento Exp $
  2952. .IP \fIbackground_pixmap\fP 1i
  2953. Specifies the background pixmap,
  2954. .PN ParentRelative ,
  2955. or
  2956. .PN None .
  2957. .\" End marker code here
  2958. .LP
  2959. .IN "Resource IDs" "freeing"
  2960. .IN "Freeing" "resources"
  2961. .\" $Header: XPmapBgnd.d,v 1.3 88/06/11 07:52:14 mento Exp $
  2962. The
  2963. .PN XSetWindowBackgroundPixmap
  2964. function sets the background pixmap of the window to the specified pixmap.
  2965. The background pixmap can immediately be freed if no further explicit
  2966. references to it are to be made.
  2967. If 
  2968. .PN ParentRelative
  2969. is specified, 
  2970. the background pixmap of the window's parent is used,
  2971. or on the root window, the default background is restored.
  2972. If you try to change the background of an 
  2973. .PN InputOnly
  2974. window, a
  2975. .PN BadMatch
  2976. error results.
  2977. If the background is set to
  2978. .PN None ,
  2979. the window has no defined background.
  2980. .LP
  2981. .PN XSetWindowBackgroundPixmap
  2982. can generate
  2983. .PN BadMatch ,
  2984. .PN BadPixmap ,
  2985. and 
  2986. .PN BadWindow 
  2987. errors.
  2988. .NT Note
  2989. .PN XSetWindowBackground
  2990. and
  2991. .PN XSetWindowBackgroundPixmap
  2992. do not change the current contents of the window.
  2993. .NE
  2994. .LP
  2995. .sp
  2996. To change and repaint a window's border to a given pixel, use 
  2997. .PN XSetWindowBorder .
  2998. .IN "XSetWindowBorder" "" "@DEF@"
  2999. .\" Start marker code here
  3000. .FD 0
  3001. .\" $Header: XBorder.f,v 1.1 88/02/26 09:58:27 mento Exp $
  3002. XSetWindowBorder\^(\^\fIdisplay\fP, \fIw\fP\^, \fIborder_pixel\fP\^)
  3003. .br
  3004.       Display *\fIdisplay\fP\^;
  3005. .br
  3006.       Window \fIw\fP\^;
  3007. .br
  3008.       unsigned long \fIborder_pixel\fP\^;
  3009. .FN
  3010. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  3011. .IP \fIdisplay\fP 1i
  3012. Specifies the connection to the X server.
  3013. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  3014. .IP \fIw\fP 1i
  3015. Specifies the window.
  3016. .\" $Header: bord_pix.a,v 1.2 88/05/07 13:15:29 mento Exp $
  3017. .IP \fIborder_pixel\fP 1i
  3018. Specifies the entry in the colormap. 
  3019. .\" End marker code here
  3020. .LP
  3021. .\" $Header: XBorder.d,v 1.3 88/06/11 07:48:47 mento Exp $
  3022. The
  3023. .PN XSetWindowBorder
  3024. function sets the border of the window to the pixel value you specify.
  3025. If you attempt to perform this on an
  3026. .PN InputOnly
  3027. window, a
  3028. .PN BadMatch
  3029. error results.
  3030. .LP
  3031. .PN XSetWindowBorder
  3032. can generate
  3033. .PN BadMatch 
  3034. and
  3035. .PN BadWindow 
  3036. errors.
  3037. .LP
  3038. .sp
  3039. To change and repaint the border tile of a given window, use 
  3040. .PN XSetWindowBorderPixmap .
  3041. .IN "XSetWindowBorderPixmap" "" "@DEF@"
  3042. .\" Start marker code here
  3043. .FD 0
  3044. .\" $Header: XPmapBorder.f,v 1.1 88/02/26 10:01:53 mento Exp $
  3045. XSetWindowBorderPixmap\^(\^\fIdisplay\fP, \fIw\fP\^, \fIborder_pixmap\fP\^)
  3046. .br
  3047.       Display *\fIdisplay\fP\^;
  3048. .br
  3049.       Window \fIw\fP\^;
  3050. .br
  3051.       Pixmap \fIborder_pixmap\fP\^;
  3052. .FN
  3053. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  3054. .IP \fIdisplay\fP 1i
  3055. Specifies the connection to the X server.
  3056. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  3057. .IP \fIw\fP 1i
  3058. Specifies the window.
  3059. .\" $Header: bord_pixmap.a,v 1.2 88/05/07 13:17:18 mento Exp $
  3060. .IP \fIborder_pixmap\fP 1i
  3061. Specifies the border pixmap or
  3062. .PN CopyFromParent .
  3063. .\" End marker code here
  3064. .LP
  3065. .\" $Header: XPmapBorder.d,v 1.3 88/06/11 07:52:14 mento Exp $
  3066. The
  3067. .PN XSetWindowBorderPixmap
  3068. function sets the border pixmap of the window to the pixmap you specify.
  3069. The border pixmap can be freed immediately if no further explicit
  3070. references to it are to be made.
  3071. If you specify
  3072. .PN CopyFromParent ,
  3073. a copy of the parent window's border pixmap is used.
  3074. If you attempt to perform this on an
  3075. .PN InputOnly
  3076. window, a
  3077. .PN BadMatch
  3078. error results.
  3079. .IN "Resource IDs" "freeing"
  3080. .IN "Freeing" "resources"
  3081. .LP
  3082. .PN XSetWindowBorderPixmap
  3083. can generate
  3084. .PN BadMatch ,
  3085. .PN BadPixmap ,
  3086. and
  3087. .PN BadWindow 
  3088. errors.
  3089. .LP
  3090. .sp
  3091. To set the colormap of a given window, use
  3092. .PN XSetWindowColormap .
  3093. .IN "XSetWindowColormap" "" "@DEF@"
  3094. .\" Start marker code here
  3095. .FD 0
  3096. .\" $Header: XChCmap.f,v 1.2 88/05/09 06:54:34 mento Exp $
  3097. XSetWindowColormap\^(\^\fIdisplay\fP, \fIw\fP\^, \fIcolormap\fP\^)
  3098. .br
  3099.       Display *\fIdisplay\fP\^;
  3100. .br
  3101.       Window \fIw\fP\^;
  3102. .br
  3103.       Colormap \fIcolormap\fP\^;
  3104. .FN
  3105. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  3106. .IP \fIdisplay\fP 1i
  3107. Specifies the connection to the X server.
  3108. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  3109. .IP \fIw\fP 1i
  3110. Specifies the window.
  3111. .\" $Header: cmap.a,v 1.2 88/05/09 06:39:13 mento Exp $
  3112. .IP \fIcolormap\fP 1i
  3113. Specifies the colormap.
  3114. .\" End marker code here
  3115. .LP
  3116. .\" $Header: XChCmap.d,v 1.3 88/05/09 06:57:38 mento Exp $
  3117. The
  3118. .PN XSetWindowColormap
  3119. function sets the specified colormap of the specified window.
  3120. The colormap must have the same visual type as the window,
  3121. or a
  3122. .PN BadMatch
  3123. error results.
  3124. .LP
  3125. .PN XSetWindowColormap
  3126. can generate
  3127. .PN BadColor ,
  3128. .PN BadMatch ,
  3129. and
  3130. .PN BadWindow 
  3131. errors.
  3132. .LP
  3133. .sp
  3134. To define which cursor will be used in a window, use
  3135. .PN XDefineCursor .
  3136. .IN "Window" "defining the cursor"
  3137. .IN "XDefineCursor" "" "@DEF@"
  3138. .\" Start marker code here
  3139. .FD 0
  3140. .\" $Header: XDefCursor.f,v 1.1 88/02/26 09:59:31 mento Exp $
  3141. XDefineCursor\^(\^\fIdisplay\fP, \fIw\fP\^, \fIcursor\fP\^)
  3142. .br
  3143.       Display *\fIdisplay\fP\^;
  3144. .br
  3145.       Window \fIw\fP\^;
  3146. .br
  3147.       Cursor \fIcursor\fP\^;
  3148. .FN
  3149. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  3150. .IP \fIdisplay\fP 1i
  3151. Specifies the connection to the X server.
  3152. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  3153. .IP \fIw\fP 1i
  3154. Specifies the window.
  3155. .\" $Header: cursor_def.a,v 1.2 88/05/13 13:12:57 mento Exp $
  3156. .IP \fIcursor\fP 1i
  3157. Specifies the cursor that is to be displayed or
  3158. .PN None .
  3159. .\" End marker code here
  3160. .LP
  3161. .\" $Header: XDefCursor.d,v 1.2 88/06/11 07:49:58 mento Exp $
  3162. If a cursor is set, it will be used when the pointer is in the window.
  3163. If the cursor is
  3164. .PN None ,
  3165. it is equivalent to
  3166. .PN XUndefineCursor .
  3167. .LP
  3168. .PN XDefineCursor
  3169. can generate
  3170. .PN BadCursor
  3171. and
  3172. .PN BadWindow 
  3173. errors.
  3174. .LP
  3175. .sp
  3176. To undefine the cursor in a given window, use
  3177. .PN XUndefineCursor .
  3178. .IN "Window" "undefining the cursor"
  3179. .IN "XUndefineCursor" "" "@DEF@"
  3180. .\" Start marker code here
  3181. .FD 0
  3182. .\" $Header: XUndefCursor.f,v 1.1 88/02/26 10:04:03 mento Exp $
  3183. XUndefineCursor\^(\^\fIdisplay\fP, \fIw\fP\^)
  3184. .br
  3185.       Display *\fIdisplay\fP\^;
  3186. .br
  3187.       Window \fIw\fP\^;
  3188. .FN
  3189. .\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
  3190. .IP \fIdisplay\fP 1i
  3191. Specifies the connection to the X server.
  3192. .\" End marker code here
  3193. .\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
  3194. .IP \fIw\fP 1i
  3195. Specifies the window.
  3196. .LP
  3197. .\" $Header: XUndefCursor.d,v 1.2 88/06/11 07:54:20 mento Exp $
  3198. The
  3199. .PN XUndefineCursor
  3200. function undoes the effect of a previous
  3201. .PN XDefineCursor
  3202. for this window.
  3203. When the pointer is in the window,
  3204. the parent's cursor will now be used.
  3205. On the root window,
  3206. the default cursor is restored.
  3207. .LP
  3208. .PN XUndefineCursor
  3209. can generate a
  3210. .PN BadWindow 
  3211. error.
  3212. .bp
  3213.