Debian Codegraph @

specs/shapelib.xml

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