upload tizen1.0 source
[framework/uifw/xorg/lib/libxext.git] / specs / shapelib.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3                    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
4
5 <!-- lifted from troff+ms+XMan by doclifter -->
6 <book id="shapelib">
7
8 <bookinfo>
9    <title>X Nonrectangular Window Shape Extension Library</title>
10    <subtitle>X Consortium Standard</subtitle>
11    <releaseinfo>X Version 11, Release 6.4</releaseinfo>
12    <authorgroup>
13       <author>
14          <firstname>Keith</firstname><surname>Packard</surname>
15       </author>
16    </authorgroup>
17    <corpname>MIT X Consortium</corpname>
18    <copyright><year>1989</year><holder>X Consortium</holder></copyright>
19    <releaseinfo>Version 1.0</releaseinfo>
20    <affiliation><orgname>MIT X Consortium</orgname></affiliation>
21    <productnumber>X Version 11, Release 6.4</productnumber>
22
23 <legalnotice>
24
25 <para>
26 Permission is hereby granted, free of charge, to any person obtaining a copy
27 of this software and associated documentation files
28 (the &ldquo;Software&rdquo;), to deal in the Software without restriction,
29 including without limitation the rights to use, copy, modify, merge,
30 publish, distribute, sublicense, and/or sell copies of the Software, and
31 to permit persons to whom the Software is furnished to do so, subject to
32 the following conditions:
33 </para>
34
35 <para>
36 The above copyright notice and this permission notice shall be included in
37 all copies or substantial portions of the Software.
38 </para>
39
40 <para>
41 THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY
42 KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
43 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
45 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 OTHER DEALINGS IN THE SOFTWARE.
48 </para>
49
50 <para>
51 Except as contained in this notice, the name of the X Consortium shall not be
52 used in advertising or otherwise to promote the sale, use or other dealings
53 in this Software without prior written authorization from the X Consortium.
54 </para>
55 </legalnotice>
56 </bookinfo>
57
58 <chapter id='overview'>
59 <title>Overview</title>
60
61 <para>This extension provides arbitrary window and border shapes within
62 the X11 protocol.
63 </para>
64
65 <para>
66 The restriction of rectangular windows within the X protocol is a significant
67 limitation in the implementation of many styles of user interface.  For
68 example, many transient windows would like to display a
69 &ldquo;drop shadow&rdquo; to give the illusion of 3 dimensions.  As
70 another example, some user interface style guides call for buttons with
71 rounded corners; the full simulation of a nonrectangular shape,
72 particularly with respect to event distribution and cursor shape, is not
73 possible within the core X protocol.  As a final example, round clocks
74 and nonrectangular icons are desirable visual addition to the desktop.
75 </para>
76
77 <para>
78 This extension provides mechanisms for changing the visible shape of a
79 window to an arbitrary, possibly disjoint, nonrectangular form.  The intent
80 of the extension is to supplement the existing semantics, not replace them.
81 In particular, it is desirable for clients that are unaware of the
82 extension to still be able to cope reasonably with shaped windows.  For
83 example, window managers should still be able to negotiate screen
84 real estate in rectangular pieces.  Toward this end, any shape specified for
85 a window is clipped by the bounding rectangle for the window as specified by
86 the window's geometry in the core protocol.  An expected convention would be
87 that client programs expand their shape to fill the area offered by the
88 window manager.
89 </para>
90 </chapter>
91
92 <chapter id='description'>
93 <title>Description</title>
94
95 <para>
96 Each window (even with no shapes specified) is defined by two regions:  the
97 <emphasis remap='I'>bounding region</emphasis> and the
98 <emphasis remap='I'>clip region</emphasis>.  The bounding region is the
99 area of the parent window that the window will occupy (including border).
100 The clip region is the subset of the bounding region that is available for
101 subwindows and graphics.  The area between the bounding region and the
102 clip region is defined to be the border of the window.
103 </para>
104
105 <para>
106 A nonshaped window will have a bounding region that is a rectangle spanning
107 the window, including its border; the clip region will be a rectangle
108 filling the inside dimensions (not including the border).  In this document,
109 these areas are referred to as the
110 <emphasis remap='I'>default bounding region</emphasis> and the
111 <emphasis remap='I'>default clip region</emphasis>.  For a window with
112 inside size of <emphasis remap='I'>width</emphasis> by
113 <emphasis remap='I'>height</emphasis> and border width
114 <emphasis remap='I'>bwidth</emphasis>, the default bounding and clip
115 regions are the rectangles (relative to the window origin):
116 </para>
117
118 <literallayout remap='Ds'>
119 bounding.x = -<emphasis remap='I'>bwidth</emphasis>
120 bounding.y = -<emphasis remap='I'>bwidth</emphasis>
121 bounding.width = <emphasis remap='I'>width</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
122 bounding.height = <emphasis remap='I'>height</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
123
124 clip.x = 0
125 clip.y = 0
126 clip.width = <emphasis remap='I'>width</emphasis>
127 clip.height = <emphasis remap='I'>height</emphasis>
128 </literallayout>
129
130 <para>
131 This extension allows a client to modify either or both of the bounding or
132 clip regions by specifying new regions that combine with the default
133 regions.  These new regions are called the
134 <emphasis remap='I'>client bounding region</emphasis> and the
135 <emphasis remap='I'>client clip region</emphasis>.  They are specified
136 relative to the origin of the window and are always defined by offsets
137 relative to the window origin (that is, region adjustments are not
138 required when the window is moved).  Three mechanisms for specifying
139 regions are provided:  a list of rectangles, a bitmap, and an existing
140 bounding or clip region from a window.  This is modeled on the specification
141 of regions in graphics contexts in the core protocol and allows a variety
142 of different uses of the extension.
143 </para>
144
145 <para>
146 When using an existing window shape as an operand in specifying a new shape,
147 the client region is used, unless none has been set, in which case the
148 default region is used instead.
149 </para>
150
151 <para>
152 The <emphasis remap='I'>effective bounding region</emphasis> of a window is
153 defined to be the intersection of the client bounding region with the default
154 bounding region.  Any portion of the client bounding region that is not
155 included in the default bounding region will not be included in the
156 effective bounding region on the screen.  This means that window managers
157 (or other geometry managers) used to dealing with rectangular client windows
158 will be able to constrain the client to a rectangular area of the screen.
159 </para>
160
161 <para>
162 Construction of the effective bounding region is dynamic; the client bounding
163 region is not mutated to obtain the effective bounding region.  If a client
164 bounding region is specified that extends beyond the current default bounding
165 region, and the window is later enlarged, the effective bounding region will
166 be enlarged to include more of the client bounding region.
167 </para>
168
169 <para>
170 The <emphasis remap='I'>effective clip region</emphasis> of a window is
171 defined to be the intersection of the client clip region with both the
172 default clip region and the client bounding region.  Any portion of the
173 client clip region that is not included in both the default clip region
174 and the client bounding region will not be included in the effective clip
175 region on the screen.
176 </para>
177
178 <para>
179 Construction of the effective clip region is dynamic; the client clip region is
180 not mutated to obtain the effective clip region.  If a client clip region is
181 specified that extends beyond the current default clip region and the
182 window or its bounding region is later enlarged, the effective clip region will
183 be enlarged to include more of the client clip region if it is included in
184 the effective bounding region.
185 </para>
186
187 <para>
188 The border of a window is defined to be the difference between the effective
189 bounding region and the effective clip region.  If this region is empty, no
190 border is displayed.  If this region is nonempty, the border is filled
191 using the border-tile or border-pixel of the window as specified in the core
192 protocol.  Note that a window with a nonzero border width will never be able
193 to draw beyond the default clip region of the window.  Also note that a zero
194 border width does not prevent a window from having a border, since the clip
195 shape can still be made smaller than the bounding shape.
196 </para>
197
198 <para>
199 All output to the window and visible regions of any subwindows will be
200 clipped to the effective clip region.  The server must not retain window
201 contents beyond the effective bounding region with backing store.  The window's
202 origin (for graphics operations, background tiling, and subwindow placement)
203 is not affected by the existence of a bounding region or clip region.
204 </para>
205
206 <para>
207 Areas that are inside the default bounding region but outside the effective
208 bounding region are not part of the window; these areas of the screen will
209 be occupied by other windows.  Input events that occur within the default
210 bounding region but outside the effective bounding region will be delivered as
211 if the window was not occluding the event position.  Events that occur in
212 a nonrectangular border of a window will be delivered to that window, just
213 as for events that occur in a normal rectangular border.
214 </para>
215
216 <para>An
217 <function>InputOnly</function>
218 window can have its bounding region set, but it is a
219 <function>Match</function>
220 error to attempt to set a clip region on an
221 <function>InputOnly</function>
222 window or to specify its clip region as a source to a request
223 in this extension.
224 </para>
225
226 <para>
227 The server must accept changes to the clip region of a root window, but
228 the server is permitted to ignore requested changes to the bounding region
229 of a root window.  If the server accepts bounding region changes, the contents
230 of the screen outside the bounding region are implementation dependent.
231 </para>
232 </chapter>
233
234 <chapter id='c_language_binding'>
235 <title>C Language Binding</title>
236
237 <para>
238 The C functions provide direct access to the protocol and add no additional
239 semantics.
240 </para>
241
242 <para>The include file for this extension is
243 &lt;<symbol role='Pn'>X11/extensions/shape.h</symbol>&gt;.
244 The defined shape kinds are
245 <function>ShapeBounding</function>
246 and
247 <function>ShapeClip</function>
248 The defined region operations are
249 <function>ShapeSet</function>
250 <function>ShapeUnion</function>
251 <function>ShapeIntersect</function>
252 <function>ShapeSubtract</function>
253 and
254 <function>ShapeInvert</function>.</para>
255
256 <funcsynopsis>
257 <funcprototype>
258 <funcdef>Bool<function> XShapeQueryExtension</function></funcdef>
259 <paramdef>Display <parameter>*display</parameter></paramdef>
260 <paramdef>int <parameter>*event_base</parameter></paramdef>
261 <paramdef>int <parameter>*error_base</parameter></paramdef>
262 </funcprototype>
263 </funcsynopsis>
264
265 <para>
266 <function>XShapeQueryExtension</function>
267 returns
268 <function>True</function>
269 if the specified display supports the SHAPE extension else
270 <function>False</function>
271 If the extension is supported, *event_base is set to the event number for
272 <function>ShapeNotify</function>
273 events and *error_base would be set to the error number for the first error for
274 this extension.  Because no errors are defined for this version of
275 the extension, the value returned here is not defined (nor useful).
276 </para>
277
278 <funcsynopsis>
279 <funcprototype>
280 <funcdef>Status<function> XShapeQueryVersion</function></funcdef>
281 <paramdef>Display<parameter> *display</parameter></paramdef>
282 <paramdef>int<parameter> *major_version</parameter></paramdef>
283 <paramdef>int<parameter> *minor_version</parameter></paramdef>
284 </funcprototype>
285 </funcsynopsis>
286
287 <para>
288 If the extension is supported,
289 <function>XShapeQueryVersion</function>
290 sets the major and minor version numbers of the
291 extension supported by the display and returns a nonzero value.
292 Otherwise, the arguments are not set and zero is returned.
293 </para>
294
295 <funcsynopsis>
296 <funcprototype>
297 <funcdef><function>XShapeCombineRegion</function></funcdef>
298 <paramdef>Display<parameter> *display</parameter></paramdef>
299 <paramdef>Window<parameter> dest</parameter></paramdef>
300 <paramdef>int<parameter> dest_kind</parameter></paramdef>
301 <paramdef>int<parameter> x_off</parameter></paramdef>
302 <paramdef>int<parameter> y_off</parameter></paramdef>
303 <paramdef>int<parameter> region</parameter></paramdef>
304 <paramdef>int<parameter> op</parameter></paramdef>
305 <paramdef>REGION<parameter> *region</parameter></paramdef>
306 </funcprototype>
307 </funcsynopsis>
308
309 <para>
310 <function>XShapeCombineRegion</function>
311 converts the specified region into a list of rectangles and calls
312 <function>XShapeCombineRectangles</function>
313 </para>
314
315 <funcsynopsis>
316 <funcprototype>
317 <funcdef><function>XShapeCombineRectangles</function></funcdef>
318 <paramdef>Display<parameter> *display</parameter></paramdef>
319 <paramdef>Window<parameter> dest</parameter></paramdef>
320 <paramdef>int<parameter> dest_kind</parameter></paramdef>
321 <paramdef>int<parameter> x_off</parameter></paramdef>
322 <paramdef>int<parameter> y_off</parameter></paramdef>
323 <paramdef>XRectangle<parameter> *rectangles</parameter></paramdef>
324 <paramdef>int<parameter> n_rects</parameter></paramdef>
325 <paramdef>int<parameter> op</parameter></paramdef>
326 <paramdef>int<parameter> ordering</parameter></paramdef>
327 </funcprototype>
328 </funcsynopsis>
329
330 <para>
331 If the extension is supported,
332 <function>XShapeCombineRectangles</function>
333 performs a
334 <function>ShapeRectangles</function>
335 operation; otherwise, the request is ignored.
336 </para>
337
338 <funcsynopsis>
339 <funcprototype>
340 <funcdef><function>XShapeCombineMask</function></funcdef>
341 <paramdef>Display<parameter> *display</parameter></paramdef>
342 <paramdef>int<parameter> dest</parameter></paramdef>
343 <paramdef>int<parameter> dest_kind</parameter></paramdef>
344 <paramdef>int<parameter> x_off</parameter></paramdef>
345 <paramdef>int<parameter> y_off</parameter></paramdef>
346 <paramdef>Pixmap<parameter> src</parameter></paramdef>
347 <paramdef>int<parameter> op</parameter></paramdef>
348 </funcprototype>
349 </funcsynopsis>
350
351 <para>
352 If the extension is supported,
353 <function>XShapeCombineMask</function>
354 performs a
355 <function>ShapeMask</function>
356 operation; otherwise, the request is ignored.
357 </para>
358
359 <funcsynopsis>
360 <funcprototype>
361 <funcdef><function>XShapeCombineShape</function></funcdef>
362 <paramdef>Display<parameter> *display</parameter></paramdef>
363 <paramdef>Window<parameter> dest</parameter></paramdef>
364 <paramdef>int<parameter> dest_kind</parameter></paramdef>
365 <paramdef>int<parameter> x_off</parameter></paramdef>
366 <paramdef>int<parameter> y_off</parameter></paramdef>
367 <paramdef>Window<parameter> src</parameter></paramdef>
368 <paramdef>int<parameter> src_kind</parameter></paramdef>
369 <paramdef>int<parameter> op</parameter></paramdef>
370 </funcprototype>
371 </funcsynopsis>
372
373 <para>
374 If the extension is supported,
375 <function>XShapeCombineShape</function>
376 performs a
377 <function>ShapeCombine</function>
378 operation; otherwise, the request is ignored.
379 </para>
380
381 <funcsynopsis>
382 <funcprototype>
383 <funcdef><function>XShapeOffsetShape</function></funcdef>
384 <paramdef><parameter>display</parameter></paramdef>
385 <paramdef><parameter>dest</parameter></paramdef>
386 <paramdef><parameter>dest_kind</parameter></paramdef>
387 <paramdef><parameter>x_off</parameter></paramdef>
388 <paramdef><parameter>y_off</parameter></paramdef>
389 </funcprototype>
390 </funcsynopsis>
391
392 <para>
393 If the extension is supported,
394 <function>XShapeOffsetShape</function>
395 performs a
396 <function>ShapeOffset</function>
397 operation; otherwise, the request is ignored.
398 </para>
399
400 <funcsynopsis>
401 <funcprototype>
402 <funcdef>Status <function>XShapeQueryExtents</function></funcdef>
403 <paramdef>Display<parameter> *display</parameter></paramdef>
404 <paramdef>Window<parameter> window</parameter></paramdef>
405 <paramdef>Bool<parameter> *bounding_shaped</parameter></paramdef>
406 <paramdef>int<parameter> *x_bounding</parameter></paramdef>
407 <paramdef>int<parameter> *y_bounding</parameter></paramdef>
408 <paramdef>unsigned int<parameter> *w_bounding</parameter></paramdef>
409 <paramdef>unsigned int<parameter> *h_bounding</parameter></paramdef>
410 <paramdef>Bool<parameter> *clip_shaped</parameter></paramdef>
411 <paramdef>int<parameter> *x_clip</parameter></paramdef>
412 <paramdef>int<parameter> *y_clip</parameter></paramdef>
413 <paramdef>unsigned int<parameter> *w_clip</parameter></paramdef>
414 <paramdef>unsigned int<parameter> *h_clip</parameter></paramdef>
415 </funcprototype>
416 </funcsynopsis>
417
418 <para>
419 If the extension is supported,
420 <function>XShapeQueryExtents</function>
421 sets x_bounding, y_bounding, w_bounding, h_bounding to the extents of the
422 bounding shape and sets x_clip, y_clip, w_clip, h_clip to the extents of
423 the clip shape.  For unspecified client regions, the extents of the
424 corresponding default region are used.
425 </para>
426
427 <para>
428 If the extension is supported, a nonzero value is returned; otherwise,
429 zero is returned.
430 </para>
431
432 <funcsynopsis>
433 <funcprototype>
434 <funcdef><function>XShapeSelectInput</function></funcdef>
435 <paramdef>Display<parameter> *display</parameter></paramdef>
436 <paramdef>Window<parameter> window</parameter></paramdef>
437 <paramdef>unsigned long<parameter> mask</parameter></paramdef>
438 </funcprototype>
439 </funcsynopsis>
440
441 <para>
442 To make this extension more compatible with other interfaces, although
443 only one event type can be selected via the extension,
444 <function>XShapeSelectInput</function>
445 provides a general mechanism similar to the standard Xlib binding for
446 window events.  A mask value has been defined,
447 <function>ShapeNotifyMask</function>
448 that is the only valid bit in mask that may be specified.
449 The structure for this event is defined as follows:
450 </para>
451
452 <literallayout remap='Ds'>
453 typedef struct {
454     int type;     /* of event */
455     unsigned long serial;     /* # of last request processed by server */
456     Bool send_event;     /* true if this came frome a SendEvent request */
457     Display *display;     /* Display the event was read from */
458     Window window;     /* window of event */
459     int kind;     /* ShapeBounding or ShapeClip */
460     int x, y;     /* extents of new region */
461     unsigned width, height;
462     Time time;     /* server timestamp when region changed */
463     Bool shaped;     /* true if the region exists */
464 } XShapeEvent;
465 </literallayout>
466
467 <funcsynopsis>
468 <funcprototype>
469 <funcdef>unsigned long <function>XShapeInputSelected</function></funcdef>
470 <paramdef>Display<parameter> *display</parameter></paramdef>
471 <paramdef>Window<parameter> window</parameter></paramdef>
472 </funcprototype>
473 </funcsynopsis>
474
475 <para>
476 <function>XShapeInputSelected</function>
477 returns the current input mask for extension events on the specified
478 window; the value returned if
479 <function>ShapeNotify</function>
480 is selected for is
481 <function>ShapeNotifyMask</function>
482 otherwise, it returns zero.
483 If the extension is not supported, it returns zero.
484 </para>
485
486 <funcsynopsis>
487 <funcprototype>
488 <funcdef>XRectangle<function> *XShapeGetRectangles</function></funcdef>
489 <paramdef>Display<parameter> *display</parameter></paramdef>
490 <paramdef>Window<parameter> window</parameter></paramdef>
491 <paramdef>int<parameter> kind</parameter></paramdef>
492 <paramdef>int<parameter> *count</parameter></paramdef>
493 <paramdef>int<parameter> *ordering</parameter></paramdef>
494 </funcprototype>
495 </funcsynopsis>
496
497 <para>
498 If the extension is not supported,
499 <function>XShapeGetRectangles</function>
500 returns NULL.  Otherwise, it returns a list of rectangles that describe the
501 region specified by kind.
502 </para>
503 </chapter>
504
505 <glossary id='glossary'>
506
507 <glossdiv>
508 <title>Glossary</title>
509 <glossentry id='bounding_region'>
510   <glossterm>bounding region</glossterm>
511   <glossdef><para>The area of the parent window that this window will occupy.
512 This area is divided into two parts:  the border and the interior.</para>
513   </glossdef>
514 </glossentry>
515
516 <glossentry id='clip_region'>
517   <glossterm>clip region</glossterm>
518   <glossdef><para>The interior of the window, as a subset of the bounding
519 region.  This region describes the area that will be painted with the
520 window background when the window is cleared, will contain all graphics
521 output to the window, and will clip any subwindows.</para></glossdef>
522 </glossentry>
523
524 <glossentry id='default_bounding_region'>
525   <glossterm>default bounding region</glossterm>
526   <glossdef><para>The rectangular area, as described by the core protocol
527 window size, that covers the interior of the window and its border.</para>
528   </glossdef>
529 </glossentry>
530
531 <glossentry id='default_clip_region'>
532   <glossterm>default clip region</glossterm>
533   <glossdef><para>The rectangular area, as described by the core protocol
534 window size, that covers the interior of the window and excludes the border.
535   </para></glossdef>
536 </glossentry>
537
538 <glossentry id='client_bounding_region'>
539   <glossterm>client bounding region</glossterm>
540   <glossdef><para>The region associated with a window that is directly
541 modified via this extension when specified by
542 <function>ShapeBounding</function>
543 This region is used in conjunction with the default bounding region
544 to produce the effective bounding region.</para></glossdef>
545 </glossentry>
546
547 <glossentry id='client_clip_region'>
548   <glossterm>client clip region</glossterm>
549   <glossdef><para>The region associated with a window that is directly
550 modified via this extension when specified by
551 <function>ShapeClip</function>
552 This region is used in conjunction with the default clip region
553 and the client bounding region to produce the effective clip region.</para>
554   </glossdef>
555 </glossentry>
556
557 <glossentry id='effective_bounding_region'>
558   <glossterm>effective bounding region</glossterm>
559   <glossdef><para>The actual shape of the window on the screen, including
560 border and interior (but excluding the effects of overlapping windows).
561 When a window has a client bounding region, the effective bounding region
562 is the intersection of the default bounding region and the client bounding
563 region.  Otherwise, the effective bounding region is the same as the
564 default bounding region.</para>
565   </glossdef>
566 </glossentry>
567
568 <glossentry id='effective_clip_region'>
569   <glossterm>effective clip region</glossterm>
570   <glossdef><para>The actual shape of the interior of the window on the
571 screen (excluding the effects of overlapping windows).  When a window
572 has a client clip region or a client bounding region, the effective
573 clip region is the intersection of the default clip region, the client
574 clip region (if any) and the client bounding region (if any).  Otherwise,
575 the effective clip region is the same as the default clip region.</para>
576   </glossdef>
577 </glossentry>
578
579 </glossdiv>
580 </glossary>
581 </book>