appgrp.xml 35.9 KB
Newer Older
1 2 3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE article
          PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
4 5 6 7
          "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>
8

9
<article id="appgrp">
10 11 12 13 14 15 16 17 18 19 20 21 22

<articleinfo>
   <title>Application Group Extension to the X Protocol</title>
   <subtitle>X Consortium Standard</subtitle>
   <authorgroup>
     <author>
       <firstname>Kaleb</firstname>
       <othername>S.</othername>
       <surname>KEITHLEY</surname>
       <affiliation><orgname>X Consortium, Inc</orgname></affiliation>
       <email>kaleb@x.org</email>
     </author>
   </authorgroup>
23 24 25 26
   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
   <releaseinfo>Version 1.0</releaseinfo>
   <copyright><year>1996</year><holder>X Consortium, Inc.</holder>
   </copyright>
27 28 29

<legalnotice>
<para>
30
All Rights Reserved.
31 32 33
</para>

<para>
34
THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND,
35 36 37 38 39 40 41 42 43 44 45 46
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OF OR OTHER DEALINGS IN THE SOFTWARE.
</para>
<para>
Except as contained in this notice, the name of the X Consortium shall not be used in advertising
or otherwise to promote the sale, use or other dealings in this Software without prior written
authorization from the X Consortium.
</para>
47
<para>X Window System is a trademark of The OpenGroup.</para>
48 49
</legalnotice>

50 51
<pubdate>27 September 1996</pubdate>

52 53 54 55 56 57 58 59 60 61 62
<abstract>
<para>
The Application Group Extension to the X protocol is intended to provide a framework to allow
more than one program to manage X applications on the desktop. The initial use of this extension
will be to insert or embed the windows of X programs into the windows of another program, such
as a web browser. This extension is not intended to address larger embedding issues that, for
example, OpenDoc does, such as shared menu bars, etc.
</para>
</abstract>
</articleinfo>

63
<sect1 id='Purpose_and_Goals'>
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<title>Purpose and Goals</title>

<para>
The Application Group Extension to the X protocol is intended to provide
a framework to allow more than one program to manage X applications on
the desktop. The initial use of this extension will be to insert or embed
the windows of X programs into the windows of another program, such as a
web browser. This extension is not intended to address larger embedding
issues that, for example, OpenDoc does, such as shared menu bars, etc.
Using X programs on the World Wide Web allows for greater control of the
presentation and takes advantage of the existing body of X programs rather
than re-implement them in another language. In addition it allows the
embedding of non-X programs into web browsers by using third party products
like Wabi, MAE, and WinCenter.
<footnote><para>
Wabi is a trademark of Sun Microsystems, Inc. MAE is a trademark of Apple
Computer, Inc. WinCenter is a trademark of Network Computing Devices, Inc.
</para></footnote>
</para>

</sect1>

86
<sect1 id='Overview_of_the_protocol'>
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
<title>Overview of the protocol.</title>

<para>
This extension introduces the concept of an Application Group. An Application Group is a set of one or more applications that are primarily managed by a special application known as the Application Group Leader, which, for example, might be a web browser. The primary purpose of Application Groups is to provide a means of sharing the Substructure-Redirect attribute of the root window between the window manager and one or more Application Group Leaders.
</para>

<para>
To join an Application Group an application must present the proper authorization during the connection setup. Authorizations are generated by the X server at the request of an Application Group Leader, and are then stored for the application to use to establish its connection to the X server. To generate an authorization the Application Group Leader sends a request to the server naming the Application Group to which the authorization will be bound, and any applications that connect using that authorization  will automatically become part of the associated Application Group. The protocol to generate an authorization is defined in the Security Extension specification.
</para>

<para>
As a member of an Application Group, when an application creates and maps a window as a child of the root window, the MapRequest and ConfigureRequest events are delivered to the Application Group Leader instead of the window manager. The Application Group Leader may then reparent the window into its own window hierarchy; or reissue the map request, in which case the window comes under the control of the window manager.
</para>

</sect1>
102
<sect1 id='Requests'>
103 104 105 106 107
<title>Requests</title>


<para><emphasis role='bold'>AppGroupQueryVersion</emphasis></para>

Matt Dew's avatar
Matt Dew committed
108 109 110 111
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colsep='0' colwidth='1.0*'/>
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
<tbody>
  <row>
    <entry>client_major_version: CARD16</entry>
  </row>
  <row>
    <entry>client_minor_version: CARD16</entry>
  </row>
  <row>
    <entry>=&gt;</entry>
  </row>
  <row>
    <entry>server_major_version: CARD16</entry>
  </row>
  <row>
    <entry>server_minor_version: CARD16</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
If supplied, the client_major_version and client_minor_version indicate what version of the protocol the application wants the server to implement. The server version numbers returned indicate the version of the protocol the X server actually supports. This may not match the versions requested by the application. An implementation may (but need not) support more than one version simultaneously. The server_major_version and server_minor_version numbers are a mechanism to support any future revisions of the Application Group extension protocol which may be necessary. In general, the major version would increment for incompatible changes, and the minor version would increment for small, upward-compatible changes. X servers that support the protocol defined in this document will return a server_major_version of 1 and a server_minor_version of 0.
</para>


<para><emphasis role='bold'>AppGroupCreate</emphasis></para>

Matt Dew's avatar
Matt Dew committed
139 140 141 142
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colsep='0' colwidth='1.0*'/>
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
<tbody>
  <row>
    <entry>app_group: APPGROUP</entry>
  </row>
  <row>
    <entry>value_mask: BITMASK</entry>
  </row>
  <row>
    <entry>value_list: LISTofVALUE</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
This request creates an Application Group using app_group as the Application Group ID.
</para>


<para>
&nbsp;
</para>


<para>
The value_mask and value_list specify attributes of the Application Group that are to be explicitly initialized. The attributes, their types, and the default values are:
</para>

Matt Dew's avatar
Matt Dew committed
171 172 173 174 175 176
<informaltable frame="topbot">
<?dbfo keep-together="always" ?>
<tgroup cols='3' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<colspec colname='c3' colwidth='1.0*'/>
177
<tbody>
Matt Dew's avatar
Matt Dew committed
178
  <row rowsep='1'>
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
  <entry>Attribute</entry>
  <entry>Type</entry>
  <entry>Default</entry>
  </row>
  <row>
    <entry>app_group_leader</entry>
    <entry>Bool</entry>
    <entry>True</entry>
  </row>
  <row>
    <entry>single_screen</entry>
    <entry>Bool</entry>
    <entry>True</entry>
  </row>
  <row>
    <entry>default_root</entry>
    <entry>Window</entry>
    <entry>None</entry>
  </row>
  <row>
    <entry>root_visual</entry>
    <entry>VisualID</entry>
    <entry>None</entry>
  </row>
  <row>
    <entry>default_colormap</entry>
    <entry>Colormap</entry>
    <entry>None</entry>
  </row>
  <row>
    <entry>black_pixel</entry>
    <entry>Pixel</entry>
    <entry>0</entry>
  </row>
  <row>
    <entry>white_pixel</entry>
    <entry>Pixel</entry>
    <entry>0</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
If the single_screen attribute is True then the number of video screens returned to a program in the Application Group in the connection setup message is one, irrespective of how many video screens the server actually has. If a server supports both video and print screens, then all print screens will always be returned. If single_screen is specified as True then the connection setup message will contain only the information about the video screen which has default_root as its root window, plus any print screens.
</para>

<note><para>
The intent is to allow an embedding manager to ensure that it will be able to reparent any top-level windows that Application Group members create. By hiding the fact that there are other screens it can be reasonably assured that applications will only create top-level windows on the same screen that it itself appears on. An embedding manager should take care not to supply an invalid display, e.g. :0.1, to a program that will be in an Application Group where the single_screen attribute is True.
</para></note>

<para>
If single_screen is set to True default_root specifies which screen will be returned as screen zero in the connection setup message for applications in the Application Group. If set to None, then the real screen zero is used, otherwise the screen which has default_root as its root window will be used.
</para>


<para>
If single_screen is set to True the  root_visual and default_colormap attributes may be used to over-ride the default values that are returned in the connection setup information returned to new programs in the Application Group. If None is specified for root_visual or default_colormap then the normal default values for the screen (possibly spedified by default_root) are used, otherwise the specified values are used. If root_visual and/or default_colormap are specified they must be valid, i.e. root_visual must be a visual type available on the screen, and the colormap, if specified, must be a valid colormap for the visual that is used.
</para>

<para>
IF single_screen is set to True and default_colormap is not specified as None, the black_pixel and white_pixel attributes must be specified, and they will over-ride the default values that are returned in the connection setup returned to new programs in the Application Group. If default_colormap is specified as None and black_pixel and/or white_pixel are specified, they will be ignored.
</para>

<para>
The app_group_leader attribute is used to identify the Application Group Leader program for the app_group. By specifying True the server will identify the program making the request as the Application Group Leader for the application group. The Application Group Leader receives MapRequest and ConfigureRequest events from the server when an attempt is made to map or configure top-level windows of a program in an Application Group, instead of being sent to a window manager that has selected SubstructureRedirect events on the root window. The parent window field in these events will contain the Application Group ID.
</para>

<para><emphasis role='bold'>AppGroupDestroy</emphasis></para>

<para>app_group: APPGROUP</para>


<para>
This request destroys the app_group. If the app_group_leader attribute for the app_group is True, then any applications in the Application Group that are still connected will be killed as if a KillClient request had been received for that application.
</para>

<note><para>
If the application that created a non-embedded Application Group exits, and therefore any Authorizations to be cancelled, and any applications  that attempt to open new connections to the X server using one of those Authorizations will be unable to do so.
</para></note>

<para><emphasis role='bold'>AppGroupGetAttr</emphasis></para>


Matt Dew's avatar
Matt Dew committed
263 264 265 266
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
<tbody>
  <row>
    <entry>>app_group: APPGROUP</entry>
  </row>
  <row>
    <entry>=&gt;</entry>
  </row>
  <row>
    <entry>LISTofVALUE</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
This request returns the application group attributes for app_group.
</para>

<para><emphasis role='bold'>AppGroupQuery</emphasis></para>

Matt Dew's avatar
Matt Dew committed
287 288 289 290
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
<tbody>
  <row>
    <entry>resource: XID</entry>
  </row>
  <row>
    <entry>=&gt;</entry>
  </row>
  <row>
    <entry>app_group: APPGROUP</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
This request returns the Application Group ID of the application that created resource or None if that application is not associated with any Application Group. The resource value may be the resource base of the application.
</para>

<para><emphasis role='bold'>AppGroupCreateAssociation</emphasis></para>

Matt Dew's avatar
Matt Dew committed
311 312 313 314
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
<tbody>
  <row>
    <entry>window: WINDOW</entry>
  </row>
  <row>
    <entry>window_type: CARD32</entry>
  </row>
  <row>
    <entry>system_window: LISTofCARD8</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
This request associates window with system_window. The window_type indicates the native window system of the application making the request. For non-X window_types both the embedding manager and the server must be executing on the same host. When system_window is Microsoft Windows or OS/2 Presentation Manager, the system_window is an HWND; when the native window system is Macintosh, the system_window is a WindowPtr and a Rect. The window may be used for any X request that takes a Window.
</para>

<para><emphasis role='bold'>AppGroupDestroyAssociation</emphasis></para>

Matt Dew's avatar
Matt Dew committed
335 336 337 338
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
339 340 341 342 343 344 345 346 347 348 349 350 351 352
<tbody>
  <row>
    <entry>window: WINDOW</entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
This request destroys the association created with AppGroupCreateAssociation. The window is destroyed. The system_window that was specified in the AppGroupCreateAssociation request is not affected.
</para>

</sect1>

353
<sect1 id='Changes_to_Existing_Requests'>
354 355
<title>Changes to Existing Requests</title>

356
<sect2 id='MapWindow'>
357 358 359 360 361 362 363
<title>MapWindow</title>

<para>
If the override-redirect attribute of the window is False and if the window is a child of a root window and if the window belongs to an application that is in an application group and if some other application is the application group leader for that group, then a MapRequest event is generated and the window remains unmapped. Otherwise, the core protocol semantics apply.
</para>

</sect2>
364
<sect2 id='ConfigureWindow'>
365 366 367 368 369 370 371
<title>ConfigureWindow</title>

<para>
If the override-redirect attribute of the window is False and if the window is a child of a root window and if the window belongs to an application that is in an application group and if some other application is the application group leader for that group, then a ConfigureRequest event is generated and the window remains unchanged. Otherwise, the core protocol semantics apply.
</para>

</sect2>
372
<sect2 id='CreateWindow'>
373 374 375 376 377 378 379 380 381 382 383 384
<title>CreateWindow</title>

<para>
When a program in an Application Group creates a window that is a child of a root window and specifies CopyFromParent for the Visual, if the single_screen attribute is True and the root_visual attribute is set to something other than None, then the window will be created using the Application Group’s root_visual, otherwise core protocol semantics apply.
</para>

<para>
When a program in an Application Group creates a window that is a child of a root window and specifies CopyFromParent for the Colormap, if the single_screen attribute is True, the default_colormap attribute is set to something other than None, and the window’s Visual is the same as the Application Group’s root_visual attribute, then the window will be created using the Application Group’s default_colormap, otherwise core protocol semantics apply.
</para>

</sect2>

385
<sect2 id='ChangeWindowAttributes'>
386 387 388 389 390 391 392 393 394 395
<title>ChangeWindowAttributes</title>

<para>
When a program in an Application Group changes the attributes of a window that is a child of a root window and specifies CopyFromParent for the Colormap, if the single_screen attribute is True, the default_colormap attribute is set to something other than None, and the window’s Visual is the same as the Application Group’s root_visual attribute, then the window will be created using the Application Group’s default_colormap, otherwise core protocol semantics apply.
</para>

</sect2>

</sect1>

396
<sect1 id='Changes_to_Existing_Events'>
397 398 399 400 401 402 403 404 405 406 407
<title>Changes to Existing Events</title>

<para>
When the top-level window of an application that is a member of an Application Group  is the target of a MapWindow or ConfigureWindow request, if there is an Application Group Leader then MapRequest and ConfigureRequest events are automatically delivered to it, otherwise the core protocol semantics apply, i.e. they are delivered to the client, if any, that has SubstructureRedirect set in its root-window event mask, e.g. the window manager.
</para>

<note><para>
The Application Group Leader must not select SubstructuRedirect events on a root window as doing so would result in a core protocol error; only one client is permitted to do so, and that is usually the window manager.
</para></note>


408
<sect2 id='MapRequest'>
409 410 411 412 413 414 415
<title>MapRequest</title>

<para>
When a MapWindow request is received for a window whose override-redirect attribut is set to False and whose parent is the root window and the window belongs to an application that is in an application group and there is an application group leader for the group, then this event is delivered to the Application Group Leader with the parent field in the event set to the AppGroup ID. Otherwise the core protocol semantics apply.
</para>

</sect2>
416
<sect2 id='ConfigureRequest'>
417 418 419 420 421 422 423 424 425
<title>ConfigureRequest</title>

<para>
When a ConfigureWindow request is received for a window whose override-redirect attribut is set to False and whose parent is the root window and the window belongs to an application that is in an application group and there is an application group leader for the group, then this event is delivered to the Application Group Leader with the parent field in the event set to the AppGroup ID. Otherwise the core protocol semantics apply.
</para>

</sect2>
</sect1>

426
<sect1 id='Errors'>
427 428
<title>Errors</title>

429
<sect2 id='AppGroupQueryVersion'>
430 431 432 433 434 435 436 437
<title>AppGroupQueryVersion</title>

<para>
There are no errors for AppGroupQueryVersion.
</para>

</sect2>

438
<sect2 id='AppGroupCreate'>
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
<title>AppGroupCreate</title>

<para>
A Window error is returned if default_root is specified and is not a valid root window..
</para>

<para>
A Color error is returned default_colormap is specified but default_colormap is not a valid colormap for the screen of default_root.
</para>

<para>
A Match error is returned if root_visual and default_colormap are both specified, but
</para>

<para>
default_colormap’s visual is not root_visual.
</para>

<para>
A Match error is returned if root_visual does not exist for the screen of the default_root.
</para>

</sect2>

463
<sect2 id='AppGroupDestroy'>
464 465 466 467 468 469 470 471 472 473 474 475
<title>AppGroupDestroy</title>

<para>
An AppGroup error is returned if app_group is not a valid Application Group.
</para>

<para>
An Access error is returned if an untrusted application attempts to destroy an Application Group created by a trusted application.
</para>

</sect2>

476
<sect2 id='AppGroupGetAttr'>
477 478 479 480 481 482 483 484 485 486 487 488
<title>AppGroupGetAttr</title>

<para>
An AppGroup error is returned if app_group is not a valid Application Group.
</para>

<para>
An Access error is returned if an untrusted application attempts to get the attributes of an Application Group created by a trusted application.
</para>

</sect2>

489
<sect2 id='AppGroupQuery'>
490 491 492 493 494 495 496 497
<title>AppGroupQuery</title>

<para>
An Access error is returned if an untrusted application attempts to query the Application Group of a trusted application.
</para>

</sect2>

498
<sect2 id='AppGroupCreateAssociation'>
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
<title>AppGroupCreateAssociation</title>

<para>
A Match error is returned if the X server does not support the window_type.
</para>

<para>
An Access error may be returned if the X server only supports the window_type on the local host and the program making the request is on a non-local host.
</para>

<para>
A Window error may be returned for system-specific errors related to system_window, e.g. system_window does not represent a valid native window.
</para>

</sect2>

515
<sect2 id='AppGroupDestroyAssociation'>
516 517 518 519 520 521 522 523 524
<title>AppGroupDestroyAssociation</title>

<para>
A Window error is returned if window was not specified in a previous AppGroupCreateAssociation request.
</para>

</sect2>
</sect1>

525
<sect1 id='Encoding'>
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
<title>Encoding</title>

<para>
Please refer to the X11 Protocol encoding document as this document uses conventions established there.
</para>


<para>
The name of this extension is XC-APPGROUP
</para>


<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupQueryVersion</emphasis>
      1      CARD8        opcode
      1      0            XC-APPGROUP opcode
      2      3            length
      2      CARD16       client_major_version
      2      CARD16       client_minor_version
=&gt;
      1      1            Reply
      1                   unused
      2      CARD16       sequence_number
      4      0            length
      2      CARD16       server_major_version
      2      CARD16       server_minor_version
      20                  unused
</literallayout>


<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupCreate</emphasis>
      1      CARD8            opcode
      1      1                XC-APPGROUP opcode
      2      8+n              length
      4      XID              app_group
      4      BITMASK          attrib_mask
             #x00000001   app_group_leader
             #x00000002   single_screen
             #0x0000004   default_root
             #x00000008   root_visual
             #x00000010   default_colormap
             #x00000020   black_pixel
             #x00000040   white_pixel
      n      LISTofVALUE      value-list
VALUEs
      4      BOOL             app_group_leader
      4      BOOL             single_screen
      4      WINDOW           default_root
      4      VISUALID         root_visual
      4      COLORMAP         default_colormap
      4      CARD32           black_pixel
      4      CARD32           white_pixel
</literallayout>


<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupDestroy</emphasis>
      1      CARD8            opcode
      1      2                XC-APPGROUP opcode
      2      2                length
      4      XID              app_group
</literallayout>

<literallayout class='monospaced'>
<emphasis role='bold'>AAppGroupGetAttr</emphasis>
      1      CARD8            opcode
      1      4                XC-APPGROUP opcode
      2      2                length
      4      XID              app_group
=&gt;
      1      1                Reply
      1                       unused
      2      CARD16           sequence_number
      4      0                length
      4      WINDOW           default_root
      4      VISUALID         root_visual
      4      COLORMAP         default_colormap
      4      CARD32           black_pixel
      4      CARD32           whte_pixel
      1      BOOL             single_screen
      1      BOOL             app_group_leader
      2                       unused
</literallayout>


<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupQuery</emphasis>
      1      CARD8            opcode
      1      5                XC-APPGROUP opcode
      2      2                length
      4      XID              resource
=&gt;
      1      1                Reply
      1                       unused
      2      CARD16           sequence_number
      4      0                length
      4      XID              app_group
      20                      unused
</literallayout>

<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupCreateAssoc</emphasis>
      1      CARD8            opcode
      1      6                XC-APPGROUP opcode
      2      n                length
      4      WINDOW           window
      2      CARD16           window_type
             #0      X11
             #1      Macintosh
             #2      Win32, OS/2 PM 2.x
             #3      Win16, OS/2 PM 1.x
      2      n                system_window_len
      n      LISTofCARD8      system_window
</literallayout>


<literallayout class='monospaced'>
<emphasis role='bold'>AppGroupDestroyAssoc</emphasis>
      1      CARD8            opcode
      1      7                XC-APPGROUP opcode
      2      2                length
      4      WINDOW           window
</literallayout>

</sect1>

653
<sect1 id='Library_API'>
654 655 656
<title>Library API</title>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
657 658 659
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
660
<tbody>
Matt Dew's avatar
Matt Dew committed
661
  <row>
662 663 664 665
    <entry role='functiondecl'>
Status <emphasis>XagQueryVersion</emphasis> (<emphasis> xkb, keycode</emphasis>)                              /* macro */
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
666
  <row>
667 668 669 670
    <entry role='functionargdecl'>
Display            <emphasis>dpy</emphasis>;
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
671
  <row>
672 673 674 675
    <entry role='functionargdecl'>
int *            <emphasis>major_version_return</emphasis>;
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
676
  <row>
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
    <entry role='functionargdecl'>
int *            <emphasis>minor_version_return</emphasis>;
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
XagQueryVersion sets major_version_return and minor_version_return to the major and minor Application Group protocol version supported by the server. If the Xag library is compatible with the version returned by the server it returns non-zero. If dpy does not support the Application Group extension, or if the server and library protocol versions are incompatible, or if there was an error during communication with the server, it returns zero. No other Xag functions may be called before this function. If a program violates this rule, the effects of all subsequent Xag calls that it makes are undefined.
</para>

<note><para>
An embedding manager in, e.g. a Personal Computer Web Browser, will need to open a connection to the Personal Computer X server by calling XOpenDisplay() before using the Application Group extension.
</para></note>

<para>
An embedding manager such as a web browser that intends to embed programs in an Application Group should create the Application Group with XagCreateEmbeddedApplicationGroup.
</para>


<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
699 700 701
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
702
<tbody>
Matt Dew's avatar
Matt Dew committed
703
  <row>
704 705 706 707
    <entry role='functiondecl'>
Status XagCreateEmbeddedApplicationGroup(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
708
  <row>
709 710 711 712
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
713
  <row>
714 715 716 717
    <entry role='functionargdecl'>
      VisualID      root_visual,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
718
  <row>
719 720 721 722
    <entry role='functionargdecl'>
      Colormap      default_colormap,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
723
  <row>
724 725 726 727
    <entry role='functionargdecl'>
      unsigned long      black_pixel,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
728
  <row>
729 730 731 732
    <entry role='functionargdecl'>
      unsigned long      white_pixel,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
733
  <row>
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
    <entry role='functionargdecl'>
      XAppGroup*      app_group_return);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>


<para>
XagCreateEmbeddedApplicationGroup creates an Application Group for an embedding manager with the attributes specified. It also sets the default_root attribute to DefaultRoot(dpy, DefaultsScreen(dpy)) and the single_screen and app_group_leader attributes to True. It returns the Application Group ID in app_group_return.
</para>

<para>
You can create an Application Group without intending to do embedding. One reason for doing this is to give a group of clients their own font-path.
</para>

<note><para>
A special font-path can be created by creating an Application Group, getting an Authorization using XSecurityGenerateAuthorization, and then running ‘xset fp+ &lt;new font path&gt;’ as a member of the Application Group. Font-path elements added in this way will be "private" to the Application Group.
</para></note>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
756 757 758
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
759
<tbody>
Matt Dew's avatar
Matt Dew committed
760
  <row>
761 762 763 764
    <entry role='functiondecl'>
Status XagCreateNonembeddedApplicationGroup(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
765
  <row>
766 767 768 769
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
770
  <row>
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
    <entry role='functionargdecl'>
      XAppGroup*      app_group_return);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
An Application Group created with XagCreateNonembeddedApplicationGroup will have the default_root, root_visual, and default_colormap attributes all set to None; the single_screen and app_group_leader attributes are set to False, and the black_pixel and white_pixel attributes are not used since the default_colormap attribute is None.
</para>

<para>
To destroy an Application Group use XagDestroyApplicationGroup.
</para>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
788 789 790
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
791
<tbody>
Matt Dew's avatar
Matt Dew committed
792
  <row>
793 794 795 796
    <entry role='functiondecl'>
Status XagDestroyApplicationGroup(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
797
  <row>
798 799 800 801
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
802
  <row>
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821
    <entry role='functionargdecl'>
      XAppGroup      app_group);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
The Application Group specified by app_group is destroyed. If the Application Group was created using XagCreateEmbeddingApplicationGroup, i.e. and therefore the app_group_leader attribute is True, all programs that are members of the Application Group are killed as if a KillClient request had been issued.
</para>


<para>
To retrieve the attributes of an Application Group use XagGetApplicationGroupAttributes.
</para>


<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
822 823 824
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
825
<tbody>
Matt Dew's avatar
Matt Dew committed
826
  <row>
827 828 829 830
    <entry role='functiondecl'>
Status XagGetApplicationGroupAttributes(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
831
  <row>
832 833 834 835
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
836
  <row>
837 838 839 840
    <entry role='functionargdecl'>
      XAppGroup      app_group,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
841
  <row>
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900
    <entry role='functionargdecl'>
      ...);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>



<para>
XagGetApplicationGroupAttributes is a varargs function that retrieves the Application Group’s attributes specified in the vararg parameter list.
</para>

<para>
The attributes that may be specified are: XagNappGroupLeader, XagNsingleScreen, XagNdefaultRoot, XagNrootVisual, XagNdefaultColormap, XagNblackPixel, and XagNwhitePixel; which correspond to app_group_leader, single_screen, default_root, root_visual, default_colormap, black_pixel, and white_pixel respectively. See AppGroupCreate in Section 3 for a description of each attribute.
</para>

<para>
The types for each of the parameters are pointers to the following:
</para>

<literallayout>
      single_screen          Bool
      default_root           Window
      root_visual            VisualID
      default_colormap       Colormap
      black_pixel            unsigned long
      white_pixel            unsigned long
      app_group_leader       Bool
</literallayout>

<para><programlisting>
Example:
      ...
      Boolean app_group_leader, single_screen;
      Window default_root;
      VisualID root_visual;
      Colormap default_colormap;
      Pixel black_pixel, white_pixel;
      ...
      status = XagGetApplicationGroupAttributes(dpy, app_group,
            XagNappGroupLeader, &amp;app_group_leader,
            XagNsingleScreen, &amp;single_screen,
            XagNdefault_root, &amp;default_root,
            XagNrootVisual, &amp;root_visual,
            XagNdefaultColormap, &amp;default_colormap,
            XagNblackPixel, &amp;black_pixel,
            XagNwhitePixel, &amp;white_pixel,
            NULL);
      ...
</programlisting></para>


<para>
To determine which Application Group a resource (such as a window) belongs to, use XagQueryApplicationGroup.
</para>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
901 902 903
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
904
<tbody>
Matt Dew's avatar
Matt Dew committed
905
  <row>
906 907 908 909
    <entry role='functiondecl'>
Status XagQueryApplicationGroup(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
910
  <row>
911 912 913 914
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
915
  <row>
916 917 918 919
    <entry role='functionargdecl'>
      XID      resource,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
920
  <row>
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938
    <entry role='functionargdecl'>
      XAppGroup*      app_group_return);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>


<para>
The Application Group is returned in app_group_return, if the resource is not in any Application Group then app_group_return will be set to None.
</para>

<para>
To associate an X Window ID with a system-specific window ID, such as a HWND or a WindowPtr, use XagCreateAssociation.
</para>

<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
939 940 941
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
942
<tbody>
Matt Dew's avatar
Matt Dew committed
943
  <row>
944 945 946 947
    <entry role='functiondecl'>
Status XagCreateAssociation(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
948
  <row>
949 950 951 952
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
953
  <row>
954 955 956 957
    <entry role='functionargdecl'>
      Window*      window_return,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
958
  <row>
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
    <entry role='functionargdecl'>
      void*      system_window);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>


<para>
The window_ret may be used as the target for a ReparentWindow request.
</para>

<note><para>
Because XReparentWindow is not constrained in the same way that Win32’s  SetParent and the Macintosh are, there is no reason to call XagCreateAssociation in an X-based embedding manager. As such if XagCreateAssociation is called in a native X program, the window_return will be the same as the system_window, and the implementation may even elect to not generate any protocol.
</para></note>

<para>To create an association on the Macintosh:</para>

<para><programlisting>
      struct {
          WindowPtr win;
          Rect rect;
      } system_window;
      system_window.win = win_ptr;
      system_window.rect.top = system_window.rect.left = 20;
      system_window.rect.bottom = 180;
      system_window.rect.right = 380;
</programlisting></para>

<para><programlisting>
      status = XagCreateAssociation (dpy, &amp;window, (void*)&amp;system_window);
</programlisting></para>

<para>
To create an association using a Win16, Win32, or OS/2 PM:
</para>

<para><programlisting>
      HWND system_window;
      status = XagCreateAssociation (dpy, &amp;window, (void*)&amp;system_window);
</programlisting></para>

<para>
To destroy the association created with XagCreateAssociation use XagDestroyAssociation.
</para>


<informaltable frame='none'>
Matt Dew's avatar
Matt Dew committed
1008 1009 1010
<?dbfo keep-together="always" ?>
<tgroup cols='1' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
1011
<tbody>
Matt Dew's avatar
Matt Dew committed
1012
  <row>
1013 1014 1015 1016
    <entry role='functiondecl'>
Status XagDestroyAssociation(
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
1017
  <row>
1018 1019 1020 1021
    <entry role='functionargdecl'>
      Display*      dpy,
    </entry>
  </row>
Matt Dew's avatar
Matt Dew committed
1022
  <row>
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
    <entry role='functionargdecl'>
      Window      window);
    </entry>
  </row>
</tbody>
</tgroup>
</informaltable>

<para>
After calling XagDestroyAssociation the window may no longer be used to
reparent windows with XReparentWindow.
</para>

<note><para>
Like XagCreateAssociation, if the native window system is X11 the implementation may elect  to not generate any protocol as a result of this function call in order to avoid unintentionally destroying the the system_window that was specified in the prior XagCreateAssociation call.
</para></note>
</sect1>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"  href="appendix.xml"/>
</article>