appgrp.xml revision d63b911f
1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE article 3 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 4 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 5[ 6<!ENTITY % defs SYSTEM "defs.ent"> %defs; 7]> 8 9<article id="appgrp"> 10 11<articleinfo> 12 <title>Application Group Extension to the X Protocol</title> 13 <subtitle>X Consortium Standard</subtitle> 14 <authorgroup> 15 <author> 16 <firstname>Kaleb</firstname> 17 <othername>S.</othername> 18 <surname>KEITHLEY</surname> 19 <affiliation><orgname>X Consortium, Inc</orgname></affiliation> 20 <email>kaleb@x.org</email> 21 </author> 22 </authorgroup> 23 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 24 <releaseinfo>Version 1.0</releaseinfo> 25 <copyright><year>1996</year><holder>X Consortium, Inc.</holder> 26 </copyright> 27 28<legalnotice> 29<para> 30All Rights Reserved. 31</para> 32 33<para> 34THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 35EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 36MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 37IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, 38DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 39OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 40OR THE USE OF OR OTHER DEALINGS IN THE SOFTWARE. 41</para> 42<para> 43Except as contained in this notice, the name of the X Consortium shall not be used in advertising 44or otherwise to promote the sale, use or other dealings in this Software without prior written 45authorization from the X Consortium. 46</para> 47<para>X Window System is a trademark of The OpenGroup.</para> 48</legalnotice> 49 50<pubdate>27 September 1996</pubdate> 51 52<abstract> 53<para> 54The Application Group Extension to the X protocol is intended to provide a framework to allow 55more than one program to manage X applications on the desktop. The initial use of this extension 56will be to insert or embed the windows of X programs into the windows of another program, such 57as a web browser. This extension is not intended to address larger embedding issues that, for 58example, OpenDoc does, such as shared menu bars, etc. 59</para> 60</abstract> 61</articleinfo> 62 63<sect1 id='Purpose_and_Goals'> 64<title>Purpose and Goals</title> 65 66<para> 67The Application Group Extension to the X protocol is intended to provide 68a framework to allow more than one program to manage X applications on 69the desktop. The initial use of this extension will be to insert or embed 70the windows of X programs into the windows of another program, such as a 71web browser. This extension is not intended to address larger embedding 72issues that, for example, OpenDoc does, such as shared menu bars, etc. 73Using X programs on the World Wide Web allows for greater control of the 74presentation and takes advantage of the existing body of X programs rather 75than re-implement them in another language. In addition it allows the 76embedding of non-X programs into web browsers by using third party products 77like Wabi, MAE, and WinCenter. 78<footnote><para> 79Wabi is a trademark of Sun Microsystems, Inc. MAE is a trademark of Apple 80Computer, Inc. WinCenter is a trademark of Network Computing Devices, Inc. 81</para></footnote> 82</para> 83 84</sect1> 85 86<sect1 id='Overview_of_the_protocol'> 87<title>Overview of the protocol.</title> 88 89<para> 90This 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. 91</para> 92 93<para> 94To 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. 95</para> 96 97<para> 98As 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. 99</para> 100 101</sect1> 102<sect1 id='Requests'> 103<title>Requests</title> 104 105 106<para><emphasis role='bold'>AppGroupQueryVersion</emphasis></para> 107 108<informaltable frame='none'> 109<?dbfo keep-together="always" ?> 110<tgroup cols='1' colsep='0' rowsep='0'> 111<colspec colsep='0' colwidth='1.0*'/> 112<tbody> 113 <row> 114 <entry>client_major_version: CARD16</entry> 115 </row> 116 <row> 117 <entry>client_minor_version: CARD16</entry> 118 </row> 119 <row> 120 <entry>=></entry> 121 </row> 122 <row> 123 <entry>server_major_version: CARD16</entry> 124 </row> 125 <row> 126 <entry>server_minor_version: CARD16</entry> 127 </row> 128</tbody> 129</tgroup> 130</informaltable> 131 132<para> 133If 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. 134</para> 135 136 137<para><emphasis role='bold'>AppGroupCreate</emphasis></para> 138 139<informaltable frame='none'> 140<?dbfo keep-together="always" ?> 141<tgroup cols='1' colsep='0' rowsep='0'> 142<colspec colsep='0' colwidth='1.0*'/> 143<tbody> 144 <row> 145 <entry>app_group: APPGROUP</entry> 146 </row> 147 <row> 148 <entry>value_mask: BITMASK</entry> 149 </row> 150 <row> 151 <entry>value_list: LISTofVALUE</entry> 152 </row> 153</tbody> 154</tgroup> 155</informaltable> 156 157<para> 158This request creates an Application Group using app_group as the Application Group ID. 159</para> 160 161 162<para> 163 164</para> 165 166 167<para> 168The 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: 169</para> 170 171<informaltable frame="topbot"> 172<?dbfo keep-together="always" ?> 173<tgroup cols='3' colsep='0' rowsep='0'> 174<colspec colname='c1' colwidth='1.0*'/> 175<colspec colname='c2' colwidth='1.0*'/> 176<colspec colname='c3' colwidth='1.0*'/> 177<tbody> 178 <row rowsep='1'> 179 <entry>Attribute</entry> 180 <entry>Type</entry> 181 <entry>Default</entry> 182 </row> 183 <row> 184 <entry>app_group_leader</entry> 185 <entry>Bool</entry> 186 <entry>True</entry> 187 </row> 188 <row> 189 <entry>single_screen</entry> 190 <entry>Bool</entry> 191 <entry>True</entry> 192 </row> 193 <row> 194 <entry>default_root</entry> 195 <entry>Window</entry> 196 <entry>None</entry> 197 </row> 198 <row> 199 <entry>root_visual</entry> 200 <entry>VisualID</entry> 201 <entry>None</entry> 202 </row> 203 <row> 204 <entry>default_colormap</entry> 205 <entry>Colormap</entry> 206 <entry>None</entry> 207 </row> 208 <row> 209 <entry>black_pixel</entry> 210 <entry>Pixel</entry> 211 <entry>0</entry> 212 </row> 213 <row> 214 <entry>white_pixel</entry> 215 <entry>Pixel</entry> 216 <entry>0</entry> 217 </row> 218</tbody> 219</tgroup> 220</informaltable> 221 222<para> 223If 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. 224</para> 225 226<note><para> 227The 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. 228</para></note> 229 230<para> 231If 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. 232</para> 233 234 235<para> 236If 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 specified 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. 237</para> 238 239<para> 240IF 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. 241</para> 242 243<para> 244The 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. 245</para> 246 247<para><emphasis role='bold'>AppGroupDestroy</emphasis></para> 248 249<para>app_group: APPGROUP</para> 250 251 252<para> 253This 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. 254</para> 255 256<note><para> 257If 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. 258</para></note> 259 260<para><emphasis role='bold'>AppGroupGetAttr</emphasis></para> 261 262 263<informaltable frame='none'> 264<?dbfo keep-together="always" ?> 265<tgroup cols='1' colsep='0' rowsep='0'> 266<colspec colname='c1' colwidth='1.0*'/> 267<tbody> 268 <row> 269 <entry>>app_group: APPGROUP</entry> 270 </row> 271 <row> 272 <entry>=></entry> 273 </row> 274 <row> 275 <entry>LISTofVALUE</entry> 276 </row> 277</tbody> 278</tgroup> 279</informaltable> 280 281<para> 282This request returns the application group attributes for app_group. 283</para> 284 285<para><emphasis role='bold'>AppGroupQuery</emphasis></para> 286 287<informaltable frame='none'> 288<?dbfo keep-together="always" ?> 289<tgroup cols='1' colsep='0' rowsep='0'> 290<colspec colname='c1' colwidth='1.0*'/> 291<tbody> 292 <row> 293 <entry>resource: XID</entry> 294 </row> 295 <row> 296 <entry>=></entry> 297 </row> 298 <row> 299 <entry>app_group: APPGROUP</entry> 300 </row> 301</tbody> 302</tgroup> 303</informaltable> 304 305<para> 306This 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. 307</para> 308 309<para><emphasis role='bold'>AppGroupCreateAssociation</emphasis></para> 310 311<informaltable frame='none'> 312<?dbfo keep-together="always" ?> 313<tgroup cols='1' colsep='0' rowsep='0'> 314<colspec colname='c1' colwidth='1.0*'/> 315<tbody> 316 <row> 317 <entry>window: WINDOW</entry> 318 </row> 319 <row> 320 <entry>window_type: CARD32</entry> 321 </row> 322 <row> 323 <entry>system_window: LISTofCARD8</entry> 324 </row> 325</tbody> 326</tgroup> 327</informaltable> 328 329<para> 330This 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. 331</para> 332 333<para><emphasis role='bold'>AppGroupDestroyAssociation</emphasis></para> 334 335<informaltable frame='none'> 336<?dbfo keep-together="always" ?> 337<tgroup cols='1' colsep='0' rowsep='0'> 338<colspec colname='c1' colwidth='1.0*'/> 339<tbody> 340 <row> 341 <entry>window: WINDOW</entry> 342 </row> 343</tbody> 344</tgroup> 345</informaltable> 346 347<para> 348This request destroys the association created with AppGroupCreateAssociation. The window is destroyed. The system_window that was specified in the AppGroupCreateAssociation request is not affected. 349</para> 350 351</sect1> 352 353<sect1 id='Changes_to_Existing_Requests'> 354<title>Changes to Existing Requests</title> 355 356<sect2 id='MapWindow'> 357<title>MapWindow</title> 358 359<para> 360If 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. 361</para> 362 363</sect2> 364<sect2 id='ConfigureWindow'> 365<title>ConfigureWindow</title> 366 367<para> 368If 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. 369</para> 370 371</sect2> 372<sect2 id='CreateWindow'> 373<title>CreateWindow</title> 374 375<para> 376When 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. 377</para> 378 379<para> 380When 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. 381</para> 382 383</sect2> 384 385<sect2 id='ChangeWindowAttributes'> 386<title>ChangeWindowAttributes</title> 387 388<para> 389When 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. 390</para> 391 392</sect2> 393 394</sect1> 395 396<sect1 id='Changes_to_Existing_Events'> 397<title>Changes to Existing Events</title> 398 399<para> 400When 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. 401</para> 402 403<note><para> 404The 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. 405</para></note> 406 407 408<sect2 id='MapRequest'> 409<title>MapRequest</title> 410 411<para> 412When a MapWindow request is received for a window whose override-redirect attribute 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. 413</para> 414 415</sect2> 416<sect2 id='ConfigureRequest'> 417<title>ConfigureRequest</title> 418 419<para> 420When a ConfigureWindow request is received for a window whose override-redirect attribute 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. 421</para> 422 423</sect2> 424</sect1> 425 426<sect1 id='Errors'> 427<title>Errors</title> 428 429<sect2 id='AppGroupQueryVersion'> 430<title>AppGroupQueryVersion</title> 431 432<para> 433There are no errors for AppGroupQueryVersion. 434</para> 435 436</sect2> 437 438<sect2 id='AppGroupCreate'> 439<title>AppGroupCreate</title> 440 441<para> 442A Window error is returned if default_root is specified and is not a valid root window.. 443</para> 444 445<para> 446A Color error is returned default_colormap is specified but default_colormap is not a valid colormap for the screen of default_root. 447</para> 448 449<para> 450A Match error is returned if root_visual and default_colormap are both specified, but 451</para> 452 453<para> 454default_colormap’s visual is not root_visual. 455</para> 456 457<para> 458A Match error is returned if root_visual does not exist for the screen of the default_root. 459</para> 460 461</sect2> 462 463<sect2 id='AppGroupDestroy'> 464<title>AppGroupDestroy</title> 465 466<para> 467An AppGroup error is returned if app_group is not a valid Application Group. 468</para> 469 470<para> 471An Access error is returned if an untrusted application attempts to destroy an Application Group created by a trusted application. 472</para> 473 474</sect2> 475 476<sect2 id='AppGroupGetAttr'> 477<title>AppGroupGetAttr</title> 478 479<para> 480An AppGroup error is returned if app_group is not a valid Application Group. 481</para> 482 483<para> 484An Access error is returned if an untrusted application attempts to get the attributes of an Application Group created by a trusted application. 485</para> 486 487</sect2> 488 489<sect2 id='AppGroupQuery'> 490<title>AppGroupQuery</title> 491 492<para> 493An Access error is returned if an untrusted application attempts to query the Application Group of a trusted application. 494</para> 495 496</sect2> 497 498<sect2 id='AppGroupCreateAssociation'> 499<title>AppGroupCreateAssociation</title> 500 501<para> 502A Match error is returned if the X server does not support the window_type. 503</para> 504 505<para> 506An 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. 507</para> 508 509<para> 510A Window error may be returned for system-specific errors related to system_window, e.g. system_window does not represent a valid native window. 511</para> 512 513</sect2> 514 515<sect2 id='AppGroupDestroyAssociation'> 516<title>AppGroupDestroyAssociation</title> 517 518<para> 519A Window error is returned if window was not specified in a previous AppGroupCreateAssociation request. 520</para> 521 522</sect2> 523</sect1> 524 525<sect1 id='Encoding'> 526<title>Encoding</title> 527 528<para> 529Please refer to the X11 Protocol encoding document as this document uses conventions established there. 530</para> 531 532 533<para> 534The name of this extension is XC-APPGROUP 535</para> 536 537 538<literallayout class='monospaced'> 539<emphasis role='bold'>AppGroupQueryVersion</emphasis> 540 1 CARD8 opcode 541 1 0 XC-APPGROUP opcode 542 2 3 length 543 2 CARD16 client_major_version 544 2 CARD16 client_minor_version 545=> 546 1 1 Reply 547 1 unused 548 2 CARD16 sequence_number 549 4 0 length 550 2 CARD16 server_major_version 551 2 CARD16 server_minor_version 552 20 unused 553</literallayout> 554 555 556<literallayout class='monospaced'> 557<emphasis role='bold'>AppGroupCreate</emphasis> 558 1 CARD8 opcode 559 1 1 XC-APPGROUP opcode 560 2 8+n length 561 4 XID app_group 562 4 BITMASK attrib_mask 563 #x00000001 app_group_leader 564 #x00000002 single_screen 565 #0x0000004 default_root 566 #x00000008 root_visual 567 #x00000010 default_colormap 568 #x00000020 black_pixel 569 #x00000040 white_pixel 570 n LISTofVALUE value-list 571VALUEs 572 4 BOOL app_group_leader 573 4 BOOL single_screen 574 4 WINDOW default_root 575 4 VISUALID root_visual 576 4 COLORMAP default_colormap 577 4 CARD32 black_pixel 578 4 CARD32 white_pixel 579</literallayout> 580 581 582<literallayout class='monospaced'> 583<emphasis role='bold'>AppGroupDestroy</emphasis> 584 1 CARD8 opcode 585 1 2 XC-APPGROUP opcode 586 2 2 length 587 4 XID app_group 588</literallayout> 589 590<literallayout class='monospaced'> 591<emphasis role='bold'>AAppGroupGetAttr</emphasis> 592 1 CARD8 opcode 593 1 4 XC-APPGROUP opcode 594 2 2 length 595 4 XID app_group 596=> 597 1 1 Reply 598 1 unused 599 2 CARD16 sequence_number 600 4 0 length 601 4 WINDOW default_root 602 4 VISUALID root_visual 603 4 COLORMAP default_colormap 604 4 CARD32 black_pixel 605 4 CARD32 whte_pixel 606 1 BOOL single_screen 607 1 BOOL app_group_leader 608 2 unused 609</literallayout> 610 611 612<literallayout class='monospaced'> 613<emphasis role='bold'>AppGroupQuery</emphasis> 614 1 CARD8 opcode 615 1 5 XC-APPGROUP opcode 616 2 2 length 617 4 XID resource 618=> 619 1 1 Reply 620 1 unused 621 2 CARD16 sequence_number 622 4 0 length 623 4 XID app_group 624 20 unused 625</literallayout> 626 627<literallayout class='monospaced'> 628<emphasis role='bold'>AppGroupCreateAssoc</emphasis> 629 1 CARD8 opcode 630 1 6 XC-APPGROUP opcode 631 2 n length 632 4 WINDOW window 633 2 CARD16 window_type 634 #0 X11 635 #1 Macintosh 636 #2 Win32, OS/2 PM 2.x 637 #3 Win16, OS/2 PM 1.x 638 2 n system_window_len 639 n LISTofCARD8 system_window 640</literallayout> 641 642 643<literallayout class='monospaced'> 644<emphasis role='bold'>AppGroupDestroyAssoc</emphasis> 645 1 CARD8 opcode 646 1 7 XC-APPGROUP opcode 647 2 2 length 648 4 WINDOW window 649</literallayout> 650 651</sect1> 652 653<sect1 id='Library_API'> 654<title>Library API</title> 655 656<informaltable frame='none'> 657<?dbfo keep-together="always" ?> 658<tgroup cols='1' colsep='0' rowsep='0'> 659<colspec colname='c1' colwidth='1.0*'/> 660<tbody> 661 <row> 662 <entry role='functiondecl'> 663Status <emphasis>XagQueryVersion</emphasis> (<emphasis> xkb, keycode</emphasis>) /* macro */ 664 </entry> 665 </row> 666 <row> 667 <entry role='functionargdecl'> 668Display <emphasis>dpy</emphasis>; 669 </entry> 670 </row> 671 <row> 672 <entry role='functionargdecl'> 673int * <emphasis>major_version_return</emphasis>; 674 </entry> 675 </row> 676 <row> 677 <entry role='functionargdecl'> 678int * <emphasis>minor_version_return</emphasis>; 679 </entry> 680 </row> 681</tbody> 682</tgroup> 683</informaltable> 684 685<para> 686XagQueryVersion 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. 687</para> 688 689<note><para> 690An 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. 691</para></note> 692 693<para> 694An embedding manager such as a web browser that intends to embed programs in an Application Group should create the Application Group with XagCreateEmbeddedApplicationGroup. 695</para> 696 697 698<informaltable frame='none'> 699<?dbfo keep-together="always" ?> 700<tgroup cols='1' colsep='0' rowsep='0'> 701<colspec colname='c1' colwidth='1.0*'/> 702<tbody> 703 <row> 704 <entry role='functiondecl'> 705Status XagCreateEmbeddedApplicationGroup( 706 </entry> 707 </row> 708 <row> 709 <entry role='functionargdecl'> 710 Display* dpy, 711 </entry> 712 </row> 713 <row> 714 <entry role='functionargdecl'> 715 VisualID root_visual, 716 </entry> 717 </row> 718 <row> 719 <entry role='functionargdecl'> 720 Colormap default_colormap, 721 </entry> 722 </row> 723 <row> 724 <entry role='functionargdecl'> 725 unsigned long black_pixel, 726 </entry> 727 </row> 728 <row> 729 <entry role='functionargdecl'> 730 unsigned long white_pixel, 731 </entry> 732 </row> 733 <row> 734 <entry role='functionargdecl'> 735 XAppGroup* app_group_return); 736 </entry> 737 </row> 738</tbody> 739</tgroup> 740</informaltable> 741 742 743<para> 744XagCreateEmbeddedApplicationGroup 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. 745</para> 746 747<para> 748You 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. 749</para> 750 751<note><para> 752A special font-path can be created by creating an Application Group, getting an Authorization using XSecurityGenerateAuthorization, and then running ‘xset fp+ <new font path>’ as a member of the Application Group. Font-path elements added in this way will be "private" to the Application Group. 753</para></note> 754 755<informaltable frame='none'> 756<?dbfo keep-together="always" ?> 757<tgroup cols='1' colsep='0' rowsep='0'> 758<colspec colname='c1' colwidth='1.0*'/> 759<tbody> 760 <row> 761 <entry role='functiondecl'> 762Status XagCreateNonembeddedApplicationGroup( 763 </entry> 764 </row> 765 <row> 766 <entry role='functionargdecl'> 767 Display* dpy, 768 </entry> 769 </row> 770 <row> 771 <entry role='functionargdecl'> 772 XAppGroup* app_group_return); 773 </entry> 774 </row> 775</tbody> 776</tgroup> 777</informaltable> 778 779<para> 780An 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. 781</para> 782 783<para> 784To destroy an Application Group use XagDestroyApplicationGroup. 785</para> 786 787<informaltable frame='none'> 788<?dbfo keep-together="always" ?> 789<tgroup cols='1' colsep='0' rowsep='0'> 790<colspec colname='c1' colwidth='1.0*'/> 791<tbody> 792 <row> 793 <entry role='functiondecl'> 794Status XagDestroyApplicationGroup( 795 </entry> 796 </row> 797 <row> 798 <entry role='functionargdecl'> 799 Display* dpy, 800 </entry> 801 </row> 802 <row> 803 <entry role='functionargdecl'> 804 XAppGroup app_group); 805 </entry> 806 </row> 807</tbody> 808</tgroup> 809</informaltable> 810 811<para> 812The 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. 813</para> 814 815 816<para> 817To retrieve the attributes of an Application Group use XagGetApplicationGroupAttributes. 818</para> 819 820 821<informaltable frame='none'> 822<?dbfo keep-together="always" ?> 823<tgroup cols='1' colsep='0' rowsep='0'> 824<colspec colname='c1' colwidth='1.0*'/> 825<tbody> 826 <row> 827 <entry role='functiondecl'> 828Status XagGetApplicationGroupAttributes( 829 </entry> 830 </row> 831 <row> 832 <entry role='functionargdecl'> 833 Display* dpy, 834 </entry> 835 </row> 836 <row> 837 <entry role='functionargdecl'> 838 XAppGroup app_group, 839 </entry> 840 </row> 841 <row> 842 <entry role='functionargdecl'> 843 ...); 844 </entry> 845 </row> 846</tbody> 847</tgroup> 848</informaltable> 849 850 851 852<para> 853XagGetApplicationGroupAttributes is a varargs function that retrieves the Application Group’s attributes specified in the vararg parameter list. 854</para> 855 856<para> 857The 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. 858</para> 859 860<para> 861The types for each of the parameters are pointers to the following: 862</para> 863 864<literallayout> 865 single_screen Bool 866 default_root Window 867 root_visual VisualID 868 default_colormap Colormap 869 black_pixel unsigned long 870 white_pixel unsigned long 871 app_group_leader Bool 872</literallayout> 873 874<para><programlisting> 875Example: 876 ... 877 Boolean app_group_leader, single_screen; 878 Window default_root; 879 VisualID root_visual; 880 Colormap default_colormap; 881 Pixel black_pixel, white_pixel; 882 ... 883 status = XagGetApplicationGroupAttributes(dpy, app_group, 884 XagNappGroupLeader, &app_group_leader, 885 XagNsingleScreen, &single_screen, 886 XagNdefault_root, &default_root, 887 XagNrootVisual, &root_visual, 888 XagNdefaultColormap, &default_colormap, 889 XagNblackPixel, &black_pixel, 890 XagNwhitePixel, &white_pixel, 891 NULL); 892 ... 893</programlisting></para> 894 895 896<para> 897To determine which Application Group a resource (such as a window) belongs to, use XagQueryApplicationGroup. 898</para> 899 900<informaltable frame='none'> 901<?dbfo keep-together="always" ?> 902<tgroup cols='1' colsep='0' rowsep='0'> 903<colspec colname='c1' colwidth='1.0*'/> 904<tbody> 905 <row> 906 <entry role='functiondecl'> 907Status XagQueryApplicationGroup( 908 </entry> 909 </row> 910 <row> 911 <entry role='functionargdecl'> 912 Display* dpy, 913 </entry> 914 </row> 915 <row> 916 <entry role='functionargdecl'> 917 XID resource, 918 </entry> 919 </row> 920 <row> 921 <entry role='functionargdecl'> 922 XAppGroup* app_group_return); 923 </entry> 924 </row> 925</tbody> 926</tgroup> 927</informaltable> 928 929 930<para> 931The 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. 932</para> 933 934<para> 935To associate an X Window ID with a system-specific window ID, such as a HWND or a WindowPtr, use XagCreateAssociation. 936</para> 937 938<informaltable frame='none'> 939<?dbfo keep-together="always" ?> 940<tgroup cols='1' colsep='0' rowsep='0'> 941<colspec colname='c1' colwidth='1.0*'/> 942<tbody> 943 <row> 944 <entry role='functiondecl'> 945Status XagCreateAssociation( 946 </entry> 947 </row> 948 <row> 949 <entry role='functionargdecl'> 950 Display* dpy, 951 </entry> 952 </row> 953 <row> 954 <entry role='functionargdecl'> 955 Window* window_return, 956 </entry> 957 </row> 958 <row> 959 <entry role='functionargdecl'> 960 void* system_window); 961 </entry> 962 </row> 963</tbody> 964</tgroup> 965</informaltable> 966 967 968<para> 969The window_ret may be used as the target for a ReparentWindow request. 970</para> 971 972<note><para> 973Because 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. 974</para></note> 975 976<para>To create an association on the Macintosh:</para> 977 978<para><programlisting> 979 struct { 980 WindowPtr win; 981 Rect rect; 982 } system_window; 983 system_window.win = win_ptr; 984 system_window.rect.top = system_window.rect.left = 20; 985 system_window.rect.bottom = 180; 986 system_window.rect.right = 380; 987</programlisting></para> 988 989<para><programlisting> 990 status = XagCreateAssociation (dpy, &window, (void*)&system_window); 991</programlisting></para> 992 993<para> 994To create an association using a Win16, Win32, or OS/2 PM: 995</para> 996 997<para><programlisting> 998 HWND system_window; 999 status = XagCreateAssociation (dpy, &window, (void*)&system_window); 1000</programlisting></para> 1001 1002<para> 1003To destroy the association created with XagCreateAssociation use XagDestroyAssociation. 1004</para> 1005 1006 1007<informaltable frame='none'> 1008<?dbfo keep-together="always" ?> 1009<tgroup cols='1' colsep='0' rowsep='0'> 1010<colspec colname='c1' colwidth='1.0*'/> 1011<tbody> 1012 <row> 1013 <entry role='functiondecl'> 1014Status XagDestroyAssociation( 1015 </entry> 1016 </row> 1017 <row> 1018 <entry role='functionargdecl'> 1019 Display* dpy, 1020 </entry> 1021 </row> 1022 <row> 1023 <entry role='functionargdecl'> 1024 Window window); 1025 </entry> 1026 </row> 1027</tbody> 1028</tgroup> 1029</informaltable> 1030 1031<para> 1032After calling XagDestroyAssociation the window may no longer be used to 1033reparent windows with XReparentWindow. 1034</para> 1035 1036<note><para> 1037Like 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. 1038</para></note> 1039</sect1> 1040<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appendix.xml"/> 1041</article> 1042