1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
4[
5<!ENTITY % defs SYSTEM "defs.ent"> %defs;
6]>
7
8
9<!-- lifted from troff+ms+XMan by doclifter -->
10<book id="shape">
11
12<bookinfo>
13   <title>X Nonrectangular Window Shape Extension Protocol</title>
14   <subtitle>X.Org Standard</subtitle>
15   <authorgroup>
16      <author>
17         <firstname>Keith</firstname><surname>Packard</surname>
18         <affiliation><orgname>MIT X Consortium</orgname></affiliation>
19         <affiliation><orgname>Intel Corporation</orgname></affiliation>
20      </author>
21      <othercredit>
22         <firstname>Hideki</firstname><surname>Hiura</surname>
23         <affiliation><orgname>SunSoft, Inc.</orgname></affiliation>
24      </othercredit>
25   </authorgroup>
26   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
27   <releaseinfo>Version 1.1</releaseinfo>
28   <copyright><year>1989</year><year>2004</year><holder>The Open Group</holder></copyright>
29   <copyright><year>2006</year><holder>Keith Packard</holder></copyright>
30<legalnotice>
31
32<para>
33Permission is hereby granted, free of charge, to any person obtaining a copy
34of this software and associated documentation files (the "Software"), to deal
35in the Software without restriction, including without limitation the rights
36to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37copies of the Software, and to permit persons to whom the Software is
38furnished to do so, subject to the following conditions:
39</para>
40<para>
41The above copyright notice and this permission notice shall be included in
42all copies or substantial portions of the Software.
43</para>
44<para>
45THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
48COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
49WHETHER IN
50AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
51CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52</para>
53<para>
54Except as contained in this notice, the name of the copyright holders
55shall not be
56used in advertising or otherwise to promote the sale, use or other dealings
57in this Software without prior written authorization from the
58copyright holders.
59</para>
60</legalnotice>
61</bookinfo>
62
63<chapter id="Overview">
64<title>Overview</title>
65<para>
66<!-- .LP -->
67This extension provides arbitrary window and border shapes within the X11
68protocol.
69</para>
70<para>
71<!-- .LP -->
72The restriction of rectangular windows within the X protocol is a significant
73limitation in the implementation of many styles of user interface.  For
74example, many transient windows would like to display a "drop shadow'' to
75give the illusion of 3 dimensions.  As another example, some user interface
76style guides call for buttons with rounded corners; the full simulation of a
77nonrectangular shape, particularly with respect to event distribution and
78cursor shape, is not possible within the core X protocol.  As a final
79example, round clocks and nonrectangular icons are desirable visual addition
80to the desktop.
81</para>
82<para>
83<!-- .LP -->
84This extension provides mechanisms for changing both the visible and interactive shape of a
85window to arbitrary, possibly disjoint, nonrectangular forms.  The intent
86of the extension is to supplement the existing semantics, not replace them.
87In particular, it is desirable for clients that are unaware of the
88extension to still be able to cope reasonably with shaped windows.  For
89example, window managers should still be able to negotiate screen
90real estate in rectangular pieces.  Toward this end, any shape specified for
91a window is clipped by the bounding rectangle for the window as specified by
92the window's geometry in the core protocol.  An expected convention would be
93that client programs expand their shape to fill the area offered by the
94window manager.
95</para>
96</chapter>
97
98<chapter id="Description">
99<title>Description</title>
100<para>
101Each window (even with no shapes specified) is defined by three regions:  the
102<emphasis remap='I'>bounding region</emphasis>, the <emphasis remap='I'>clip
103region</emphasis> and the <emphasis remap='I'>input region</emphasis>.  The
104bounding region is the area of the
105parent window that the window will occupy (including border). The clip region
106is the subset of the bounding region that is available for subwindows and
107graphics.  The area between the bounding region and the clip region is defined
108to be the border of the window. The input region is the subset of the
109bounding region that can "contain" the pointer.
110</para>
111
112<para>
113A nonshaped window will have a bounding region that is a rectangle
114spanning the window, including its border; the clip region will be a rectangle
115filling the inside dimensions (not including the border); the input
116region will match the bounding region.  In this document,
117these areas are referred to as the
118<emphasis remap='I'>default bounding region</emphasis>, the
119<emphasis remap='I'>default clip region</emphasis> and the
120<emphasis remap='I'>default input region</emphasis>.  For a window with inside
121size of <emphasis remap='I'>width</emphasis> by
122<emphasis remap='I'>height</emphasis> and border width
123<emphasis remap='I'>bwidth</emphasis>, the default bounding, clip
124and input regions are the rectangles (relative to the window origin):
125</para>
126
127<literallayout class="monospaced">
128bounding.x = -<emphasis remap='I'>bwidth</emphasis>
129bounding.y = -<emphasis remap='I'>bwidth</emphasis>
130bounding.width = <emphasis remap='I'>width</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
131bounding.height = <emphasis remap='I'>height</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
132
133clip.x = 0
134clip.y = 0
135clip.width = <emphasis remap='I'>width</emphasis>
136clip.height = <emphasis remap='I'>height</emphasis>
137
138input.x = -<emphasis remap='I'>bwidth</emphasis>
139input.y = -<emphasis remap='I'>bwidth</emphasis>
140input.width = <emphasis remap='I'>width</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
141input.height = <emphasis remap='I'>height</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
142</literallayout>
143
144<para>
145This extension allows a client to modify any combination of the bounding,
146clip or input regions by specifying new regions that combine with the default
147regions.  These new regions are called the
148<emphasis remap='I'>client bounding region</emphasis>,
149the <emphasis remap='I'>client clip region</emphasis> and the
150<emphasis remap='I'>client input region</emphasis>.  They are specified
151relative to the origin of
152the window and are always defined by offsets relative to the window origin
153(that is, region adjustments are not required when the window is moved).
154Three mechanisms for specifying regions are provided:  a list of rectangles,
155a bitmap, and an existing bounding or clip region from a window.  This is
156modeled on the specification of regions in graphics contexts in the core
157protocol and allows a variety of different uses of the extension.
158</para>
159
160<para>
161When using an existing window shape as an operand in specifying a new shape,
162the client region is used, unless none has been set, in which case the
163default region is used instead.
164</para>
165
166<para>
167The <emphasis remap='I'>effective bounding region</emphasis> of a window
168is defined to be the intersection of
169the client bounding region with the default bounding region.  Any portion of
170the client bounding region that is not included in the default bounding
171region will not be included in the effective bounding region on the screen.
172This means that window managers (or other geometry managers) used to dealing
173with rectangular client windows will be able to constrain the client to a
174rectangular area of the screen.
175</para>
176
177<para>
178Construction of the effective bounding region is dynamic; the client bounding
179region is not mutated to obtain the effective bounding region.  If a client
180bounding region is specified that extends beyond the current default bounding
181region, and the window is later enlarged, the effective bounding region will
182be enlarged to include more of the client bounding region.
183</para>
184
185<para>
186The <emphasis remap='I'>effective clip region</emphasis> of a window is defined to be the intersection of the
187client clip region with both the default clip region and the client bounding
188region.  Any portion of the client clip region that is not included in both
189the default clip region and the client bounding region will not be included in
190the effective clip region on the screen.
191</para>
192
193<para>
194Construction of the effective clip region is dynamic; the client clip region is
195not mutated to obtain the effective clip region.  If a client clip region is
196specified that extends beyond the current default clip region and the
197window or its bounding region is later enlarged, the effective clip region will
198be enlarged to include more of the client clip region if it is included in
199the effective bounding region.
200</para>
201
202<para>
203The border of a window is defined to be the difference between the effective
204bounding region and the effective clip region.  If this region is empty, no
205border is displayed.  If this region is nonempty, the border is filled
206using the border-tile or border-pixel of the window as specified in the core
207protocol.  Note that a window with a nonzero border width will never be able
208to draw beyond the default clip region of the window.  Also note that a zero
209border width does not prevent a window from having a border, since the clip
210shape can still be made smaller than the bounding shape.
211</para>
212
213<para>
214All output to the window and visible regions of any subwindows will be
215clipped to the effective clip region.  The server must not retain window
216contents beyond the effective bounding region with backing store.  The window's
217origin (for graphics operations, background tiling, and subwindow placement)
218is not affected by the existence of a bounding region or clip region.
219</para>
220
221<para>
222The <emphasis remap='I'>effective input region</emphasis> of a window is
223defined to be the intersection of the
224client input region with both the default input region and the client bounding
225region.  Any portion of the client input region that is not included in both
226the default input region and the client bounding region will not be included in
227the effective input region on the screen.
228</para>
229<para>
230<!-- .LP -->
231Construction of the effective input region is dynamic; the client input region is
232not mutated to obtain the effective input region.  If a client input region is
233specified that extends beyond the current default input region and the
234window or its bounding region is later enlarged, the effective input region will
235be enlarged to include more of the client input region if it is included in
236the effective bounding region.
237</para>
238<para>
239<!-- .LP  -->
240Areas that are inside the default bounding region but outside the effective
241bounding region are not part of the window; these areas of the screen will
242be occupied by other windows.  Input events that occur within the default
243bounding region but outside the effective bounding region will be delivered as
244if the window was not occluding the event position.  Events that occur in
245a nonrectangular border of a window will be delivered to that window, just
246as for events that occur in a normal rectangular border.
247</para>
248<para>
249<!-- .LP -->
250An
251<function>InputOnly</function>
252window can have its bounding or input region set, but it is a
253<function>Match</function>
254error to attempt to set a clip region on an
255<function>InputOnly</function>
256window or to specify its clip region as a source to a request
257in this extension.
258</para>
259<para>
260<!-- .LP -->
261The server must accept changes to the clip and input regions of a root window, but
262the server is permitted to ignore requested changes to the bounding region
263of a root window.  If the server accepts bounding region changes, the contents
264of the screen outside the bounding region are implementation dependent.
265</para>
266</chapter>
267
268<chapter id="Types">
269<title>Types</title>
270<para>
271<!-- .LP -->
272The following types are used in the request and event definitions in
273subsequent sections.
274</para>
275
276<para>
277SHAPE_KIND:
278{ <function>Bounding</function>,
279<function>Clip</function>,
280<function>Input</function> }
281</para>
282
283<para>
284SHAPE_OP:
285{ <function>Set</function>,
286<function>Union</function>,
287<function>Intersect</function>,
288<function>Subtract</function>,
289<function>Invert</function> }
290</para>
291
292<para>
293<function>Set</function>
294indicates that the region specified as an explicit source in the request is
295stored unaltered as the new destination client region.
296<function>Union</function>
297indicates that the source and destination regions are unioned together to
298produce the new destination client region.
299<function>Intersect</function>
300indicates that the source and destination regions are intersected together to
301produce the new destination client region.
302<function>Subtract</function>
303indicates that the source region is subtracted from the destination region to
304produce the new destination region.
305<function>Invert</function>
306indicates that the destination region is subtracted from the source region to
307produce the new destination region.
308</para>
309</chapter>
310
311<chapter id="Requests">
312<title>Requests</title>
313<para>
314<function>ShapeQueryVersion</function>
315</para>
316
317<para>
318   =&gt;
319</para>
320
321<para>
322majorVersion: CARD16
323</para>
324<para>
325minorVersion: CARD16
326</para>
327
328<para>
329This request can be used to ensure that the server version of the SHAPE
330extension is usable by the client.  This document defines major version one
331(1), minor version one (1).
332</para>
333
334<para>
335<function>ShapeRectangles</function>
336</para>
337
338<informaltable frame="none">
339  <?dbfo keep-together="always" ?>
340  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
341  <colspec colname='c1' colwidth="1.0*"/>
342  <tbody>
343    <row>
344      <entry><emphasis remap='I'>dest</emphasis>: WINDOW</entry>
345    </row>
346    <row>
347      <entry><emphasis remap='I'>destKind</emphasis>: SHAPE_KIND</entry>
348    </row>
349    <row>
350      <entry><emphasis remap='I'>op</emphasis>: SHAPE_OP</entry>
351    </row>
352    <row>
353      <entry><emphasis remap='I'>xOff, yOff</emphasis>: INT16</entry>
354    </row>
355    <row>
356      <entry><emphasis remap='I'>rectangles</emphasis>: LISTofRECTANGLES</entry>
357    </row>
358    <row>
359      <entry><emphasis remap='I'>ordering</emphasis>:
360{ <function>UnSorted</function>,
361<function>YSorted</function>,
362<function>YXSorted</function>,
363<function>YXBanded</function> }
364      </entry>
365    </row>
366    <row>
367      <entry>
368Errors:
369<function>Window</function>,
370<function>Length</function>,
371<function>Match</function>,
372<function>Value</function>
373      </entry>
374    </row>
375  </tbody>
376  </tgroup>
377</informaltable>
378
379<para>
380This request specifies an array of rectangles, relative to the origin of the
381window plus the specified offset (xOff and yOff) that together
382define a region.  This region is combined (as specified by the operator
383op) with the existing client region (specified by destKind) of the
384destination window, and the result is stored as the specified client region of
385the destination window.  Note that the list of rectangles can be empty,
386specifying an empty region; this is not the same as passing
387<function>None</function> to
388<function>ShapeMask</function>,
389</para>
390
391<para>
392If known by the client,
393ordering relations on the rectangles can be specified with the ordering
394argument.
395This may provide faster operation by the server.
396The meanings of the ordering values are the same as in the core protocol
397<function>SetClipRectangles</function>
398request.
399If an incorrect ordering is specified,
400the server may generate a
401<function>Match </function>
402error, but it is not required to do so.
403If no error is generated,
404the graphics results are undefined.
405Except for
406<function>UnSorted ,</function>
407the rectangles should be nonintersecting, or the resulting region will
408be undefined.
409<function>UnSorted </function>
410means that the rectangles are in arbitrary order.
411<function>YSorted </function>
412means that the rectangles are nondecreasing in their Y origin.
413<function>YXSorted </function>
414additionally constrains
415<function>YSorted </function>
416order in that all rectangles with an equal Y origin are
417nondecreasing in their X origin.
418<function>YXBanded </function>
419additionally constrains
420<function>YXSorted </function>
421by requiring that, for every possible Y scanline,
422all rectangles that include that scanline have identical Y origins and Y
423extents.
424</para>
425
426<para>
427<function>ShapeMask</function>
428</para>
429
430<informaltable frame="none">
431  <?dbfo keep-together="always" ?>
432  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
433  <colspec colname='c1' colwidth="1.0*"/>
434  <tbody>
435    <row>
436      <entry>
437<emphasis remap='I'>dest</emphasis>: WINDOW
438<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
439<emphasis remap='I'>op</emphasis>: SHAPE_OP
440<emphasis remap='I'>xOff, yOff</emphasis>: INT16
441<emphasis remap='I'>source</emphasis>: PIXMAP or
442<function>None</function>
443      </entry>
444    </row>
445    <row>
446      <entry>
447Errors:
448<function>Window</function>,
449<function>Pixmap</function>,
450<function>Match</function>,
451<function>Value</function>
452      </entry>
453    </row>
454  </tbody>
455  </tgroup>
456</informaltable>
457
458<para>
459The source in this request is a 1-bit deep pixmap, or
460<function>None .</function>
461If source is
462<function>None ,</function>
463the specified client region is removed from the window, causing the effective
464region to revert to the default region.  The
465<function>ShapeNotify</function>
466event generated by this request and subsequent
467<function>ShapeQueryExtents</function>
468will report that a client shape has not been specified.
469If a valid pixmap is specified, it is converted
470to a region, with bits set to one included in the region and bits set to
471zero excluded, and an offset from the window origin as specified by
472xOff and yOff.  The resulting region is then combined (as
473specified by the operator op) with the existing client region
474(indicated by destKind) of the destination window, and the result is
475stored as the specified client region of the destination window.  The source
476pixmap and destination window must have been created on the same screen,
477or else a
478<function>Match</function>
479error results.
480</para>
481
482<para>
483<function>ShapeCombine</function>
484</para>
485
486<informaltable frame="none">
487  <?dbfo keep-together="always" ?>
488  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
489  <colspec colname='c1' colwidth="1.0*"/>
490  <tbody>
491    <row>
492      <entry>
493<emphasis remap='I'>dest</emphasis>: WINDOW
494      </entry>
495    </row>
496    <row>
497      <entry>
498<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
499      </entry>
500    </row>
501    <row>
502      <entry>
503<emphasis remap='I'>op</emphasis>: SHAPE_OP
504      </entry>
505    </row>
506    <row>
507      <entry>
508<emphasis remap='I'>xOff, yOff</emphasis>: INT16
509      </entry>
510    </row>
511    <row>
512      <entry>
513<emphasis remap='I'>source</emphasis>: WINDOW
514      </entry>
515    </row>
516    <row>
517      <entry>
518<emphasis remap='I'>sourceKind</emphasis>: SHAPE_KIND
519      </entry>
520    </row>
521    <row>
522      <entry>
523Errors:
524<function>Window</function>,
525<function>Match</function>,
526<function>Value</function>
527      </entry>
528    </row>
529  </tbody>
530  </tgroup>
531</informaltable>
532
533<para>
534The client region, indicated by sourceKind, of the source window is
535offset from the window origin by xOff and yOff and combined with
536the client region, indicated by destKind, of the destination window.
537The result is stored as the specified client region of the destination
538window.
539The source and destination windows must be on the same screen, or else a
540<function>Match</function>
541error results.
542</para>
543
544<para>
545<function>ShapeOffset</function>
546</para>
547
548<informaltable frame="none">
549  <?dbfo keep-together="always" ?>
550  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
551  <colspec colname='c1' colwidth="1.0*"/>
552  <tbody>
553    <row>
554      <entry>
555<emphasis remap='I'>dest</emphasis>: WINDOW
556      </entry>
557    </row>
558    <row>
559      <entry>
560<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
561      </entry>
562    </row>
563    <row>
564      <entry>
565<emphasis remap='I'>xOff, yOff</emphasis>: INT16
566      </entry>
567    </row>
568    <row>
569      <entry>
570Errors:
571<function>Window</function>,
572<function>Match</function>,
573<function>Value</function>
574      </entry>
575    </row>
576  </tbody>
577  </tgroup>
578</informaltable>
579
580<para>
581The client region, indicated by destKind, is moved relative to its
582current position by the amounts xOff and yOff.
583</para>
584
585<para>
586<function>ShapeQueryExtents</function>
587</para>
588
589<informaltable frame="none">
590  <?dbfo keep-together="always" ?>
591  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
592  <colspec colname='c1' colwidth="1.0*"/>
593  <tbody>
594    <row>
595      <entry>
596<emphasis remap='I'>dest</emphasis>: WINDOW
597      </entry>
598    </row>
599  </tbody>
600  </tgroup>
601</informaltable>
602
603<para>
604   =&gt;
605</para>
606
607<informaltable frame="none">
608  <?dbfo keep-together="always" ?>
609  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
610  <colspec colname='c1' colwidth="1.0*"/>
611  <tbody>
612    <row>
613      <entry>
614boundingShaped: BOOL
615      </entry>
616    </row>
617    <row>
618      <entry>
619clipShaped: BOOL
620      </entry>
621    </row>
622    <row>
623      <entry>
624xBoundingShape: INT16
625      </entry>
626    </row>
627    <row>
628      <entry>
629yBoundingShape: INT16
630      </entry>
631    </row>
632    <row>
633      <entry>
634widthBoundingShape: CARD16
635      </entry>
636    </row>
637    <row>
638      <entry>
639heightBoundingShape: CARD16
640      </entry>
641    </row>
642    <row>
643      <entry>
644xClipShape: INT16
645      </entry>
646    </row>
647    <row>
648      <entry>
649yClipShape: INT16
650      </entry>
651    </row>
652    <row>
653      <entry>
654widthClipShape: CARD16
655      </entry>
656    </row>
657    <row>
658      <entry>
659heightClipShape: CARD16
660      </entry>
661    </row>
662    <row>
663      <entry>
664Errors:
665<function>Window</function>
666      </entry>
667    </row>
668  </tbody>
669  </tgroup>
670</informaltable>
671
672<para>
673The boundingShaped and clipShaped results are
674<function>True</function>
675if the corresponding client regions have been specified, else they are
676<function>False .</function>
677The x, y, width, and height values define the extents of the client regions,
678when a client region has not been specified, the extents of the
679corresponding default region are reported.
680</para>
681
682<para>
683<function>ShapeSelectInput</function>
684</para>
685
686<informaltable frame="none">
687  <?dbfo keep-together="always" ?>
688  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
689  <colspec colname='c1' colwidth="1.0*"/>
690  <tbody>
691    <row>
692      <entry>
693<emphasis remap='I'>window</emphasis>: WINDOW
694      </entry>
695    </row>
696    <row>
697      <entry>
698<emphasis remap='I'>enable</emphasis>: BOOL
699      </entry>
700    </row>
701    <row>
702      <entry>
703Errors:
704<function>Window</function>,
705<function>Value</function>
706      </entry>
707    </row>
708  </tbody>
709  </tgroup>
710</informaltable>
711
712<para>
713Specifying enable as
714<function>True</function>
715causes the server to send the requesting client a
716<function>ShapeNotify</function>
717event whenever the bounding, clip or input region of the specified window is
718altered by any client.
719Specifying enable as
720<function>False</function>
721causes the server to stop sending such events.
722</para>
723
724<para>
725<function>ShapeInputSelected</function>
726</para>
727
728<informaltable frame="none">
729  <?dbfo keep-together="always" ?>
730  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
731  <colspec colname='c1' colwidth="1.0*"/>
732  <tbody>
733    <row>
734      <entry>
735<emphasis remap='I'>window</emphasis>: WINDOW
736      </entry>
737    </row>
738    <row>
739      <entry>
740=&gt;
741enable: BOOL
742      </entry>
743    </row>
744    <row>
745      <entry>
746Errors:
747<function>Window</function>
748      </entry>
749    </row>
750  </tbody>
751  </tgroup>
752</informaltable>
753
754<para>
755If enable is
756<function>True</function>, then
757<function>ShapeNotify</function>
758events for the window are generated for this client.
759</para>
760
761<para>
762<function>ShapeGetRectangles</function>
763</para>
764
765<informaltable frame="none">
766  <?dbfo keep-together="always" ?>
767  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
768  <colspec colname='c1' colwidth="1.0*"/>
769  <tbody>
770    <row>
771      <entry>
772<emphasis remap='I'>window</emphasis>: WINDOW
773      </entry>
774    </row>
775    <row>
776      <entry>
777<emphasis remap='I'>kind</emphasis>: SHAPE_KIND
778      </entry>
779    </row>
780    <row>
781      <entry>
782   =&gt;
783rectangles: LISTofRECTANGLE
784      </entry>
785    </row>
786    <row>
787      <entry>
788ordering:
789{ <function>UnSorted</function>,
790<function>YSorted</function>,
791<function>YXSorted</function>,
792<function>YXBanded</function> }
793      </entry>
794    </row>
795    <row>
796      <entry>
797Errors:
798<function>Window,</function>
799<function>Match</function>
800      </entry>
801    </row>
802  </tbody>
803  </tgroup>
804</informaltable>
805
806<para>
807A list of rectangles describing the region indicated by kind, and the
808ordering of those rectangles, is returned.  The meaning of the ordering
809values is the same as in the
810<function>ShapeRectangles</function>
811request.
812</para>
813</chapter>
814
815<chapter id="Events">
816<title>Events</title>
817<para>
818<function>ShapeNotify</function>
819</para>
820
821<informaltable frame="none">
822  <?dbfo keep-together="always" ?>
823  <tgroup cols='1' align='left' colsep='0' rowsep='0'>
824  <colspec colname='c1' colwidth="1.0*"/>
825  <tbody>
826    <row>
827      <entry>
828<emphasis remap='I'>window</emphasis>: WINDOW
829      </entry>
830    </row>
831    <row>
832      <entry>
833<emphasis remap='I'>kind</emphasis>: SHAPE_KIND
834      </entry>
835    </row>
836    <row>
837      <entry>
838<emphasis remap='I'>shaped</emphasis>: BOOL
839      </entry>
840    </row>
841    <row>
842      <entry>
843<emphasis remap='I'>x, y</emphasis>: INT16
844      </entry>
845    </row>
846    <row>
847      <entry>
848<emphasis remap='I'>width</emphasis>,
849<emphasis remap='I'>height</emphasis>: CARD16
850      </entry>
851    </row>
852    <row>
853      <entry>
854<emphasis remap='I'>time</emphasis>: TIMESTAMP
855      </entry>
856    </row>
857  </tbody>
858  </tgroup>
859</informaltable>
860
861<para>
862Whenever the client bounding, clip or input shape of a window is modified, a
863<function>ShapeNotify</function>
864event is sent to each client that has used
865<function>ShapeSelectInput</function>
866to request it.
867</para>
868
869<para>
870Kind indicates which client region (bounding or clip) has been modified;
871shaped is
872<function>True</function>
873when the window has a client shape of type kind, and is
874<function>False</function>
875when the window no longer has a client shape of this type.
876The x, y, width, and height indicate the extents of the
877current shape.  When shaped is
878<function>False</function>
879these will indicate the extents of the default region.  The timestamp
880indicates the server time when the shape was changed.
881</para>
882</chapter>
883
884<chapter id="Encoding">
885<title>Encoding</title>
886<para>
887Please refer to the X11 Protocol Encoding document as this document uses
888conventions established there.
889</para>
890
891<para>
892The name of this extension is "SHAPE".
893</para>
894
895<sect1 id="New_Types">
896<title>New Types</title>
897
898<literallayout class="monospaced">
899SHAPE_KIND
900     0     Bounding
901     1     Clip
902     2     Input
903</literallayout>
904
905<literallayout class="monospaced">
906SHAPE_OP
907     0     Set
908     1     Union
909     2     Intersect
910     3     Subtract
911     4     Invert
912</literallayout>
913</sect1>
914
915<sect1 id="Requests_2">
916<title>Requests</title>
917<literallayout class="monospaced">
918<function>ShapeQueryVersion</function>
919     1     CARD8              opcode
920     1     0                  shape opcode
921     2     1                  request length
922
923=&gt;
924     1     1                  Reply
925     1                        unused
926     2     CARD16             sequence number
927     4     0                  length
928     2     CARD16             major version
929     2     CARD16             minor version
930     20                       unused
931</literallayout>
932
933<literallayout class="monospaced">
934<function>ShapeRectangles</function>
935     1     CARD8              opcode
936     1     1                  shape opcode
937     2     4+2n               request length
938     1     SHAPE_OP           operation
939     1     SHAPE_KIND         destination kind
940     1                        ordering
941           0     UnSorted
942           1     YSorted
943           2     YXSorted
944           3     YXBanded
945     1                        unused
946     4     WINDOW             destination window
947     2     INT16              x offset
948     2     INT16              y offset
949     8n    LISTofRECTANGLE    rectangles
950</literallayout>
951
952
953<literallayout class="monospaced">
954<function>ShapeMask</function>
955     1     CARD8              opcode
956     1     2                  shape opcode
957     2     5                  request length
958     1     SHAPE_OP           operation
959     1     SHAPE_KIND         destination kind
960     2                        unused
961     4     WINDOW             destination window
962     2     INT16              x offset
963     2     INT16              y offset
964     4     PIXMAP             source bitmap
965           0     None
966</literallayout>
967
968
969<literallayout class="monospaced">
970<function>ShapeCombine</function>
971     1     CARD8              opcode
972     1     3                  shape opcode
973     2     5                  request length
974     1     SHAPE_OP           operation
975     1     SHAPE_KIND         destination kind
976     1     SHAPE_KIND         source kind
977     1                        unused
978     4     WINDOW             destination window
979     2     INT16              x offset
980     2     INT16              y offset
981     4     WINDOW             source window
982</literallayout>
983
984<literallayout class="monospaced">
985<function>ShapeOffset</function>
986     1     CARD8              opcode
987     1     4                  shape opcode
988     2     4                  request length
989     1     SHAPE_KIND         destination kind
990     3                        unused
991     4     WINDOW             destination window
992     2     INT16              x offset
993     2     INT16              y offset
994</literallayout>
995
996<literallayout class="monospaced">
997<function>ShapeQueryExtents</function>
998     1     CARD8              opcode
999     1     5                  shape opcode
1000     2     2                  request length
1001     4     WINDOW             destination window
1002
1003 =&gt;
1004     1     1                  Reply
1005     1                        unused
1006     2     CARD16             sequence number
1007     4     0                  reply length
1008     1     BOOL               bounding shaped
1009     1     BOOL               clip shaped
1010     2                        unused
1011     2     INT16              bounding shape extents x
1012     2     INT16              bounding shape extents y
1013     2     CARD16             bounding shape extents width
1014     2     CARD16             bounding shape extents height
1015     2     INT16              clip shape extents x
1016     2     INT16              clip shape extents y
1017     2     CARD16             clip shape extents width
1018     2     CARD16             clip shape extents height
1019     4                        unused
1020</literallayout>
1021
1022<literallayout class="monospaced">
1023<function>ShapeSelectInput</function>
1024     1     CARD8              opcode
1025     1     6                  shape opcode
1026     2     3                  request length
1027     4     WINDOW             destination window
1028     1     BOOL               enable
1029     3                        unused
1030</literallayout>
1031
1032<literallayout class="monospaced">
1033<function>ShapeInputSelected</function>
1034     1     CARD8              opcode
1035     1     7                  shape opcode
1036     2     2                  request length
1037     4     WINDOW             destination window
1038 =&gt;
1039     1     1                  Reply
1040     1     BOOL               enabled
1041     2     CARD16             sequence number
1042     4     0                  reply length
1043     24                       unused
1044</literallayout>
1045
1046<literallayout class="monospaced">
1047<function>ShapeGetRectangles</function>
1048     1     CARD8              opcode
1049     1     8                  shape opcode
1050     2     3                  request length
1051     4     WINDOW             window
1052     1     SHAPE_KIND         source kind
1053     3                        unused
1054 =&gt;
1055     1     1                  Reply
1056     1                        ordering
1057           0     UnSorted
1058           1     YSorted
1059           2     YXSorted
1060           3     YXBanded
1061     2     CARD16             sequence number
1062     4     2n                 reply length
1063     4     CARD32             nrects
1064     20                       unused
1065     8n    LISTofRECTANGLE    rectangles
1066</literallayout>
1067</sect1>
1068
1069<sect1 id="Events_2">
1070<title>Events</title>
1071<literallayout class="monospaced">
1072<function>ShapeNotify</function>
1073     1     CARD8               type (0 + extension event base)
1074     1     SHAPE_KIND          shape kind
1075     2     CARD16              sequence number
1076     4     WINDOW              affected window
1077     2     INT16               x value of extents
1078     2     INT16               y value of extents
1079     2     CARD16              width of extents
1080     2     CARD16              height of extents
1081     4     TIMESTAMP           server time
1082     1     BOOL                shaped
1083     11                        unused
1084</literallayout>
1085</sect1>
1086</chapter>
1087
1088<glossary id="glossary">
1089<title>Glossary</title>
1090<glossentry>
1091  <glossterm>bounding region</glossterm>
1092  <glossdef>
1093<para>
1094The area of the parent window that this window will occupy.  This area is
1095divided into two parts:  the border and the interior.
1096<!-- .KE -->
1097    </para>
1098  </glossdef>
1099</glossentry>
1100<glossentry>
1101  <glossterm>clip region</glossterm>
1102  <glossdef>
1103<para>
1104The interior of the window, as a subset of the bounding region.  This
1105region describes the area that will be painted with the window background
1106when the window is cleared, will contain all graphics output to the window,
1107and will clip any subwindows.
1108<!-- .KE -->
1109    </para>
1110  </glossdef>
1111</glossentry>
1112<glossentry>
1113  <glossterm>input region</glossterm>
1114  <glossdef>
1115<para>
1116The subset of the bounding region which can ``contain'' the
1117pointer.
1118<!-- .KE -->
1119    </para>
1120  </glossdef>
1121</glossentry>
1122<glossentry>
1123  <glossterm>default bounding region</glossterm>
1124  <glossdef>
1125<para>
1126The rectangular area, as described by the core protocol window size, that
1127covers the interior of the window and its border.
1128<!-- .KE -->
1129    </para>
1130  </glossdef>
1131</glossentry>
1132<glossentry>
1133  <glossterm>default clip region</glossterm>
1134  <glossdef>
1135<para>
1136The rectangular area, as described by the core protocol window size, that
1137covers the interior of the window and excludes the border.
1138<!-- .KE -->
1139    </para>
1140  </glossdef>
1141</glossentry>
1142<glossentry>
1143  <glossterm>default input region</glossterm>
1144  <glossdef>
1145<para>
1146The rectangular area, as described by the core protocol window size, that
1147covers the interior of the window and its border.
1148<!-- .KE -->
1149    </para>
1150  </glossdef>
1151</glossentry>
1152<glossentry>
1153  <glossterm>client bounding region</glossterm>
1154  <glossdef>
1155<para>
1156The region associated with a window that is directly modified via this
1157extension when specified by
1158<function> ShapeBounding .</function>
1159This region is used in conjunction with the default bounding region
1160to produce the effective bounding region.
1161<!-- .KE -->
1162    </para>
1163  </glossdef>
1164</glossentry>
1165<glossentry>
1166  <glossterm>client clip region</glossterm>
1167  <glossdef>
1168<para>
1169The region associated with a window that is directly modified via this
1170extension when specified by
1171<function> ShapeClip . </function>
1172This region is used in conjunction with the default clip region
1173and the client bounding region to produce the effective clip region.
1174<!-- .KE -->
1175    </para>
1176  </glossdef>
1177</glossentry>
1178<glossentry>
1179  <glossterm>client input region</glossterm>
1180  <glossdef>
1181<para>
1182The region associated with a window that is directly modified via this
1183extension when specified by
1184<function> ShapeInput . </function>
1185This region is used in conjunction with the default input region
1186and the client bounding region to produce the effective input region.
1187<!-- .KE -->
1188    </para>
1189  </glossdef>
1190</glossentry>
1191<glossentry>
1192  <glossterm>effective bounding region</glossterm>
1193  <glossdef>
1194<para>
1195The actual shape of the window on the screen, including border and interior
1196(but excluding the effects of overlapping windows).  When a window has a client
1197bounding region, the effective bounding region is the intersection of the
1198default bounding region and the client bounding region.  Otherwise, the
1199effective bounding region is the same as the default bounding region.
1200<!-- .KE -->
1201    </para>
1202  </glossdef>
1203</glossentry>
1204<glossentry>
1205  <glossterm>effective clip region</glossterm>
1206  <glossdef>
1207<para>
1208The actual shape of the interior of the window on the screen (excluding the
1209effects of overlapping windows).  When a window has a client clip region or
1210a client bounding region, the effective clip region is the intersection of
1211the default clip region, the client clip region (if any) and the client
1212bounding region (if any).  Otherwise, the effective clip region is the
1213same as the default clip region.
1214<!-- .KE -->
1215    </para>
1216  </glossdef>
1217</glossentry>
1218<glossentry>
1219  <glossterm>effective input region</glossterm>
1220  <glossdef>
1221<para>
1222The actual shape of the window on the screen (excluding the
1223effects of overlapping windows) which can ``contain'' the pointer.
1224When a window has a client input region or
1225a client bounding region, the effective input region is the intersection of
1226the default input region, the client input region (if any) and the client
1227bounding region (if any).  Otherwise, the effective input region is the
1228same as the default input region.
1229<!-- .KE -->
1230    </para>
1231  </glossdef>
1232</glossentry>
1233<!--
1234Revision History
1235.LP
12361.0 - 1989 - Original Revision
1237.LP
12381.0.1 - March 2004 - Corrected misnumbering of \fIShapeInputSelected
1239and \fIShapeGetRectangles requests in encoding section.
1240.LP
12411.1 - February 2006 - Added Input regions.
1242-->
1243</glossary>
1244</book>
1245