CH13.xml revision 0568f49b
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
3
4<chapter id='Evolution_of_the_Intrinsics'>
5<title>Evolution of the Intrinsics</title>
6
7<para>
8The interfaces described by this specification have undergone several
9sets of revisions in the course of adoption as an X Consortium
10standard specification.  Having now been adopted by the Consortium as
11a standard part of the X Window System, it is expected that this and
12future revisions will retain
13backward compatibility in the sense that fully conforming
14implementations of these specifications may be produced that provide
15source compatibility with widgets and applications written to
16previous Consortium standard revisions.
17</para>
18
19<para>
20The Intrinsics do not place any special requirement on widget
21programmers to retain source or binary compatibility for their widgets
22as they evolve, but several conventions have been established to
23assist those developers who want to provide such compatibility.
24</para>
25
26<para>
27In particular, widget programmers may wish to conform to the convention
28described in <xref linkend='Class_Extension_Records' /> when defining class extension records.
29</para>
30<sect1 id="Determining_Specification_Revision_Level">
31<title>Determining Specification Revision Level</title>
32<para>
33Widget and application developers who wish to maintain a common source
34pool that will build properly with implementations of the Intrinsics
35at different revision levels of these specifications but that take
36advantage of newer features added in later revisions may use the
37symbolic macro
38<function>XtSpecificationRelease</function>.
39</para>
40<programlisting>
41#define XtSpecificationRelease 7
42</programlisting>
43<para>
44As the symbol
45<function>XtSpecificationRelease</function>
46was new to Release 4, widgets and
47applications desiring to build against earlier implementations should
48test for the presence of this symbol and assume only Release 3
49interfaces if the definition is not present.
50</para>
51</sect1>
52
53<sect1 id="Release_to_Release_Compatibility">
54<title>Release 3 to Release 4 Compatibility</title>
55<para>
56At the data structure level, Release 4 retains binary compatibility
57with Release 3 (the first X Consortium standard release) for all data
58structures except
59<function>WMShellPart,</function>
60<function>TopLevelShellPart</function>,
61and
62<function>TransientShellPart</function>.
63Release 4 changed the argument type to most procedures that now take
64arguments of type
65<function>XtPointer</function>
66and structure members that are now of type
67<function>XtPointer</function>
68in order to avoid potential ANSI C conformance problems.  It is
69expected that most implementations will be binary compatible with the
70previous definition.
71</para>
72
73<para>
74Two fields in
75<function>CoreClassPart</function>
76were changed from
77<function>Boolean</function>
78to
79<function>XtEnum</function>
80to allow implementations additional freedom in specifying the
81representations of each.  This change should require no source
82modification.
83</para>
84<sect2 id="Additional_Arguments">
85<title>Additional Arguments</title>
86<para>
87Arguments were added to the procedure definitions for
88<xref linkend='XtInitProc' xrefstyle='select: title'/>,
89<xref linkend='XtSetValuesFunc' xrefstyle='select: title'/>,
90and
91<xref linkend='XtEventHandler' xrefstyle='select: title'/>
92to provide more information and to
93allow event handlers to abort further dispatching of the current event
94(caution is advised!).  The added arguments to
95<xref linkend='XtInitProc' xrefstyle='select: title'/>
96and
97<xref linkend='XtSetValuesFunc' xrefstyle='select: title'/>
98make the initialize_hook and set_values_hook methods
99obsolete, but the hooks have been retained for those widgets that used
100them in Release 3.
101</para>
102</sect2>
103
104<sect2 id="set_values_almost_Procedures">
105<title>set_values_almost Procedures</title>
106<para>
107The use of the arguments by a set_values_almost procedure was poorly
108described in Release 3 and was inconsistent with other conventions.
109</para>
110
111<para>
112The current specification for the manner in which a set_values_almost
113procedure returns information to the Intrinsics is not compatible with
114the Release 3 specification, and all widget implementations should
115verify that any set_values_almost procedures conform to the current
116interface.
117</para>
118
119<para>
120No known implementation of the Intrinsics correctly implemented the
121Release 3 interface, so it is expected that the impact of this
122specification change is small.
123</para>
124</sect2>
125
126<sect2 id="Query_Geometry">
127<title>Query Geometry</title>
128<para>
129A composite widget layout routine that calls
130<xref linkend='XtQueryGeometry' xrefstyle='select: title'/>
131is now expected to store the complete new geometry in the intended structure;
132previously the specification said &ldquo;store the changes it intends to
133make&rdquo;.  Only by storing the complete geometry does the child have
134any way to know what other parts of the geometry may still be
135flexible.  Existing widgets should not be affected by this, except
136to take advantage of the new information.
137</para>
138</sect2>
139
140<sect2 id="unrealizeCallback_Callback_List">
141<title>unrealizeCallback Callback List</title>
142<para>
143In order to provide a mechanism for widgets to be notified when they
144become unrealized through a call to
145<xref linkend='XtUnrealizeWidget' xrefstyle='select: title'/>,
146the callback
147list name &ldquo;unrealizeCallback&rdquo; has been defined by the Intrinsics.  A
148widget class that requires notification on unrealize may declare a
149callback list resource by this name.  No class is required to declare
150this resource, but any class that did so in a prior revision may find
151it necessary to modify the resource name if it does not wish to use the new
152semantics.
153</para>
154</sect2>
155
156<sect2 id="Subclasses_of_WMShell">
157<title>Subclasses of WMShell</title>
158<para>
159The formal adoption of the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis> as
160an X Consortium standard has meant the addition of four fields to
161<function>WMShellPart</function>
162and one field to
163<function>TopLevelShellPart</function>.
164In deference to some
165widget libraries that had developed their own additional conventions
166to provide binary compatibility, these five new fields were added at
167the end of the respective data structures.
168</para>
169
170<para>
171To provide more convenience for TransientShells, a field was added
172to the previously empty
173<function>TransientShellPart</function>.
174On some architectures the size of the part structure will not
175have changed as a result of this.
176</para>
177
178<para>
179Any widget implementation whose class is a subclass of
180TopLevelShell
181or
182TransientShell
183must at minimum be
184recompiled with the new data structure declarations.  Because
185<function>WMShellPart</function>
186no longer contains a contiguous
187<function>XSizeHints</function>
188data structure,
189a subclass that expected to do a single structure assignment of an
190<function>XSizeHints</function>
191structure to the <emphasis remap='I'>size_hints</emphasis> field of
192<function>WMShellPart</function>
193must be revised, though the old fields remain at the same positions within
194<function>WMShellPart</function>.
195</para>
196</sect2>
197
198<sect2 id="Resource_Type_Converters">
199<title>Resource Type Converters</title>
200<para>
201A new interface declaration for resource type converters was defined
202to provide more information to converters, to support conversion
203cache cleanup with resource reference counting, and to allow
204additional procedures to be declared to free resources.  The old
205interfaces remain (in the compatibility section), and a new set of
206procedures was defined that work only with the new type converter
207interface.
208</para>
209
210<para>
211In the now obsolete old type converter interface, converters are
212reminded that they must return the size of the converted value as well
213as its address.  The example indicated this, but the description of
214<xref linkend='XtConverter' xrefstyle='select: title'/>
215was incomplete.
216</para>
217</sect2>
218
219<sect2 id="KeySym_Case_Conversion_Procedure">
220<title>KeySym Case Conversion Procedure</title>
221<para>
222The specification for the
223<xref linkend='XtCaseProc' xrefstyle='select: title'/>
224function type has been changed
225to match the Release 3 implementation, which included necessary
226additional information required by the function (a pointer to the
227display connection), and corrects the argument type of the source
228KeySym parameter.  No known implementation of the Intrinsics
229implemented the previously documented interface.
230</para>
231</sect2>
232
233<sect2 id="Nonwidget_Objects_2">
234<title>Nonwidget Objects</title>
235<para>
236Formal support for nonwidget objects is new to Release 4.  A
237prototype implementation was latent in at least one Release 3
238implementation of the Intrinsics, but the specification has changed
239somewhat.  The most significant change is the requirement for a
240composite widget to declare the
241<function>CompositeClassExtension</function>
242record with the <emphasis remap='I'>accepts_objects</emphasis> field set to
243<function>True</function>
244in order to permit a client to create a nonwidget child.
245</para>
246
247<para>
248The addition of this extension field ensures that composite widgets
249written under Release 3 will not encounter unexpected errors if an
250application attempts to create a nonwidget child.  In Release 4 there
251is no requirement that all composite widgets implement the extra
252functionality required to manage windowless children, so the
253<emphasis remap='I'>accepts_objects</emphasis> field allows a composite widget to declare that it
254is not prepared to do so.
255</para>
256</sect2>
257</sect1>
258
259<sect1 id="Release_to_Release_Compatibility_2">
260<title>Release 4 to Release 5 Compatibility</title>
261<para>
262At the data structure level, Release 5 retains complete binary
263compatibility with Release 4.  The specification of the
264<function>ObjectPart</function>,
265<function>RectObjPart</function>,
266<function>CorePart</function>,
267<function>CompositePart</function>,
268<function>ShellPart</function>,
269<function>WMShellPart</function>,
270<function>TopLevelShellPart</function>,
271and
272<function>ApplicationShellPart</function>
273instance records was made less strict to permit implementations to
274add internal fields to these structures.  Any implementation that
275chooses to do so would, of course, force a recompilation.
276The Xlib specification for
277<function>XrmValue</function>
278and
279<function>XrmOptionDescRec</function>
280was updated to use a new type,
281<function>XPointer</function>,
282for the <emphasis remap='I'>addr</emphasis> and <emphasis remap='I'>value</emphasis> fields, respectively, to avoid
283ANSI C conformance problems.  The definition of
284<function>XPointer</function>
285is binary compatible with the previous implementation.
286</para>
287<sect2 id="baseTranslations_Resource">
288<title>baseTranslations Resource</title>
289<para>
290A new pseudo-resource, XtNbaseTranslations, was defined to permit
291application developers to specify translation tables in application
292defaults files while still giving end users the ability to augment
293or override individual event sequences.  This change will affect
294only those applications that wish to take advantage of the new
295functionality or those widgets that may have previously defined
296a resource named &ldquo;baseTranslations&rdquo;.
297</para>
298
299<para>
300Applications wishing to take advantage of the new functionality
301would change their application defaults file, e.g., from
302<programlisting>
303        app.widget.translations:         <emphasis remap='I'>value</emphasis>
304to
305        app.widget.baseTranslations:     <emphasis remap='I'>value</emphasis>
306</programlisting>
307If it is important to the application to preserve complete
308compatibility of the defaults file between different versions
309of the application running under Release 4 and Release 5,
310the full translations can be replicated in both the &ldquo;translations&rdquo;
311and the &ldquo;baseTranslations&rdquo; resource.
312</para>
313</sect2>
314
315<sect2 id="Resource_File_Search_Path">
316<title>Resource File Search Path</title>
317<para>
318The current specification allows implementations greater flexibility
319in defining the directory structure used to hold the application class
320and per-user application defaults files.  Previous specifications
321required the substitution strings to appear in the default path in a
322certain order, preventing sites from collecting all the files for
323a specific application together in one directory.  The Release 5
324specification allows the default path to specify the substitution
325strings in any order within a single path entry.  Users will need to
326pay close attention to the documentation for the specific
327implementation to know where to find these files and how to specify
328their own
329<emphasis role='strong'>XFILESEARCHPATH</emphasis>
330and
331<emphasis role='strong'>XUSERFILESEARCHPATH</emphasis>
332values when overriding the system defaults.
333</para>
334</sect2>
335
336<sect2 id="Customization_Resource">
337<title>Customization Resource</title>
338<para>
339<xref linkend='XtResolvePathname' xrefstyle='select: title'/>
340supports a new substitution string, %C, for specifying separate
341application class resource files according to arbitrary user-specified
342categories.  The primary motivation for this addition was separate
343monochrome and color application class defaults files.  The
344substitution value is obtained by querying the current resource
345database for the application resource name &ldquo;customization&rdquo;, class
346&ldquo;Customization&rdquo;.  Any application that previously used this
347resource name and class will need to be aware of the possibly
348conflicting semantics.
349</para>
350</sect2>
351
352<sect2 id="Per_Screen_Resource_Database">
353<title>Per-Screen Resource Database</title>
354<para>
355To allow a user to specify separate preferences for each screen of a
356display, a per-screen resource specification string has been added and
357multiple resource databases are created; one for each screen.  This
358will affect any application that modified the (formerly unique)
359resource database associated with the display subsequent to the Intrinsics
360database initialization.  Such applications will need to be aware
361of the particular screen on which each shell widget is to be created.
362</para>
363
364<para>
365Although the wording of the specification changed substantially in the
366description of the process by which the resource database(s) is
367initialized, the net effect is the same as in prior releases with the
368exception of the added per-screen resource specification and the new
369customization substitution string in
370<xref linkend='XtResolvePathname' xrefstyle='select: title'/>.
371</para>
372</sect2>
373
374<sect2 id="Internationalization_of_Applications">
375<title>Internationalization of Applications</title>
376<para>
377Internationalization as defined by ANSI is a technology that
378allows support of an application in a single locale.  In
379adding support for internationalization to the Intrinsics
380the restrictions of this model have been followed.
381In particular, the new Intrinsics interfaces are designed not to
382preclude an application from using other alternatives.
383For this reason, no Intrinsics routine makes a call to establish the
384locale.   However, a convenience routine to establish the
385locale at initialize time has been provided, in the form
386of a default procedure that must be explicitly installed
387if the application desires ANSI C locale behavior.
388</para>
389
390<para>
391As many objects in X, particularly resource databases, now inherit
392the global locale when they are created, applications wishing to use
393the ANSI C locale model should use the new function
394<function>XtSetLanguageProc</function>
395to do so.
396</para>
397
398<para>
399The internationalization additions also define event filters
400as a part of the Xlib Input Method specifications.  The
401Intrinsics enable the use of event filters through additions to
402<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>.
403Applications that may not be dispatching all events through
404<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>
405should be reviewed in the context of this new input method mechanism.
406</para>
407
408<para>
409In order to permit internationalization of error messages, the name
410and path of the error database file are now allowed to be
411implementation-dependent.
412No adequate standard mechanism has yet been suggested to
413allow the Intrinsics to locate the database from localization information
414supplied by the client.
415</para>
416
417<para>
418The previous specification for the syntax of the language string
419specified by
420<function>xnlLanguage</function>
421has been dropped to avoid potential conflicts with other standards.
422The language string syntax is now implementation-defined.
423The example syntax cited is consistent with the previous
424specification.
425</para>
426</sect2>
427
428<sect2 id="Permanently_Allocated_Strings">
429<title>Permanently Allocated Strings</title>
430<para>
431In order to permit additional memory savings, an Xlib interface was
432added to allow the resource manager to avoid copying certain string
433constants.  The Intrinsics specification was updated to explicitly require
434the Object <emphasis remap='I'>class_name</emphasis>, <emphasis remap='I'>resource_name</emphasis>, <emphasis remap='I'>resource_class</emphasis>,
435<emphasis remap='I'>resource_type</emphasis>, <emphasis remap='I'>default_type</emphasis> in resource tables, Core <emphasis remap='I'>actions</emphasis>
436<emphasis remap='I'>string</emphasis> field, and Constraint <emphasis remap='I'>resource_name</emphasis>, <emphasis remap='I'>resource_class</emphasis>,
437<emphasis remap='I'>resource_type</emphasis>, and <emphasis remap='I'>default_type</emphasis> resource fields to be
438permanently allocated.  This explicit requirement is expected to
439affect only applications that may create and destroy classes
440on the fly.
441</para>
442</sect2>
443
444<sect2 id="Arguments_to_Existing_Functions">
445<title>Arguments to Existing Functions</title>
446<para>
447The <emphasis remap='I'>args</emphasis> argument to
448<xref linkend='XtAppInitialize' xrefstyle='select: title'/>,
449<xref linkend='XtVaAppInitialize' xrefstyle='select: title'/>,
450<xref linkend='XtOpenDisplay' xrefstyle='select: title'/>,
451<xref linkend='XtDisplayInitialize' xrefstyle='select: title'/>,
452and
453<xref linkend='XtInitialize' xrefstyle='select: title'/>
454were changed from
455<function>Cardinal</function>*
456to int* to conform to pre-existing convention and avoid otherwise
457annoying typecasting in ANSI C environments.
458</para>
459</sect2>
460</sect1>
461
462<sect1 id="Release_to_Release_Compatibility_3">
463<title>Release 5 to Release 6 Compatibility</title>
464<para>
465At the data structure level, Release 6 retains binary compatibility
466with Release 5 for all data structures except
467<function>WMShellPart</function>.
468Three resources were added to the specification.
469The known implementations had unused space in the data structure,
470therefore on some architectures and implementations,
471the size of the part structure will not have changed as a result of this.
472</para>
473<sect2 id="Widget_Internals">
474<title>Widget Internals</title>
475<para>
476Two new widget methods for instance allocation and deallocation were added
477to the Object class.  These new methods
478allow widgets to be treated as C++ objects in the C++ environment
479when an appropriate allocation method is specified or inherited
480by the widget class.
481</para>
482
483<para>
484The textual descriptions of the processes of widget creation and
485widget destruction have been edited to provide clarification to widget
486writers.  Widgets writers may have reason to rely on the specific order of
487the stages of widget creation and destruction; with that motivation,
488the specification now more exactly describes the process.
489</para>
490
491<para>
492As a convenience, an interface to locate a widget class extension
493record on a linked list,
494<xref linkend='XtGetClassExtension' xrefstyle='select: title'/>,
495has been added.
496</para>
497
498<para>
499A new option to allow bundled changes to the managed set of a Composite
500widget is introduced in the Composite class extension record.
501Widgets that define a change_managed procedure that can accommodate
502additions and deletions to the managed set of children in a single
503invocation should set allows_change_managed_set to <function>True</function> in the
504extension record.
505</para>
506
507<para>
508The wording of the process followed by
509<xref linkend='XtUnmanageChildren' xrefstyle='select: title'/>
510has changed slightly to better handle changes to the managed set
511during phase 2 destroy processing.
512</para>
513
514<para>
515A new exposure event compression flag,
516<function>XtExposeNoRegion</function>,
517was added.  Many widgets specify exposure compression, but either
518ignore the actual damage region passed to the core expose procedure or
519use only the cumulative bounding box data available in the event.
520Widgets with expose procedures that do not make use of exact
521exposure region information can indicate that the Intrinsics need not
522compute the region.
523</para>
524</sect2>
525
526<sect2 id="General_Application_Development">
527<title>General Application Development</title>
528<para>
529<xref linkend='XtOpenApplication' xrefstyle='select: title'/>
530is a new convenience procedure to initialize the toolkit, create an
531application context, open an X display connection, and create the
532root of the widget instance tree.  It is identical to the interface
533it replaces,
534<xref linkend='XtAppInitialize' xrefstyle='select: title'/>,
535in all respects except that it takes an additional argument specifying
536the widget class of the root shell to create.
537This interface is now the recommended one so that clients may easily
538become session participants.
539The old convenience procedures appear in the compatibility section.
540</para>
541
542<para>
543The toolkit initialization function
544<xref linkend='XtToolkitInitialize' xrefstyle='select: title'/>
545may be called multiple times without penalty.
546</para>
547
548<para>
549In order to optimize changes in geometry to a set of geometry-managed
550children, a new interface,
551<xref linkend='XtChangeManagedSet' xrefstyle='select: title'/>,
552has been added.
553</para>
554</sect2>
555
556<sect2 id="Communication_with_Window_and_Session_Managers">
557<title>Communication with Window and Session Managers</title>
558<para>
559The revision of the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis> as an X Consortium standard has resulted
560in the addition of three fields to the specification of
561<function>WMShellPart</function>.
562These are <emphasis remap='I'>urgency</emphasis>, <emphasis remap='I'>client_leader</emphasis>, and <emphasis remap='I'>window_role</emphasis>.
563</para>
564
565<para>
566The adoption of the <emphasis remap='I'>X Session Management Protocol</emphasis> as an X Consortium
567standard has resulted in the addition of a new shell widget,
568<function>SessionShell</function>,
569and an accompanying subclass verification interface,
570<function>XtIsSessionShell</function>.
571This widget provides support for communication between an application
572and a session manager, as well as a window manager.
573In order to preserve compatibility with existing subclasses of
574<function>ApplicationShell</function>,
575the
576<function>ApplicationShell</function>
577was subclassed to create the new widget class.
578The session protocol requires a modal response to certain checkpointing
579operations by participating applications.  The
580<function>SessionShell</function>
581structures
582the application's notification of and responses to messages from the session
583manager by use of various callback lists and by use of the new interfaces
584<xref linkend='XtSessionGetToken' xrefstyle='select: title'/>
585and
586<xref linkend='XtSessionReturnToken' xrefstyle='select: title'/>.
587There is also a new command line argument, -xtsessionID, which facilitates
588the session manager in restarting applications based on the Intrinsics.
589</para>
590
591<para>
592The resource name and class strings defined by the Intrinsics shell
593widgets in
594<filename class="headerfile">&lt;X11/Shell.h&gt;</filename>
595are now listed in Appendix E.  The addition of a new symbol
596for the
597<function>WMShell</function>
598<emphasis remap='I'>wait_for_wm</emphasis> resource was made to bring the external symbol
599and the string it represents into agreement.  The actual resource name
600string in
601<function>WMShell</function>
602has not changed.
603The resource representation type of the XtNwinGravity resource of the
604<function>WMShell</function>
605was changed to XtRGravity in order to register a type
606converter so that window gravity resource values could be specified by name.
607</para>
608</sect2>
609
610<sect2 id="Geometry_Management_2">
611<title>Geometry Management</title>
612<para>
613A clarification to the specification was made to indicate that geometry
614requests may include current values along with the requested changes.
615</para>
616</sect2>
617
618<sect2 id="Event_Management_2">
619<title>Event Management</title>
620<para>
621In Release 6, support is provided for registering selectors
622and event handlers for events generated by X protocol extensions
623and for dispatching those events to the appropriate widget.
624The new event handler registration interfaces are
625<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>
626and
627<xref linkend='XtRemoveEventTypeHandler' xrefstyle='select: title'/>.
628Since the mechanism to indicate selection of extension events is specific
629to the extension being used, the Intrinsics introduces
630<xref linkend='XtRegisterExtensionSelector' xrefstyle='select: title'/>,
631which allows the application to select for the events of interest.
632In order to change the dispatching algorithm to accommodate extension events
633as well as core X protocol events,
634the Intrinsics event dispatcher may now be replaced or enveloped
635by the application with
636<xref linkend='XtSetEventDispatcher' xrefstyle='select: title'/>.
637The dispatcher may wish to call
638<xref linkend='XtGetKeyboardFocusWidget' xrefstyle='select: title'/>
639to determine the widget with the current Intrinsics keyboard focus.
640A dispatcher, after determining the destination widget, may use
641<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/>
642to cause the event to be dispatched to the event handlers registered
643by a specific widget.
644</para>
645
646<para>
647To permit the dispatching of events
648for nonwidget drawables, such as pixmaps that are not associated
649with a widget's window,
650<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/>
651and
652<xref linkend='XtUnregisterDrawable' xrefstyle='select: title'/>
653have been added to the library.  A related update was made to
654the description of
655<xref linkend='XtWindowToWidget' xrefstyle='select: title'/>.
656</para>
657
658<para>
659The library is now thread-safe, allowing one thread at a time to
660enter the library and protecting global data as necessary from concurrent use.
661Threaded toolkit applications are supported by the
662new interfaces
663<xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/>,
664<xref linkend='XtAppLock' xrefstyle='select: title'/>,
665<xref linkend='XtAppUnlock' xrefstyle='select: title'/>,
666<xref linkend='XtAppSetExitFlag' xrefstyle='select: title'/>,
667and
668<xref linkend='XtAppGetExitFlag' xrefstyle='select: title'/>.
669Widget writers may also use
670<xref linkend='XtProcessLock' xrefstyle='select: title'/>
671and
672<xref linkend='XtProcessUnlock' xrefstyle='select: title'/>.
673</para>
674
675<para>
676Safe handling of POSIX signals and other asynchronous notifications
677is now provided by use of
678<xref linkend='XtAppAddSignal' xrefstyle='select: title'/>,
679<xref linkend='XtNoticeSignal' xrefstyle='select: title'/>,
680and
681<xref linkend='XtRemoveSignal' xrefstyle='select: title'/>.
682</para>
683
684<para>
685The application can receive notification of an impending block
686in the Intrinsics event manager by registering interest through
687<xref linkend='XtAppAddBlockHook' xrefstyle='select: title'/>
688and
689<xref linkend='XtRemoveBlockHook' xrefstyle='select: title'/>.
690</para>
691
692<para>
693<xref linkend='XtLastEventProcessed' xrefstyle='select: title'/>
694returns the most recent event passed to
695<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>
696for a specified display.
697</para>
698</sect2>
699
700<sect2 id="Resource_Management_2">
701<title>Resource Management</title>
702<para>
703Resource converters are registered by the Intrinsics for window gravity
704and for three new resource types associated with session participation:
705RestartStyle, CommandArgArray and DirectoryString.
706</para>
707
708<para>
709The file search path syntax has been extended to make it easier to
710include the default search path, which controls resource
711database construction, by using the new substitution string, %D.
712</para>
713</sect2>
714
715<sect2 id="Translation_Management_2">
716<title>Translation Management</title>
717<para>
718The default key translator now recognizes the NumLock modifier.
719If NumLock is on and the second keysym is a keypad keysym
720(a standard keysym named with a &ldquo;KP&rdquo; prefix or a
721vendor-specific keysym in the hexadecimal range 0x11000000 to 0x1100FFFF),
722then the default key translator will
723use the first keysym if Shift and/or ShiftLock is on and will
724use the second keysym if neither is on.  Otherwise, it will
725ignore NumLock and apply the normal protocol semantics.
726</para>
727</sect2>
728
729<sect2 id="Selections">
730<title>Selections</title>
731<para>
732The targets of selection requests may be parameterized, as described
733by the revised <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>.
734When such requests are made,
735<xref linkend='XtSetSelectionParameters' xrefstyle='select: title'/>
736is used by the requestor to specify the target parameters and
737<xref linkend='XtGetSelectionParameters' xrefstyle='select: title'/>
738is used by the selection owner to retrieve the parameters.
739When a parameterized target is specified in the context of a bundled
740request for multiple targets,
741<xref linkend='XtCreateSelectionRequest' xrefstyle='select: title'/>,
742<xref linkend='XtCancelSelectionRequest' xrefstyle='select: title'/>,
743and
744<xref linkend='XtSendSelectionRequest' xrefstyle='select: title'/>
745are used to envelop the assembly of the request.
746When the parameters themselves are the names of properties,
747the Intrinsics provides support for the economical use of property atom names;
748see
749<xref linkend='XtReservePropertyAtom' xrefstyle='select: title'/>
750and
751<xref linkend='XtReleasePropertyAtom' xrefstyle='select: title'/>.
752</para>
753</sect2>
754
755<sect2 id="External_Agent_Hooks">
756<title>External Agent Hooks</title>
757<para>
758External agent hooks were added for the benefit of applications
759that instrument other applications for purposes of accessibility,
760testing, and customization.  The external agent and the application
761communicate by a shared protocol which is transparent to the application.
762The hook callbacks permit the external agent to register interest
763in groups or classes of toolkit activity and to be notified of the
764type and details of the activity as it occurs.  The new interfaces
765related to this effort are
766<xref linkend='XtHooksOfDisplay' xrefstyle='select: title'/>,
767which returns the hook registration widget, and
768<xref linkend='XtGetDisplays' xrefstyle='select: title'/>,
769which returns a list of the X displays associated with an application context.
770</para>
771</sect2>
772</sect1>
773
774<sect1 id="Release_to_Release_Compatibility_4">
775<title>Release 6 to Release 7 Compatibility</title>
776
777<sect2 id="Changes_During_X11R6">
778<title>Changes During X11R6</title>
779<para>
780The Toolkit was proposed in X10R4, released at the end of 1986.
781The X11R6 documentation was completed in mid&ndash;1994.
782Over most of the eleven years through X11R6.9,
783only minor changes were made to the specification.
784Some changes are documented only in the release notes:
785</para>
786
787<itemizedlist>
788<listitem>
789<para>
790The X11R6.3 release notes (1997) mention one new feature (section 3.15)
791<emphasis remap='I'>Xt Geometry Management Debugger</emphasis>, saying
792</para>
793<blockquote>
794<para>
795Daniel Dardailler's &ldquo;GeoTattler&rdquo; code has been merged into the Xt
796Intrinsics library implementation.
797This is not a standard.
798If libXt is compiled with the <code>XT_GEO_TATTLER</code> symbol defined
799(currently there is no build configuration support to do this)
800then a &ldquo;geoTattler&rdquo; resource
801may be specified for any widget in an application.
802If the <code>geoTattler</code>
803resource for a widget instance is <code>True</code>
804then libXt will generate debugging information to
805<emphasis remap='I'>stdout</emphasis> when the widget makes geometry change requests.
806</para>
807<para>
808For example, if the resources specify:
809</para>
810<programlisting>
811myapp*draw.XmScale.geoTattler: ON
812*XmScrollBar.geoTattler:ON
813*XmRowColumn.exit_button.geoTattler:ON
814</programlisting>
815<para>
816then geometry management debugging information will be generated for all
817the <code>XmScale</code> children
818of the widget named <emphasis remap='I'>draw</emphasis>,
819all the XmScrollBars,
820and the widget named <emphasis remap='I'>exit_button</emphasis>
821in any <code>XmRowColumn</code>.
822</para>
823</blockquote>
824</listitem>
825<listitem>
826<para>
827X11R6.4 (1998) added
828<xref linkend='Resource_Configuration_Management' />.
829The release notes explain that by saying
830<blockquote>
831<para>
832The X Toolkit Intrinsics library (libXt) now has IBM's Easy Resource
833Configuration support included.
834</para>
835</blockquote>
836</para>
837<para>
838but goes on to say (section 14) that
839<blockquote>
840<para>
841Easy Resource Configuration
842is not a standard part of the X Toolkit Intrinsics (libXt).
843It is neither an X Consortium standard nor an X Project Team specification.
844</para>
845</blockquote>
846</para>
847</listitem>
848<listitem>
849<para>
850X11R6.5 (2000) documented a bug-fix for XtAppPeekEvent in the release notes,
851stating that it now worked as described in the specification.
852It also modified the description of XtAppPeekEvent in the specification.
853Previously the specification stated that no known implementations behaved
854as specified.
855</para>
856</listitem>
857<listitem>
858<para>
859Subsequent releases X11R6.6 (2001) through X11R6.9 (2005)
860did not document any new or improved features.
861</para>
862</listitem>
863</itemizedlist>
864<para>
865Throughout this interval,
866there were undocumented fixes and improvements made to the X Toolkit Intrinsics library.
867The documentation was modified to fix minor errors,
868improve the formatting, and
869update version numbers.
870</para>
871</sect2>
872<sect2 id="Changes_During_X11R7">
873<title>Changes During X11R7</title>
874<para>
875X11R7 releases starting in 2005 continued this trend,
876converting the documentation from nroff to sgml.
877X11R7.7 (2012) provides the same Intrinsics specification
878(aside from details of formatting and version numbers) as X11R6 (1995).
879</para>
880<para>
881The updates for this specification are a continuation of X11R7.7,
882because (as of April 2019) there are no plans for an X11R7.8 release.
883</para>
884</sect2>
885<sect2 id="Converting_to_Standard_C">
886<title>Converting to Standard C</title>
887<para>
888The Intrinsics specification was first released with X11R3 in 1989.
889That was too early to take Standard C (i.e., ANSI C) into account.
890Because vendors generally did not provide a no-cost Standard C compiler,
891the X Toolkit Intrinsics library initially supported both K&amp;R and ANSI C.
892The X11R5 release notes mention using gcc, with some caveats.
893As a result, the specification and implementation gave equal attention
894to both K&amp;R and ANSI C.
895</para>
896<para>
897This example shows how a function prototype was used in the C header files:
898</para>
899<programlisting>
900extern Display *XtOpenDisplay(
901#if NeedFunctionPrototypes
902    XtAppContext        /* app_context */,
903    _Xconst _XtString   /* display_string */,
904    _Xconst _XtString   /* application_name */,
905    _Xconst _XtString   /* application_class */,
906    XrmOptionDescRec*   /* options */,
907    Cardinal            /* num_options */,
908    int*                /* argc */,
909    char**              /* argv */
910#endif
911);
912</programlisting>
913<para>
914The parameters for the ANSI C prototype were conditionally compiled.
915Used with a K&amp;R compiler, those parameters were ignored.
916</para>
917<itemizedlist>
918<listitem>
919<para>
920The X Toolkit Intrinsics library used <type>const</type> in just a few cases.
921The specification did not mention it at all.
922</para>
923<para>
924Over time, that was seen as a problem,
925partly because of gcc's warning options
926such as <emphasis remap='I'>write-strings</emphasis>,
927introduced in early 1988 (released with gcc 1.27 in late 1988).
928Quoting from gcc 2.58's documentation (late 1993):
929<programlisting>
930`-Wwrite-strings'
931     Give string constants the type `const char[LENGTH]' so that
932     copying the address of one into a non-`const' `char *' pointer
933     will get a warning.  These warnings will help you find at compile
934     time code that can try to write into a string constant, but only
935     if you have been very careful about using `const' in declarations
936     and prototypes.  <emphasis remap='I'>Otherwise, it will just be a nuisance; this is
937     why we did not make `-Wall' request these warnings.</emphasis>
938</programlisting>
939</para>
940<para>
941Others did not agree that it was a nuisance. Besides the obvious advantage
942of improving program correctness, making a symbol &ldquo;const&rdquo;
943gave the compiler and linker a hint that the symbol could be put into
944the text (read-only) section, eliminating some steps needed by the linker
945to adjust addresses and thereby reducing the time it took to load a
946program into memory.
947</para>
948<para>
949Other gcc warning options (such as
950such as <emphasis remap='I'>cast-qual</emphasis>)
951are useful for improving programs.
952They give similar information, because unless told otherwise,
953gcc would treat string values as nonwritable.
954Quoting from gcc 1.27:
955<programlisting>
956   * GNU CC normally makes string constants read-only.  If several
957     identical-looking string constants are used, GNU CC stores only
958     one copy of the string.
959     ...
960     The best solution to these problems is to change the program to
961     use `char'-array variables with initialization strings for these
962     purposes instead of string constants.  But if this is not
963     possible, you can use the `-fwritable-strings' flag, which
964     directs GNU CC to handle string constants the same way most C
965     compilers do.
966</programlisting>
967and
968<programlisting>
969    `-fwritable-strings'
970          Store string constants in the writable data segment and
971          don't uniquize them.  This is for compatibility with old
972          programs which assume they can write into string constants.
973          Writing into string constants is a very bad idea;
974          ``constants'' should be constant.
975</programlisting>
976</para>
977</listitem>
978<listitem>
979<para>
980Several prototypes in the implementation
981use the private type <type>_XtString</type>.
982The specification and implementation also used a <type>String</type>
983type without explaining when it is appropriate.
984<programlisting>
985typedef char *String;
986
987/* We do this in order to get "const" declarations to work right.  We
988 * use _XtString instead of String so that C++ applications can
989 * #define String to something else if they choose, to avoid conflicts
990 * with other C++ libraries.
991 */
992#define _XtString char*
993</programlisting>
994That is, the developers were providing for some workaround to allow
995C++ applications to use the stricter compiler checking
996associated with <type>const</type>.
997</para>
998</listitem>
999<listitem>
1000<para>
1001The <type>String</type> type is not the only type used in the
1002prototypes for the X Toolkit Intrinsics library.
1003Its developers were also concerned with porting the library
1004to platforms with different size-constraints.
1005They defined different types (used in the function prototypes)
1006depending on whether a &ldquo;wide&rdquo; parameter type was appropriate: 
1007<programlisting>
1008/* _Xt names are private to Xt implementation, do not use in client code */
1009#if NeedWidePrototypes
1010#define _XtBoolean	int
1011#define _XtDimension	unsigned int
1012#define _XtKeyCode	unsigned int
1013#define _XtPosition	int
1014#define _XtXtEnum	unsigned int
1015#else
1016#define _XtBoolean	Boolean
1017#define _XtDimension	Dimension
1018#define _XtKeyCode	KeyCode
1019#define _XtPosition	Position
1020#define _XtXtEnum	XtEnum
1021#endif /* NeedWidePrototypes */
1022</programlisting>
1023and
1024<programlisting>
1025#ifdef CRAY
1026typedef long		Boolean;
1027typedef char*		XtArgVal;
1028typedef long		XtEnum;
1029#else
1030typedef char		Boolean;
1031typedef long		XtArgVal;
1032typedef unsigned char	XtEnum;
1033#endif
1034</programlisting>
1035In practice, wide-prototypes are rarely used, not well supported.
1036The specification did not clarify the distinction
1037between <type>Bool</type> (mentioned as a resource type)
1038and <type>Boolean</type> (used in all of the data structures).
1039The implementation used both, predominantly the latter.
1040</para>
1041</listitem>
1042</itemizedlist>
1043<para>
1044Other features of Standard C were neglected in the specification because
1045it was accommodating K&amp;R C:
1046</para>
1047<itemizedlist>
1048<listitem>
1049<para>
1050K&amp;R C has no <type>void</type> keyword.
1051The specification used it for return-types,
1052but not to indicate an empty parameter list.
1053The specification also stated that
1054<type>void*</type> would be used for the <type>XtPointer</type> type.
1055</para>
1056<para>
1057The conversion to sgml lost the <type>void</type> return-type.
1058</para>
1059</listitem>
1060<listitem>
1061<para>
1062Standard C uses an ellipsis for variable-length argument lists, e.g., for
1063<xref linkend='XtVaAppCreateShell' />.
1064Again, there was a conditional-compilation symbol
1065(<code>NeedVarargsPrototypes</code>)
1066to handle the different forms used.
1067Here is an example:
1068<programlisting>
1069#if NeedVarargsPrototypes
1070void
1071XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resources, Cardinal num_resources, ...)
1072#else
1073/*VARARGS4*/
1074void XtVaGetApplicationResources(widget, base, resources, num_resources, va_alist)
1075    Widget widget;
1076    XtPointer base;
1077    XtResourceList resources;
1078    Cardinal num_resources;
1079    va_dcl
1080#endif
1081</programlisting>
1082</para>
1083<para>
1084One problem with the conditional-compilation was
1085that it was easy to make a mistake with the order
1086of parameters between the two forms.
1087Developers would frequently group together parameters
1088which used the same type, whether or not they were adjacent in
1089the Standard C prototype.
1090</para>
1091<para>
1092A comment in the X11R4 header file said that this was temporary,
1093until function prototypes worked everywhere.
1094That was finally removed in X11R6.7 (fourteen years later).
1095However, the subsequent conversion to sgml
1096lost the ellipsis from the prototypes shown in the specification.
1097</para>
1098</listitem>
1099</itemizedlist>
1100<para>
1101Support for K&amp;R C was removed from the header files in 2003
1102(released in X11R6.7),
1103and from the library source in 2004
1104(released in X11R6.9).
1105The wide-prototype feature is still present in 2019, but generally unused.
1106</para>
1107<para>
1108Removing support for K&amp;R C did not address the issues of <type>const</type>.
1109That was done in 2019:
1110</para>
1111<itemizedlist>
1112<listitem>
1113<para>
1114The <type>String</type> is conditionally defined,
1115to provide compatibility with existing applications.
1116</para>
1117</listitem>
1118<listitem>
1119<para>
1120If the symbol <symbol>_CONST_X_STRING</symbol> is defined,
1121<type>String</type> is read-only as shown here.
1122<programlisting>
1123/*
1124 * As used in its function interface, the String type of libXt can be readonly.
1125 * But compiling libXt with this feature may require some internal changes,
1126 * e.g., casts and occasionally using a plain "char*".
1127 */
1128#ifdef _CONST_X_STRING
1129typedef const char *String;
1130#else
1131typedef char *String;
1132#endif
1133</programlisting>
1134</para>
1135</listitem>
1136<listitem>
1137<para>
1138Applications which use the newer <type>const</type> feature must define
1139<symbol>_CONST_X_STRING</symbol> to enable this feature.
1140</para>
1141</listitem>
1142<listitem>
1143<para>
1144By default, the X Toolkit Intrinsics library
1145uses the <type>const</type> feature.
1146It has been updated to make use of the <type>const</type> feature
1147for improved type-checking.
1148</para>
1149</listitem>
1150<listitem>
1151<para>
1152Because the X Toolkit Intrinsics library uses <type>const</type>,
1153some prototypes have been modified.
1154For example:
1155<itemizedlist>
1156<listitem>
1157<para>
1158Most of the parameters which used <type>String</type> are unmodified; 
1159a few (such as the <emphasis remap='I'>argv</emphasis>&ndash;parameters)
1160are actually read/write.
1161They are now <type>char*</type> parameters.
1162</para>
1163<para>
1164Many of the strings passed to the library are stored in widgets
1165without reallocating a copy.
1166Those are treated as read-only, and use the <type>String</type> type.
1167</para>
1168</listitem>
1169<listitem>
1170<para>
1171Each change to the documentation was verified using scripts that
1172extracted the function prototypes and used the C compiler to check
1173for compatibility.
1174</para>
1175</listitem>
1176</itemizedlist>
1177</para>
1178</listitem>
1179</itemizedlist>
1180</sect2>
1181</sect1>
1182</chapter>
1183