10568f49bSmrg<?xml version="1.0" encoding="UTF-8" ?> 20568f49bSmrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 30568f49bSmrg 49e7bcd65Smrg<chapter id='Event_Management'> 59e7bcd65Smrg<title>Event Management</title> 69e7bcd65Smrg<para> 79e7bcd65SmrgWhile Xlib allows the reading and processing of events anywhere in an application, 89e7bcd65Smrgwidgets in the X Toolkit neither directly read events 99e7bcd65Smrgnor grab the server or pointer. 109e7bcd65SmrgWidgets register procedures that are to be called 119e7bcd65Smrgwhen an event or class of events occurs in that widget. 129e7bcd65Smrg</para> 139e7bcd65Smrg 149e7bcd65Smrg<para> 159e7bcd65SmrgA typical application consists of startup code followed by an event loop 169e7bcd65Smrgthat reads events and dispatches them by calling 179e7bcd65Smrgthe procedures that widgets have registered. 189e7bcd65SmrgThe default event loop provided by the Intrinsics is 199e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/>. 209e7bcd65Smrg</para> 219e7bcd65Smrg 229e7bcd65Smrg<para> 239e7bcd65SmrgThe event manager is a collection of functions to perform the following tasks: 249e7bcd65Smrg</para> 259e7bcd65Smrg<itemizedlist spacing='compact'> 269e7bcd65Smrg <listitem> 279e7bcd65Smrg <para> 289e7bcd65SmrgAdd or remove event sources other than X server events (in particular, 299e7bcd65Smrgtimer interrupts, file input, or POSIX signals). 309e7bcd65Smrg </para> 319e7bcd65Smrg </listitem> 329e7bcd65Smrg <listitem> 339e7bcd65Smrg <para> 349e7bcd65SmrgQuery the status of event sources. 359e7bcd65Smrg </para> 369e7bcd65Smrg </listitem> 379e7bcd65Smrg <listitem> 389e7bcd65Smrg <para> 399e7bcd65SmrgAdd or remove procedures to be called when an event occurs for a particular 409e7bcd65Smrgwidget. 419e7bcd65Smrg </para> 429e7bcd65Smrg </listitem> 439e7bcd65Smrg <listitem> 449e7bcd65Smrg <para> 459e7bcd65SmrgEnable and 469e7bcd65Smrgdisable the dispatching of user-initiated events (keyboard and pointer events) 479e7bcd65Smrgfor a particular widget. 489e7bcd65Smrg </para> 499e7bcd65Smrg </listitem> 509e7bcd65Smrg <listitem> 519e7bcd65Smrg <para> 529e7bcd65SmrgConstrain the dispatching of events to a cascade of pop-up widgets. 539e7bcd65Smrg </para> 549e7bcd65Smrg </listitem> 559e7bcd65Smrg <listitem> 569e7bcd65Smrg <para> 579e7bcd65SmrgRegister procedures to be called when specific events arrive. 589e7bcd65Smrg </para> 599e7bcd65Smrg </listitem> 609e7bcd65Smrg <listitem> 619e7bcd65Smrg <para> 629e7bcd65SmrgRegister procedures to be called when the Intrinsics will block. 639e7bcd65Smrg </para> 649e7bcd65Smrg </listitem> 659e7bcd65Smrg <listitem> 669e7bcd65Smrg <para> 679e7bcd65SmrgEnable safe operation in a multi-threaded environment. 689e7bcd65Smrg </para> 699e7bcd65Smrg </listitem> 709e7bcd65Smrg</itemizedlist> 719e7bcd65Smrg<para> 729e7bcd65SmrgMost widgets do not need to call any of the event handler functions explicitly. 739e7bcd65SmrgThe normal interface to X events is through the higher-level 749e7bcd65Smrgtranslation manager, 759e7bcd65Smrgwhich maps sequences of X events, with modifiers, into procedure calls. 769e7bcd65SmrgApplications rarely use any of the event manager routines besides 779e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/>. 789e7bcd65Smrg</para> 799e7bcd65Smrg<sect1 id="Adding_and_Deleting_Additional_Event_Sources"> 809e7bcd65Smrg<title>Adding and Deleting Additional Event Sources</title> 819e7bcd65Smrg<para> 829e7bcd65SmrgWhile most applications are driven only by X events, 839e7bcd65Smrgsome applications need to incorporate other sources of input 849e7bcd65Smrginto the Intrinsics event-handling mechanism. 859e7bcd65SmrgThe event manager provides routines to integrate notification of timer events 869e7bcd65Smrgand file data pending into this mechanism. 879e7bcd65Smrg</para> 889e7bcd65Smrg 899e7bcd65Smrg<para> 909e7bcd65SmrgThe next section describes functions that provide input gathering from files. 919e7bcd65SmrgThe application registers the files with the Intrinsics read routine. 929e7bcd65SmrgWhen input is pending on one of the files, 939e7bcd65Smrgthe registered callback procedures are invoked. 949e7bcd65Smrg</para> 959e7bcd65Smrg<sect2 id="Adding_and_Removing_Input_Sources"> 969e7bcd65Smrg<title>Adding and Removing Input Sources</title> 979e7bcd65Smrg<para> 989e7bcd65SmrgTo register a new file as an input source for a given application context, use 999e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/>. 1009e7bcd65Smrg</para> 1019e7bcd65Smrg 1029e7bcd65Smrg<funcsynopsis id='XtAppAddInput'> 1039e7bcd65Smrg<funcprototype> 1049e7bcd65Smrg<funcdef>XtInputId <function>XtAppAddInput</function></funcdef> 1059e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 1069e7bcd65Smrg <paramdef>int <parameter>source</parameter></paramdef> 1079e7bcd65Smrg <paramdef>XtPointer <parameter>condition</parameter></paramdef> 1089e7bcd65Smrg <paramdef>XtInputCallbackProc <parameter>proc</parameter></paramdef> 1099e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 1109e7bcd65Smrg</funcprototype> 1119e7bcd65Smrg</funcsynopsis> 1129e7bcd65Smrg 1139e7bcd65Smrg<variablelist> 1149e7bcd65Smrg <varlistentry> 1159e7bcd65Smrg <term> 1169e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 1179e7bcd65Smrg </term> 1189e7bcd65Smrg <listitem> 1199e7bcd65Smrg <para> 1209e7bcd65SmrgSpecifies the application context that identifies the application. 1219e7bcd65Smrg </para> 1229e7bcd65Smrg </listitem> 1239e7bcd65Smrg </varlistentry> 1249e7bcd65Smrg <varlistentry> 1259e7bcd65Smrg <term> 1269e7bcd65Smrg <emphasis remap='I'>source</emphasis> 1279e7bcd65Smrg </term> 1289e7bcd65Smrg <listitem> 1299e7bcd65Smrg <para> 1309e7bcd65SmrgSpecifies the source file descriptor on a POSIX-based system 1319e7bcd65Smrgor other operating-system-dependent device specification. 1329e7bcd65Smrg </para> 1339e7bcd65Smrg </listitem> 1349e7bcd65Smrg </varlistentry> 1359e7bcd65Smrg <varlistentry> 1369e7bcd65Smrg <term> 1379e7bcd65Smrg <emphasis remap='I'>condition</emphasis> 1389e7bcd65Smrg </term> 1399e7bcd65Smrg <listitem> 1409e7bcd65Smrg <para> 1419e7bcd65SmrgSpecifies the mask that indicates a read, write, or exception condition 1429e7bcd65Smrgor some other operating-system-dependent condition. 1439e7bcd65Smrg </para> 1449e7bcd65Smrg </listitem> 1459e7bcd65Smrg </varlistentry> 1469e7bcd65Smrg <varlistentry> 1479e7bcd65Smrg <term> 1489e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 1499e7bcd65Smrg </term> 1509e7bcd65Smrg <listitem> 1519e7bcd65Smrg <para> 1529e7bcd65SmrgSpecifies the procedure to be called when the condition is found. 1539e7bcd65Smrg </para> 1549e7bcd65Smrg </listitem> 1559e7bcd65Smrg </varlistentry> 1569e7bcd65Smrg <varlistentry> 1579e7bcd65Smrg <term> 1589e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 1599e7bcd65Smrg </term> 1609e7bcd65Smrg <listitem> 1619e7bcd65Smrg <para> 1629e7bcd65SmrgSpecifies an argument passed to the specified procedure 1639e7bcd65Smrgwhen it is called. 1649e7bcd65Smrg </para> 1659e7bcd65Smrg </listitem> 1669e7bcd65Smrg </varlistentry> 1679e7bcd65Smrg</variablelist> 1689e7bcd65Smrg 1699e7bcd65Smrg<para> 1709e7bcd65SmrgThe 1719e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/> 1729e7bcd65Smrgfunction registers with the Intrinsics read routine a new source of events, 1739e7bcd65Smrgwhich is usually file input but can also be file output. 1749e7bcd65SmrgNote that <emphasis remap='I'>file</emphasis> should be loosely interpreted to mean any sink 1759e7bcd65Smrgor source of data. 1769e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/> 1779e7bcd65Smrgalso specifies the conditions under which the source can generate events. 1789e7bcd65SmrgWhen an event is pending on this source, 1799e7bcd65Smrgthe callback procedure is called. 1809e7bcd65Smrg</para> 1819e7bcd65Smrg 1829e7bcd65Smrg<para> 1839e7bcd65SmrgThe legal values for the <emphasis remap='I'>condition</emphasis> argument are operating-system-dependent. 1849e7bcd65SmrgOn a POSIX-based system, 1859e7bcd65Smrg<emphasis remap='I'>source</emphasis> is a file number and the condition is some union of the following: 1869e7bcd65Smrg<variablelist> 1879e7bcd65Smrg <varlistentry> 1889e7bcd65Smrg <term> 1899e7bcd65Smrg <emphasis role='strong'>XtInputReadMask</emphasis> 1909e7bcd65Smrg </term> 1919e7bcd65Smrg <listitem> 1929e7bcd65Smrg <para> 1939e7bcd65SmrgSpecifies that <emphasis remap='I'>proc</emphasis> is to be called when <emphasis remap='I'>source</emphasis> has data to be read. 1949e7bcd65Smrg </para> 1959e7bcd65Smrg </listitem> 1969e7bcd65Smrg </varlistentry> 1979e7bcd65Smrg <varlistentry> 1989e7bcd65Smrg <term> 1999e7bcd65Smrg <emphasis role='strong'>XtInputWriteMask</emphasis> 2009e7bcd65Smrg </term> 2019e7bcd65Smrg <listitem> 2029e7bcd65Smrg <para> 2039e7bcd65SmrgSpecifies that <emphasis remap='I'>proc</emphasis> is to be called when <emphasis remap='I'>source</emphasis> is ready 2049e7bcd65Smrgfor writing. 2059e7bcd65Smrg </para> 2069e7bcd65Smrg </listitem> 2079e7bcd65Smrg </varlistentry> 2089e7bcd65Smrg <varlistentry> 2099e7bcd65Smrg <term> 2109e7bcd65Smrg <emphasis role='strong'>XtInputExceptMask</emphasis> 2119e7bcd65Smrg </term> 2129e7bcd65Smrg <listitem> 2139e7bcd65Smrg <para> 2149e7bcd65SmrgSpecifies that <emphasis remap='I'>proc</emphasis> is to be called when <emphasis remap='I'>source</emphasis> has 2159e7bcd65Smrgexception data. 2169e7bcd65Smrg </para> 2179e7bcd65Smrg </listitem> 2189e7bcd65Smrg </varlistentry> 2199e7bcd65Smrg</variablelist> 2209e7bcd65Smrg</para> 2219e7bcd65Smrg 2229e7bcd65Smrg<para> 2239e7bcd65SmrgCallback procedure pointers used to handle file events are of 2249e7bcd65Smrgtype 2259e7bcd65Smrg<xref linkend='XtInputCallbackProc' xrefstyle='select: title'/>. 2269e7bcd65Smrg</para> 2279e7bcd65Smrg 2289e7bcd65Smrg<funcsynopsis id='XtInputCallbackProc'> 2299e7bcd65Smrg<funcprototype> 2309e7bcd65Smrg<funcdef>typedef void <function>(*XtInputCallbackProc)</function></funcdef> 2319e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 2329e7bcd65Smrg <paramdef>int *<parameter>source</parameter></paramdef> 2339e7bcd65Smrg <paramdef>XtInputId *<parameter>id</parameter></paramdef> 2349e7bcd65Smrg</funcprototype> 2359e7bcd65Smrg</funcsynopsis> 2369e7bcd65Smrg 2379e7bcd65Smrg<variablelist> 2389e7bcd65Smrg <varlistentry> 2399e7bcd65Smrg <term> 2409e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 2419e7bcd65Smrg </term> 2429e7bcd65Smrg <listitem> 2439e7bcd65Smrg <para> 2449e7bcd65SmrgPasses the client data argument that was registered for this procedure in 2450568f49bSmrg<function>XtAppAddInput</function>. 2469e7bcd65Smrg </para> 2479e7bcd65Smrg </listitem> 2489e7bcd65Smrg </varlistentry> 2499e7bcd65Smrg <varlistentry> 2509e7bcd65Smrg <term> 2519e7bcd65Smrg <emphasis remap='I'>source</emphasis> 2529e7bcd65Smrg </term> 2539e7bcd65Smrg <listitem> 2549e7bcd65Smrg <para> 2559e7bcd65SmrgPasses the source file descriptor generating the event. 2569e7bcd65Smrg </para> 2579e7bcd65Smrg </listitem> 2589e7bcd65Smrg </varlistentry> 2599e7bcd65Smrg <varlistentry> 2609e7bcd65Smrg <term> 2619e7bcd65Smrg <emphasis remap='I'>id</emphasis> 2629e7bcd65Smrg </term> 2639e7bcd65Smrg <listitem> 2649e7bcd65Smrg <para> 2659e7bcd65SmrgPasses the id returned from the corresponding 2669e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/> 2679e7bcd65Smrgcall. 2689e7bcd65Smrg </para> 2699e7bcd65Smrg </listitem> 2709e7bcd65Smrg </varlistentry> 2719e7bcd65Smrg</variablelist> 2729e7bcd65Smrg 2739e7bcd65Smrg<para> 2749e7bcd65SmrgSee <xref linkend='Using_the_Intrinsics_in_a_Multi_Threaded_Environment' /> 2759e7bcd65Smrgfor information regarding the use of 2769e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/> 2779e7bcd65Smrgin multiple threads. 2789e7bcd65Smrg</para> 2799e7bcd65Smrg 2809e7bcd65Smrg<para> 2819e7bcd65SmrgTo discontinue a source of input, use 2829e7bcd65Smrg<xref linkend='XtRemoveInput' xrefstyle='select: title'/>. 2839e7bcd65Smrg</para> 2849e7bcd65Smrg 2859e7bcd65Smrg<funcsynopsis id='XtRemoveInput'> 2869e7bcd65Smrg<funcprototype> 2879e7bcd65Smrg<funcdef>void <function>XtRemoveInput</function></funcdef> 2889e7bcd65Smrg <paramdef>XtInputId <parameter>id</parameter></paramdef> 2899e7bcd65Smrg</funcprototype> 2909e7bcd65Smrg</funcsynopsis> 2919e7bcd65Smrg 2929e7bcd65Smrg<variablelist> 2939e7bcd65Smrg <varlistentry> 2949e7bcd65Smrg <term> 2959e7bcd65Smrg <emphasis remap='I'>id</emphasis> 2969e7bcd65Smrg </term> 2979e7bcd65Smrg <listitem> 2989e7bcd65Smrg <para> 2999e7bcd65SmrgSpecifies the id returned from the corresponding 3009e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/> 3019e7bcd65Smrgcall. 3029e7bcd65Smrg </para> 3039e7bcd65Smrg </listitem> 3049e7bcd65Smrg </varlistentry> 3059e7bcd65Smrg</variablelist> 3069e7bcd65Smrg 3079e7bcd65Smrg<para> 3089e7bcd65SmrgThe 3099e7bcd65Smrg<xref linkend='XtRemoveInput' xrefstyle='select: title'/> 3109e7bcd65Smrgfunction causes the Intrinsics read routine to stop watching for events 3119e7bcd65Smrgfrom the file source specified by <emphasis remap='I'>id</emphasis>. 3129e7bcd65Smrg</para> 3139e7bcd65Smrg 3149e7bcd65Smrg<para> 3159e7bcd65SmrgSee <xref linkend='Using_the_Intrinsics_in_a_Multi_Threaded_Environment' /> 3169e7bcd65Smrgfor information regarding the use of 3179e7bcd65Smrg<xref linkend='XtRemoveInput' xrefstyle='select: title'/> 3189e7bcd65Smrgin multiple threads. 3199e7bcd65Smrg</para> 3209e7bcd65Smrg</sect2> 3219e7bcd65Smrg 3229e7bcd65Smrg<sect2 id="Adding_and_Removing_Blocking_Notifications"> 3239e7bcd65Smrg<title>Adding and Removing Blocking Notifications</title> 3249e7bcd65Smrg<para> 3259e7bcd65SmrgOccasionally it is desirable for an application to receive notification 3269e7bcd65Smrgwhen the Intrinsics event manager detects no pending input from file sources 3279e7bcd65Smrgand no pending input from X server event sources and is about to block 3289e7bcd65Smrgin an operating system call. 3299e7bcd65Smrg</para> 3309e7bcd65Smrg 3319e7bcd65Smrg<para> 3329e7bcd65SmrgTo register a hook that is called immediately prior to event blocking, use 3339e7bcd65Smrg<xref linkend='XtAppAddBlockHook' xrefstyle='select: title'/>. 3349e7bcd65Smrg</para> 3359e7bcd65Smrg 3369e7bcd65Smrg<funcsynopsis id='XtAppAddBlockHook'> 3379e7bcd65Smrg<funcprototype> 3389e7bcd65Smrg<funcdef>XtBlockHookId <function>XtAppAddBlockHook</function></funcdef> 3399e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 3409e7bcd65Smrg <paramdef>XtBlockHookProc <parameter>proc</parameter></paramdef> 3419e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 3429e7bcd65Smrg</funcprototype> 3439e7bcd65Smrg</funcsynopsis> 3449e7bcd65Smrg 3459e7bcd65Smrg<variablelist> 3469e7bcd65Smrg <varlistentry> 3479e7bcd65Smrg <term> 3489e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 3499e7bcd65Smrg </term> 3509e7bcd65Smrg <listitem> 3519e7bcd65Smrg <para> 3529e7bcd65SmrgSpecifies the application context that identifies the application. 3539e7bcd65Smrg </para> 3549e7bcd65Smrg </listitem> 3559e7bcd65Smrg </varlistentry> 3569e7bcd65Smrg <varlistentry> 3579e7bcd65Smrg <term> 3589e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 3599e7bcd65Smrg </term> 3609e7bcd65Smrg <listitem> 3619e7bcd65Smrg <para> 3629e7bcd65SmrgSpecifies the procedure to be called before blocking. 3639e7bcd65Smrg </para> 3649e7bcd65Smrg </listitem> 3659e7bcd65Smrg </varlistentry> 3669e7bcd65Smrg <varlistentry> 3679e7bcd65Smrg <term> 3689e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 3699e7bcd65Smrg </term> 3709e7bcd65Smrg <listitem> 3719e7bcd65Smrg <para> 3729e7bcd65SmrgSpecifies an argument passed to the specified procedure when it is called. 3739e7bcd65Smrg </para> 3749e7bcd65Smrg </listitem> 3759e7bcd65Smrg </varlistentry> 3769e7bcd65Smrg</variablelist> 3779e7bcd65Smrg 3789e7bcd65Smrg<para> 3799e7bcd65SmrgThe 3809e7bcd65Smrg<xref linkend='XtAppAddBlockHook' xrefstyle='select: title'/> 3819e7bcd65Smrgfunction registers the specified procedure and returns an identifier for it. 3829e7bcd65SmrgThe hook procedure <emphasis remap='I'>proc</emphasis> is called at any time in the future when 3839e7bcd65Smrgthe Intrinsics are about to block pending some input. 3849e7bcd65Smrg</para> 3859e7bcd65Smrg 3869e7bcd65Smrg<para> 3879e7bcd65SmrgThe procedure pointers used to provide notification of event blocking 3889e7bcd65Smrgare of type 3899e7bcd65Smrg<xref linkend='XtBlockHookProc' xrefstyle='select: title'/>. 3909e7bcd65Smrg</para> 3919e7bcd65Smrg 3929e7bcd65Smrg<funcsynopsis id='XtBlockHookProc'> 3939e7bcd65Smrg<funcprototype> 3940568f49bSmrg<funcdef>typedef void *<function>XtBlockHookProc</function></funcdef> 3959e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 3969e7bcd65Smrg</funcprototype> 3979e7bcd65Smrg</funcsynopsis> 3989e7bcd65Smrg 3999e7bcd65Smrg<variablelist> 4009e7bcd65Smrg <varlistentry> 4019e7bcd65Smrg <term> 4029e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 4039e7bcd65Smrg </term> 4049e7bcd65Smrg <listitem> 4059e7bcd65Smrg <para> 4069e7bcd65SmrgPasses the client data argument that was registered for this procedure in 4070568f49bSmrg<function>XtAppAddBlockHook</function>. 4089e7bcd65Smrg </para> 4099e7bcd65Smrg </listitem> 4109e7bcd65Smrg </varlistentry> 4119e7bcd65Smrg</variablelist> 4129e7bcd65Smrg 4139e7bcd65Smrg<para> 4149e7bcd65SmrgTo discontinue the use of a procedure for blocking notification, use 4159e7bcd65Smrg<xref linkend='XtRemoveBlockHook' xrefstyle='select: title'/>. 4169e7bcd65Smrg</para> 4179e7bcd65Smrg 4189e7bcd65Smrg<funcsynopsis id='XtRemoveBlockHook'> 4199e7bcd65Smrg<funcprototype> 4209e7bcd65Smrg<funcdef>void <function>XtRemoveBlockHook</function></funcdef> 4219e7bcd65Smrg <paramdef>XtBlockHookId <parameter>id</parameter></paramdef> 4229e7bcd65Smrg</funcprototype> 4239e7bcd65Smrg</funcsynopsis> 4249e7bcd65Smrg 4259e7bcd65Smrg<variablelist> 4269e7bcd65Smrg <varlistentry> 4279e7bcd65Smrg <term> 4289e7bcd65Smrg <emphasis remap='I'>id</emphasis> 4299e7bcd65Smrg </term> 4309e7bcd65Smrg <listitem> 4319e7bcd65Smrg <para> 4329e7bcd65SmrgSpecifies the identifier returned from the corresponding call to 4339e7bcd65Smrg<xref linkend='XtAppAddBlockHook' xrefstyle='select: title'/>. 4349e7bcd65Smrg </para> 4359e7bcd65Smrg </listitem> 4369e7bcd65Smrg </varlistentry> 4379e7bcd65Smrg</variablelist> 4389e7bcd65Smrg 4399e7bcd65Smrg<para> 4409e7bcd65SmrgThe 4419e7bcd65Smrg<xref linkend='XtRemoveBlockHook' xrefstyle='select: title'/> 4429e7bcd65Smrgfunction removes the specified procedure from the list of procedures 4439e7bcd65Smrgthat are called by the Intrinsics read routine before blocking on event sources. 4449e7bcd65Smrg</para> 4459e7bcd65Smrg</sect2> 4469e7bcd65Smrg 4479e7bcd65Smrg<sect2 id="Adding_and_Removing_Timeouts"> 4489e7bcd65Smrg<title>Adding and Removing Timeouts</title> 4499e7bcd65Smrg<para> 4509e7bcd65SmrgThe timeout facility notifies the application or the widget 4519e7bcd65Smrgthrough a callback procedure that a specified time interval has elapsed. 4529e7bcd65SmrgTimeout values are uniquely identified by an interval id. 4539e7bcd65Smrg</para> 4549e7bcd65Smrg 4559e7bcd65Smrg<para> 4569e7bcd65SmrgTo register a timeout callback, use 4579e7bcd65Smrg<xref linkend='XtAppAddTimeOut' xrefstyle='select: title'/>. 4589e7bcd65Smrg</para> 4599e7bcd65Smrg 4609e7bcd65Smrg<funcsynopsis id='XtAppAddTimeOut'> 4619e7bcd65Smrg<funcprototype> 4629e7bcd65Smrg<funcdef>XtIntervalId <function>XtAppAddTimeOut</function></funcdef> 4639e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 4649e7bcd65Smrg <paramdef>unsigned long <parameter>interval</parameter></paramdef> 4659e7bcd65Smrg <paramdef>XtTimerCallbackProc <parameter>proc</parameter></paramdef> 4669e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 4679e7bcd65Smrg</funcprototype> 4689e7bcd65Smrg</funcsynopsis> 4699e7bcd65Smrg 4709e7bcd65Smrg<variablelist> 4719e7bcd65Smrg <varlistentry> 4729e7bcd65Smrg <term> 4739e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 4749e7bcd65Smrg </term> 4759e7bcd65Smrg <listitem> 4769e7bcd65Smrg <para> 4779e7bcd65SmrgSpecifies the application context for which the timer is to be set. 4789e7bcd65Smrg </para> 4799e7bcd65Smrg </listitem> 4809e7bcd65Smrg </varlistentry> 4819e7bcd65Smrg <varlistentry> 4829e7bcd65Smrg <term> 4839e7bcd65Smrg <emphasis remap='I'>interval</emphasis> 4849e7bcd65Smrg </term> 4859e7bcd65Smrg <listitem> 4869e7bcd65Smrg <para> 4879e7bcd65SmrgSpecifies the time interval in milliseconds. 4889e7bcd65Smrg </para> 4899e7bcd65Smrg </listitem> 4909e7bcd65Smrg </varlistentry> 4919e7bcd65Smrg <varlistentry> 4929e7bcd65Smrg <term> 4939e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 4949e7bcd65Smrg </term> 4959e7bcd65Smrg <listitem> 4969e7bcd65Smrg <para> 4979e7bcd65SmrgSpecifies the procedure to be called when the time expires. 4989e7bcd65Smrg </para> 4999e7bcd65Smrg </listitem> 5009e7bcd65Smrg </varlistentry> 5019e7bcd65Smrg <varlistentry> 5029e7bcd65Smrg <term> 5039e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 5049e7bcd65Smrg </term> 5059e7bcd65Smrg <listitem> 5069e7bcd65Smrg <para> 5079e7bcd65SmrgSpecifies an argument passed to the specified procedure 5089e7bcd65Smrgwhen it is called. 5099e7bcd65Smrg </para> 5109e7bcd65Smrg </listitem> 5119e7bcd65Smrg </varlistentry> 5129e7bcd65Smrg</variablelist> 5139e7bcd65Smrg 5149e7bcd65Smrg<para> 5159e7bcd65SmrgThe 5169e7bcd65Smrg<xref linkend='XtAppAddTimeOut' xrefstyle='select: title'/> 5179e7bcd65Smrgfunction creates a timeout and returns an identifier for it. 5189e7bcd65SmrgThe timeout value is set to <emphasis remap='I'>interval</emphasis>. 5199e7bcd65SmrgThe callback procedure <emphasis remap='I'>proc</emphasis> is called when 5209e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/> 5219e7bcd65Smrgor 5229e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 5239e7bcd65Smrgis next called after the time interval elapses, 5249e7bcd65Smrgand then the timeout is removed. 5259e7bcd65Smrg</para> 5269e7bcd65Smrg 5279e7bcd65Smrg<para> 5289e7bcd65SmrgCallback procedure pointers used with timeouts are of 5299e7bcd65Smrgtype 5309e7bcd65Smrg<xref linkend='XtTimerCallbackProc' xrefstyle='select: title'/>. 5319e7bcd65Smrg</para> 5329e7bcd65Smrg 5339e7bcd65Smrg<funcsynopsis id='XtTimerCallbackProc'> 5349e7bcd65Smrg<funcprototype> 5350568f49bSmrg<funcdef>typedef void *<function>XtTimerCallbackProc</function></funcdef> 5369e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 5379e7bcd65Smrg <paramdef>XtIntervalId *<parameter>timer</parameter></paramdef> 5389e7bcd65Smrg</funcprototype> 5399e7bcd65Smrg</funcsynopsis> 5409e7bcd65Smrg 5419e7bcd65Smrg<variablelist> 5429e7bcd65Smrg <varlistentry> 5439e7bcd65Smrg <term> 5449e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 5459e7bcd65Smrg </term> 5469e7bcd65Smrg <listitem> 5479e7bcd65Smrg <para> 5489e7bcd65SmrgPasses the client data argument that was registered for this procedure in 5490568f49bSmrg<function>XtAppAddTimeOut</function>. 5509e7bcd65Smrg </para> 5519e7bcd65Smrg </listitem> 5529e7bcd65Smrg </varlistentry> 5539e7bcd65Smrg <varlistentry> 5549e7bcd65Smrg <term> 5559e7bcd65Smrg <emphasis remap='I'>timer</emphasis> 5569e7bcd65Smrg </term> 5579e7bcd65Smrg <listitem> 5589e7bcd65Smrg <para> 5599e7bcd65SmrgPasses the id returned from the corresponding 5609e7bcd65Smrg<xref linkend='XtAppAddTimeOut' xrefstyle='select: title'/> 5619e7bcd65Smrgcall. 5629e7bcd65Smrg </para> 5639e7bcd65Smrg </listitem> 5649e7bcd65Smrg </varlistentry> 5659e7bcd65Smrg</variablelist> 5669e7bcd65Smrg 5679e7bcd65Smrg<para> 5689e7bcd65SmrgSee <xref linkend='Using_the_Intrinsics_in_a_Multi_Threaded_Environment' /> 5699e7bcd65Smrgfor information regarding the use of 5709e7bcd65Smrg<xref linkend='XtAppAddTimeOut' xrefstyle='select: title'/> 5719e7bcd65Smrgin multiple threads. 5729e7bcd65Smrg</para> 5739e7bcd65Smrg 5749e7bcd65Smrg<para> 5759e7bcd65SmrgTo clear a timeout value, use 5769e7bcd65Smrg<xref linkend='XtRemoveTimeOut' xrefstyle='select: title'/>. 5779e7bcd65Smrg</para> 5789e7bcd65Smrg 5799e7bcd65Smrg<funcsynopsis id='XtRemoveTimeOut'> 5809e7bcd65Smrg<funcprototype> 5819e7bcd65Smrg<funcdef>void <function>XtRemoveTimeOut</function></funcdef> 5829e7bcd65Smrg <paramdef>XtIntervalId <parameter>timer</parameter></paramdef> 5839e7bcd65Smrg</funcprototype> 5849e7bcd65Smrg</funcsynopsis> 5859e7bcd65Smrg 5869e7bcd65Smrg<variablelist> 5879e7bcd65Smrg <varlistentry> 5889e7bcd65Smrg <term> 5899e7bcd65Smrg <emphasis remap='I'>timer</emphasis> 5909e7bcd65Smrg </term> 5919e7bcd65Smrg <listitem> 5929e7bcd65Smrg <para> 5939e7bcd65SmrgSpecifies the id for the timeout request to be cleared. 5949e7bcd65Smrg </para> 5959e7bcd65Smrg </listitem> 5969e7bcd65Smrg </varlistentry> 5979e7bcd65Smrg</variablelist> 5989e7bcd65Smrg 5999e7bcd65Smrg<para> 6009e7bcd65SmrgThe 6019e7bcd65Smrg<xref linkend='XtRemoveTimeOut' xrefstyle='select: title'/> 6029e7bcd65Smrgfunction removes the pending timeout. 6039e7bcd65SmrgNote that timeouts are automatically removed once they trigger. 6049e7bcd65Smrg</para> 6059e7bcd65Smrg 6069e7bcd65Smrg<para> 6079e7bcd65SmrgPlease refer to Section 7.12 for information regarding the use of 6089e7bcd65Smrg<xref linkend='XtRemoveTimeOut' xrefstyle='select: title'/> 6099e7bcd65Smrgin multiple threads. 6109e7bcd65Smrg</para> 6119e7bcd65Smrg</sect2> 6129e7bcd65Smrg 6139e7bcd65Smrg<sect2 id="Adding_and_Removing_Signal_Callbacks"> 6149e7bcd65Smrg<title>Adding and Removing Signal Callbacks</title> 6159e7bcd65Smrg<para> 6169e7bcd65SmrgThe signal facility notifies the application or the widget through a 6179e7bcd65Smrgcallback procedure that a signal or other external asynchronous event 6189e7bcd65Smrghas occurred. The registered callback procedures are uniquely identified 6199e7bcd65Smrgby a signal id. 6209e7bcd65Smrg</para> 6219e7bcd65Smrg 6229e7bcd65Smrg<para> 6239e7bcd65SmrgPrior to establishing a signal handler, the application or widget should 6249e7bcd65Smrgcall 6259e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/> 6269e7bcd65Smrgand store the resulting identifier in a place accessible to the signal 6279e7bcd65Smrghandler. When a signal arrives, the signal handler should call 6289e7bcd65Smrg<xref linkend='XtNoticeSignal' xrefstyle='select: title'/> 6290568f49bSmrgto notify the Intrinsics that a signal has occurred. To register a signal 6309e7bcd65Smrgcallback use 6319e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/>. 6329e7bcd65Smrg</para> 6339e7bcd65Smrg 6349e7bcd65Smrg<funcsynopsis id='XtAppAddSignal'> 6359e7bcd65Smrg<funcprototype> 6369e7bcd65Smrg<funcdef>XtSignalId <function>XtAppAddSignal</function></funcdef> 6379e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 6389e7bcd65Smrg <paramdef>XtSignalCallbackProc <parameter>proc</parameter></paramdef> 6399e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 6409e7bcd65Smrg</funcprototype> 6419e7bcd65Smrg</funcsynopsis> 6429e7bcd65Smrg 6439e7bcd65Smrg<variablelist> 6449e7bcd65Smrg <varlistentry> 6459e7bcd65Smrg <term> 6469e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 6479e7bcd65Smrg </term> 6489e7bcd65Smrg <listitem> 6499e7bcd65Smrg <para> 6509e7bcd65SmrgSpecifies the application context that identifies the application. 6519e7bcd65Smrg </para> 6529e7bcd65Smrg </listitem> 6539e7bcd65Smrg </varlistentry> 6549e7bcd65Smrg <varlistentry> 6559e7bcd65Smrg <term> 6569e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 6579e7bcd65Smrg </term> 6589e7bcd65Smrg <listitem> 6599e7bcd65Smrg <para> 6609e7bcd65SmrgSpecifies the procedure to be called when the signal is noticed. 6619e7bcd65Smrg </para> 6629e7bcd65Smrg </listitem> 6639e7bcd65Smrg </varlistentry> 6649e7bcd65Smrg <varlistentry> 6659e7bcd65Smrg <term> 6669e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 6679e7bcd65Smrg </term> 6689e7bcd65Smrg <listitem> 6699e7bcd65Smrg <para> 6709e7bcd65SmrgSpecifies an argument passed to the specified procedure when it is called. 6719e7bcd65Smrg </para> 6729e7bcd65Smrg </listitem> 6739e7bcd65Smrg </varlistentry> 6749e7bcd65Smrg</variablelist> 6759e7bcd65Smrg 6769e7bcd65Smrg<para> 6779e7bcd65SmrgThe callback procedure pointers used to handle signal events are of type 6789e7bcd65Smrg<xref linkend='XtSignalCallbackProc' xrefstyle='select: title'/>. 6799e7bcd65Smrg</para> 6809e7bcd65Smrg 6819e7bcd65Smrg<funcsynopsis id='XtSignalCallbackProc'> 6829e7bcd65Smrg<funcprototype> 6839e7bcd65Smrg<funcdef>typedef void <function>(*XtSignalCallbackProc)</function></funcdef> 6849e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 6859e7bcd65Smrg <paramdef>XtSignalId *<parameter>id</parameter></paramdef> 6869e7bcd65Smrg</funcprototype> 6879e7bcd65Smrg</funcsynopsis> 6889e7bcd65Smrg 6899e7bcd65Smrg<variablelist> 6909e7bcd65Smrg <varlistentry> 6919e7bcd65Smrg <term> 6929e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 6939e7bcd65Smrg </term> 6949e7bcd65Smrg <listitem> 6959e7bcd65Smrg <para> 6969e7bcd65SmrgPasses the client data argument that was registered for this procedure in 6979e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/>. 6989e7bcd65Smrg </para> 6999e7bcd65Smrg </listitem> 7009e7bcd65Smrg </varlistentry> 7019e7bcd65Smrg <varlistentry> 7029e7bcd65Smrg <term> 7039e7bcd65Smrg <emphasis remap='I'>id</emphasis> 7049e7bcd65Smrg </term> 7059e7bcd65Smrg <listitem> 7069e7bcd65Smrg <para> 7079e7bcd65SmrgPasses the id returned from the corresponding 7089e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/> 7099e7bcd65Smrgcall. 7109e7bcd65Smrg </para> 7119e7bcd65Smrg </listitem> 7129e7bcd65Smrg </varlistentry> 7139e7bcd65Smrg</variablelist> 7149e7bcd65Smrg 7159e7bcd65Smrg<para> 7160568f49bSmrgTo notify the Intrinsics that a signal has occurred, use 7179e7bcd65Smrg<xref linkend='XtNoticeSignal' xrefstyle='select: title'/>. 7189e7bcd65Smrg</para> 7199e7bcd65Smrg 7209e7bcd65Smrg<funcsynopsis id='XtNoticeSignal'> 7219e7bcd65Smrg<funcprototype> 7229e7bcd65Smrg<funcdef>void <function>XtNoticeSignal</function></funcdef> 7239e7bcd65Smrg <paramdef>XtSignalId <parameter>id</parameter></paramdef> 7249e7bcd65Smrg</funcprototype> 7259e7bcd65Smrg</funcsynopsis> 7269e7bcd65Smrg 7279e7bcd65Smrg<variablelist> 7289e7bcd65Smrg <varlistentry> 7299e7bcd65Smrg <term> 7309e7bcd65Smrg <emphasis remap='I'>id</emphasis> 7319e7bcd65Smrg </term> 7329e7bcd65Smrg <listitem> 7339e7bcd65Smrg <para> 7349e7bcd65SmrgSpecifies the id returned from the corresponding 7359e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/> 7369e7bcd65Smrgcall. 7379e7bcd65Smrg </para> 7389e7bcd65Smrg </listitem> 7399e7bcd65Smrg </varlistentry> 7409e7bcd65Smrg</variablelist> 7419e7bcd65Smrg 7429e7bcd65Smrg<para> 7439e7bcd65SmrgOn a POSIX-based system, 7449e7bcd65Smrg<xref linkend='XtNoticeSignal' xrefstyle='select: title'/> 7459e7bcd65Smrgis the only Intrinsics function that can safely be called from a signal handler. 7469e7bcd65SmrgIf 7479e7bcd65Smrg<xref linkend='XtNoticeSignal' xrefstyle='select: title'/> 7489e7bcd65Smrgis invoked multiple times before the Intrinsics are able to invoke the 7499e7bcd65Smrgregistered callback, the callback is only called once. 7500568f49bSmrgLogically, the Intrinsics maintain “pending” flag for each registered callback. 7519e7bcd65SmrgThis flag is initially 7529e7bcd65Smrg<function>False</function> 7539e7bcd65Smrgand is set to 7549e7bcd65Smrg<function>True</function> 7559e7bcd65Smrgby 7569e7bcd65Smrg<xref linkend='XtNoticeSignal' xrefstyle='select: title'/>. 7579e7bcd65SmrgWhen 7589e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/> 7599e7bcd65Smrgor 7609e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 7619e7bcd65Smrg(with a mask including 7629e7bcd65Smrg<function>XtIMSignal</function>) 7630568f49bSmrgis called, all registered callbacks with “pending” 7649e7bcd65Smrg<function>True</function> 7659e7bcd65Smrgare invoked and the flags are reset to 7669e7bcd65Smrg<function>False</function>. 7679e7bcd65Smrg</para> 7689e7bcd65Smrg 7699e7bcd65Smrg<para> 7709e7bcd65SmrgIf the signal handler wants to track how many times the signal has been 7719e7bcd65Smrgraised, it can keep its own private counter. Typically the handler would 7729e7bcd65Smrgnot do any other work; the callback does the actual processing for the 7739e7bcd65Smrgsignal. The Intrinsics never block signals from being raised, so if a given 7749e7bcd65Smrgsignal can be raised multiple times before the Intrinsics can invoke the 7759e7bcd65Smrgcallback for that signal, the callback must be designed to deal with 7769e7bcd65Smrgthis. In another case, a signal might be raised just after the Intrinsics 7779e7bcd65Smrgsets the pending flag to 7789e7bcd65Smrg<function>False</function> 7799e7bcd65Smrgbut before the callback can get control, in which case the pending flag 7809e7bcd65Smrgwill still be 7819e7bcd65Smrg<function>True</function> 7829e7bcd65Smrgafter the callback returns, and the Intrinsics will invoke the callback 7839e7bcd65Smrgagain, even though all of the signal raises have been handled. The 7849e7bcd65Smrgcallback must also be prepared to handle this case. 7859e7bcd65Smrg</para> 7869e7bcd65Smrg 7879e7bcd65Smrg<para> 7889e7bcd65SmrgTo remove a registered signal callback, call 7899e7bcd65Smrg<xref linkend='XtRemoveSignal' xrefstyle='select: title'/>. 7909e7bcd65Smrg</para> 7919e7bcd65Smrg 7929e7bcd65Smrg<funcsynopsis id='XtRemoveSignal'> 7939e7bcd65Smrg<funcprototype> 7949e7bcd65Smrg<funcdef>void <function>XtRemoveSignal</function></funcdef> 7959e7bcd65Smrg <paramdef>XtSignalId <parameter>id</parameter></paramdef> 7969e7bcd65Smrg</funcprototype> 7979e7bcd65Smrg</funcsynopsis> 7989e7bcd65Smrg 7999e7bcd65Smrg<variablelist> 8009e7bcd65Smrg <varlistentry> 8019e7bcd65Smrg <term> 8029e7bcd65Smrg <emphasis remap='I'>id</emphasis> 8039e7bcd65Smrg </term> 8049e7bcd65Smrg <listitem> 8059e7bcd65Smrg <para> 8069e7bcd65SmrgSpecifies the id returned by the corresponding call to 8079e7bcd65Smrg<xref linkend='XtAppAddSignal' xrefstyle='select: title'/>. 8089e7bcd65Smrg </para> 8099e7bcd65Smrg </listitem> 8109e7bcd65Smrg </varlistentry> 8119e7bcd65Smrg</variablelist> 8129e7bcd65Smrg 8139e7bcd65Smrg<para> 8149e7bcd65SmrgThe client should typically disable the source of the signal before calling 8159e7bcd65Smrg<xref linkend='XtRemoveSignal' xrefstyle='select: title'/>. 8169e7bcd65SmrgIf the signal could have been raised again before the source was disabled 8179e7bcd65Smrgand the client wants to process it, then after disabling the source but 8189e7bcd65Smrgbefore calling 8199e7bcd65Smrg<xref linkend='XtRemoveSignal' xrefstyle='select: title'/> 8209e7bcd65Smrgthe client can test for signals with 8219e7bcd65Smrg<xref linkend='XtAppPending' xrefstyle='select: title'/> 8229e7bcd65Smrgand process them by calling 8239e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 8249e7bcd65Smrgwith the mask 8259e7bcd65Smrg<function>XtIMSignal</function>. 8269e7bcd65Smrg</para> 8279e7bcd65Smrg</sect2> 8289e7bcd65Smrg</sect1> 8299e7bcd65Smrg 8309e7bcd65Smrg<sect1 id="Constraining_Events_to_a_Cascade_of_Widgets"> 8319e7bcd65Smrg<title>Constraining Events to a Cascade of Widgets</title> 8329e7bcd65Smrg<para> 8339e7bcd65SmrgModal widgets are widgets that, except for the input directed to them, 8349e7bcd65Smrglock out user input to the application. 8359e7bcd65Smrg</para> 8369e7bcd65Smrg 8379e7bcd65Smrg<para> 8389e7bcd65SmrgWhen a modal menu or modal dialog box is popped up using 8399e7bcd65Smrg<xref linkend='XtPopup' xrefstyle='select: title'/>, 8409e7bcd65Smrguser events (keyboard and pointer events) that occur outside the modal 8419e7bcd65Smrgwidget should be delivered to the modal widget or ignored. 8429e7bcd65SmrgIn no case will user events be delivered to a widget outside 8439e7bcd65Smrgthe modal widget. 8449e7bcd65Smrg</para> 8459e7bcd65Smrg 8469e7bcd65Smrg<para> 8479e7bcd65SmrgMenus can pop up submenus, and dialog boxes can pop up further dialog 8489e7bcd65Smrgboxes to create a pop-up cascade. 8499e7bcd65SmrgIn this case, 8509e7bcd65Smrguser events may be delivered to one of several modal widgets in the cascade. 8519e7bcd65Smrg</para> 8529e7bcd65Smrg 8539e7bcd65Smrg<para> 8549e7bcd65SmrgDisplay-related events should be delivered outside the modal cascade so that 8559e7bcd65Smrgexposure events and the like keep the application's display up-to-date. 8569e7bcd65SmrgAny event that occurs within the cascade is delivered as usual. 8579e7bcd65SmrgThe user events delivered to the most recent spring-loaded shell 8589e7bcd65Smrgin the cascade when they occur outside the cascade are called remap events 8599e7bcd65Smrgand are 8609e7bcd65Smrg<function>KeyPress</function>, 8619e7bcd65Smrg<function>KeyRelease</function>, 8629e7bcd65Smrg<function>ButtonPress</function>, 8639e7bcd65Smrgand 8649e7bcd65Smrg<function>ButtonRelease</function>. 8659e7bcd65SmrgThe user events ignored when they occur outside the cascade are 8669e7bcd65Smrg<function>MotionNotify</function> 8679e7bcd65Smrgand 8689e7bcd65Smrg<function>EnterNotify</function>. 8699e7bcd65SmrgAll other events are delivered normally. 8709e7bcd65SmrgIn particular, note that this is one 8719e7bcd65Smrgway in which widgets can receive 8729e7bcd65Smrg<function>LeaveNotify</function> 8739e7bcd65Smrgevents without first receiving 8749e7bcd65Smrg<function>EnterNotify</function> 8759e7bcd65Smrgevents; they should be prepared to deal with 8769e7bcd65Smrgthis, typically by ignoring any unmatched 8779e7bcd65Smrg<function>LeaveNotify</function> 8789e7bcd65Smrgevents. 8799e7bcd65Smrg</para> 8809e7bcd65Smrg 8819e7bcd65Smrg<para> 8829e7bcd65Smrg<xref linkend='XtPopup' xrefstyle='select: title'/> 8839e7bcd65Smrguses the 8849e7bcd65Smrg<xref linkend='XtAddGrab' xrefstyle='select: title'/> 8859e7bcd65Smrgand 8869e7bcd65Smrg<xref linkend='XtRemoveGrab' xrefstyle='select: title'/> 8879e7bcd65Smrgfunctions to constrain user events to a modal cascade 8889e7bcd65Smrgand subsequently to remove a grab when the modal widget is popped down. 8899e7bcd65Smrg</para> 8909e7bcd65Smrg 8919e7bcd65Smrg<para> 8929e7bcd65SmrgTo constrain or redirect user input to a modal widget, use 8939e7bcd65Smrg<xref linkend='XtAddGrab' xrefstyle='select: title'/>. 8949e7bcd65Smrg</para> 8959e7bcd65Smrg 8969e7bcd65Smrg<funcsynopsis id='XtAddGrab'> 8979e7bcd65Smrg<funcprototype> 8989e7bcd65Smrg<funcdef>void <function>XtAddGrab</function></funcdef> 8999e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 9009e7bcd65Smrg <paramdef>Boolean <parameter>exclusive</parameter></paramdef> 9019e7bcd65Smrg <paramdef>Boolean <parameter>spring_loaded</parameter></paramdef> 9029e7bcd65Smrg</funcprototype> 9039e7bcd65Smrg</funcsynopsis> 9049e7bcd65Smrg 9059e7bcd65Smrg<variablelist> 9069e7bcd65Smrg <varlistentry> 9079e7bcd65Smrg <term> 9089e7bcd65Smrg <emphasis remap='I'>w</emphasis> 9099e7bcd65Smrg </term> 9109e7bcd65Smrg <listitem> 9119e7bcd65Smrg <para> 9129e7bcd65SmrgSpecifies the widget to add to the modal cascade. Must be of class Core or any subclass thereof. 9139e7bcd65Smrg </para> 9149e7bcd65Smrg </listitem> 9159e7bcd65Smrg </varlistentry> 9169e7bcd65Smrg <varlistentry> 9179e7bcd65Smrg <term> 9189e7bcd65Smrg <emphasis remap='I'>exclusive</emphasis> 9199e7bcd65Smrg </term> 9209e7bcd65Smrg <listitem> 9219e7bcd65Smrg <para> 9229e7bcd65SmrgSpecifies whether user events should be dispatched exclusively to this widget 9239e7bcd65Smrgor also to previous widgets in the cascade. 9249e7bcd65Smrg </para> 9259e7bcd65Smrg </listitem> 9269e7bcd65Smrg </varlistentry> 9279e7bcd65Smrg <varlistentry> 9289e7bcd65Smrg <term> 9299e7bcd65Smrg <emphasis remap='I'>spring_loaded</emphasis> 9309e7bcd65Smrg </term> 9319e7bcd65Smrg <listitem> 9329e7bcd65Smrg <para> 9339e7bcd65SmrgSpecifies whether this widget was popped up because the user pressed 9349e7bcd65Smrga pointer button. 9359e7bcd65Smrg </para> 9369e7bcd65Smrg </listitem> 9379e7bcd65Smrg </varlistentry> 9389e7bcd65Smrg</variablelist> 9399e7bcd65Smrg 9409e7bcd65Smrg<para> 9419e7bcd65SmrgThe 9429e7bcd65Smrg<xref linkend='XtAddGrab' xrefstyle='select: title'/> 9439e7bcd65Smrgfunction appends the widget to the modal cascade 9449e7bcd65Smrgand checks that <emphasis remap='I'>exclusive</emphasis> is 9459e7bcd65Smrg<function>True</function> 9469e7bcd65Smrgif <emphasis remap='I'>spring_loaded</emphasis> is 9479e7bcd65Smrg<function>True</function>. 9489e7bcd65SmrgIf this condition is not met, 9499e7bcd65Smrg<xref linkend='XtAddGrab' xrefstyle='select: title'/> 9509e7bcd65Smrggenerates a warning message. 9519e7bcd65Smrg</para> 9529e7bcd65Smrg 9539e7bcd65Smrg<para> 9549e7bcd65SmrgThe modal cascade is used by 9559e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 9569e7bcd65Smrgwhen it tries to dispatch a user event. 9579e7bcd65SmrgWhen at least one modal widget is in the widget cascade, 9589e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 9599e7bcd65Smrgfirst determines if the event should be delivered. 9609e7bcd65SmrgIt starts at the most recent cascade entry and follows the cascade up to and 9619e7bcd65Smrgincluding the most recent cascade entry added with the <emphasis remap='I'>exclusive</emphasis> parameter 9629e7bcd65Smrg<function>True</function>. 9639e7bcd65Smrg</para> 9649e7bcd65Smrg 9659e7bcd65Smrg<para> 9669e7bcd65SmrgThis subset of the modal cascade along with all descendants of these widgets 9679e7bcd65Smrgcomprise the active subset. 9689e7bcd65SmrgUser events that occur outside the widgets in this subset are ignored 9699e7bcd65Smrgor remapped. 9709e7bcd65SmrgModal menus with submenus generally add a submenu widget to the cascade 9719e7bcd65Smrgwith <emphasis remap='I'>exclusive</emphasis> 9729e7bcd65Smrg<function>False</function>. 9739e7bcd65SmrgModal dialog boxes that need to restrict user input to the most deeply nested 9749e7bcd65Smrgdialog box add a subdialog widget to the cascade with <emphasis remap='I'>exclusive</emphasis> 9759e7bcd65Smrg<function>True</function>. 9769e7bcd65SmrgUser events that occur within the active subset are delivered to the 9779e7bcd65Smrgappropriate widget, which is usually a child or further descendant of the modal 9789e7bcd65Smrgwidget. 9799e7bcd65Smrg</para> 9809e7bcd65Smrg 9819e7bcd65Smrg<para> 9829e7bcd65SmrgRegardless of where in the application they occur, 9839e7bcd65Smrgremap events are always delivered to the most recent widget in the active 9849e7bcd65Smrgsubset of the cascade registered with <emphasis remap='I'>spring_loaded</emphasis> 9859e7bcd65Smrg<function>True</function>, 9869e7bcd65Smrgif any such widget exists. 9879e7bcd65SmrgIf the event 9889e7bcd65Smrgoccurred in the active subset of the cascade but outside the 9899e7bcd65Smrgspring-loaded widget, it is delivered normally before being 9909e7bcd65Smrgdelivered also to the spring-loaded widget. 9919e7bcd65SmrgRegardless of where it is dispatched, the Intrinsics do not modify 9929e7bcd65Smrgthe contents of the event. 9939e7bcd65Smrg</para> 9949e7bcd65Smrg 9959e7bcd65Smrg<para> 9969e7bcd65SmrgTo remove the redirection of user input to a modal widget, use 9979e7bcd65Smrg<xref linkend='XtRemoveGrab' xrefstyle='select: title'/>. 9989e7bcd65Smrg</para> 9999e7bcd65Smrg 10009e7bcd65Smrg<funcsynopsis id='XtRemoveGrab'> 10019e7bcd65Smrg<funcprototype> 10029e7bcd65Smrg<funcdef>void <function>XtRemoveGrab</function></funcdef> 10039e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 10049e7bcd65Smrg</funcprototype> 10059e7bcd65Smrg</funcsynopsis> 10069e7bcd65Smrg 10079e7bcd65Smrg<variablelist> 10089e7bcd65Smrg <varlistentry> 10099e7bcd65Smrg <term> 10109e7bcd65Smrg <emphasis remap='I'>w</emphasis> 10119e7bcd65Smrg </term> 10129e7bcd65Smrg <listitem> 10139e7bcd65Smrg <para> 10149e7bcd65SmrgSpecifies the widget to remove from the modal cascade. 10159e7bcd65Smrg </para> 10169e7bcd65Smrg </listitem> 10179e7bcd65Smrg </varlistentry> 10189e7bcd65Smrg</variablelist> 10199e7bcd65Smrg 10209e7bcd65Smrg<para> 10219e7bcd65SmrgThe 10229e7bcd65Smrg<xref linkend='XtRemoveGrab' xrefstyle='select: title'/> 10239e7bcd65Smrgfunction removes widgets from the modal cascade starting 10249e7bcd65Smrgat the most recent widget up to and including the specified widget. 10259e7bcd65SmrgIt issues a warning if the specified widget is not on the modal cascade. 10269e7bcd65Smrg</para> 10279e7bcd65Smrg<sect2 id="Requesting_Key_and_Button_Grabs"> 10289e7bcd65Smrg<title>Requesting Key and Button Grabs</title> 10299e7bcd65Smrg<para> 10309e7bcd65SmrgThe Intrinsics provide a set of key and button grab interfaces that 10319e7bcd65Smrgare parallel to those provided by Xlib and that allow the Intrinsics 10329e7bcd65Smrgto modify event dispatching when necessary. X Toolkit applications and 10339e7bcd65Smrgwidgets that need to passively grab keys or buttons or actively grab 10349e7bcd65Smrgthe keyboard or pointer should use the 10359e7bcd65Smrgfollowing Intrinsics routines rather than the corresponding Xlib 10369e7bcd65Smrgroutines. 10379e7bcd65Smrg</para> 10389e7bcd65Smrg 10399e7bcd65Smrg<para> 10409e7bcd65SmrgTo passively grab a single key of the keyboard, use 10419e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/>. 10429e7bcd65Smrg</para> 10439e7bcd65Smrg 10449e7bcd65Smrg<funcsynopsis id='XtGrabKey'> 10459e7bcd65Smrg<funcprototype> 10469e7bcd65Smrg<funcdef>void <function>XtGrabKey</function></funcdef> 10479e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 10489e7bcd65Smrg <paramdef>KeyCode <parameter>keycode</parameter></paramdef> 10499e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 10509e7bcd65Smrg <paramdef>Boolean <parameter>owner_events</parameter></paramdef> 10519e7bcd65Smrg <paramdef>int <parameter>pointer_mode</parameter></paramdef> 10520568f49bSmrg <paramdef>int <parameter>keyboard_mode</parameter></paramdef> 10539e7bcd65Smrg</funcprototype> 10549e7bcd65Smrg</funcsynopsis> 10559e7bcd65Smrg 10569e7bcd65Smrg<variablelist> 10579e7bcd65Smrg <varlistentry> 10589e7bcd65Smrg <term> 10599e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 10609e7bcd65Smrg </term> 10619e7bcd65Smrg <listitem> 10629e7bcd65Smrg <para> 10639e7bcd65SmrgSpecifies the widget in whose window the key is to be grabbed. Must be of class Core or any subclass thereof. 10649e7bcd65Smrg </para> 10659e7bcd65Smrg </listitem> 10669e7bcd65Smrg </varlistentry> 10679e7bcd65Smrg <varlistentry> 10689e7bcd65Smrg <term> 10699e7bcd65Smrg <emphasis remap='I'>keycode</emphasis> 10709e7bcd65Smrg </term> 10719e7bcd65Smrg <term> 10729e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 10739e7bcd65Smrg </term> 10749e7bcd65Smrg <term> 10759e7bcd65Smrg <emphasis remap='I'>owner_events</emphasis> 10769e7bcd65Smrg </term> 10779e7bcd65Smrg <term> 10789e7bcd65Smrg <emphasis remap='I'>pointer_mode</emphasis> 10799e7bcd65Smrg </term> 10809e7bcd65Smrg <term> 10819e7bcd65Smrg <emphasis remap='I'>keyboard_mode</emphasis> 10829e7bcd65Smrg </term> 10839e7bcd65Smrg <listitem> 10849e7bcd65Smrg <para> 10859e7bcd65SmrgSpecify arguments to 10869e7bcd65Smrg<function>XGrabKey</function>; 10879e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Keyboard_Grabbing'>Section 12.2</olink> 10880568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 10899e7bcd65Smrg 10909e7bcd65Smrg </para> 10919e7bcd65Smrg </listitem> 10929e7bcd65Smrg </varlistentry> 10939e7bcd65Smrg</variablelist> 10949e7bcd65Smrg 10959e7bcd65Smrg<para> 10969e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 10979e7bcd65Smrgcalls 10989e7bcd65Smrg<function>XGrabKey</function> 10999e7bcd65Smrgspecifying the widget's window as the grab 11009e7bcd65Smrgwindow if the widget is realized. The remaining arguments are exactly 11019e7bcd65Smrgas for 11029e7bcd65Smrg<function>XGrabKey</function>. 11039e7bcd65SmrgIf the widget is not realized, or is later unrealized, the call to 11049e7bcd65Smrg<function>XGrabKey</function> 11059e7bcd65Smrgis performed (again) when 11069e7bcd65Smrgthe widget is realized and its window becomes mapped. In the future, 11079e7bcd65Smrgif 11089e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 11099e7bcd65Smrgis called with a 11109e7bcd65Smrg<function>KeyPress</function> 11119e7bcd65Smrgevent matching the specified keycode and modifiers (which may be 11129e7bcd65Smrg<function>AnyKey</function> 11139e7bcd65Smrgor 11149e7bcd65Smrg<function>AnyModifier</function>, 11159e7bcd65Smrgrespectively) for the 11169e7bcd65Smrgwidget's window, the Intrinsics will call 11179e7bcd65Smrg<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/> 11189e7bcd65Smrgwith the timestamp from the 11199e7bcd65Smrg<function>KeyPress</function> 11209e7bcd65Smrgevent if either of the following conditions is true: 11219e7bcd65Smrg</para> 11229e7bcd65Smrg<itemizedlist spacing='compact'> 11239e7bcd65Smrg <listitem> 11249e7bcd65Smrg <para> 11259e7bcd65SmrgThere is a modal cascade and the widget is not in 11269e7bcd65Smrgthe active subset of the cascade and the keyboard was not previously 11279e7bcd65Smrggrabbed, or 11289e7bcd65Smrg </para> 11299e7bcd65Smrg </listitem> 11309e7bcd65Smrg <listitem> 11319e7bcd65Smrg <para> 11329e7bcd65Smrg<function>XFilterEvent</function> 11339e7bcd65Smrgreturns 11349e7bcd65Smrg<function>True</function>. 11359e7bcd65Smrg </para> 11369e7bcd65Smrg </listitem> 11379e7bcd65Smrg</itemizedlist> 11389e7bcd65Smrg<para> 11399e7bcd65SmrgTo cancel a passive key grab, use 11409e7bcd65Smrg<xref linkend='XtUngrabKey' xrefstyle='select: title'/>. 11419e7bcd65Smrg</para> 11429e7bcd65Smrg 11439e7bcd65Smrg<funcsynopsis id='XtUngrabKey'> 11449e7bcd65Smrg<funcprototype> 11459e7bcd65Smrg<funcdef>void <function>XtUngrabKey</function></funcdef> 11469e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 11479e7bcd65Smrg <paramdef>KeyCode <parameter>keycode</parameter></paramdef> 11489e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 11499e7bcd65Smrg</funcprototype> 11509e7bcd65Smrg</funcsynopsis> 11519e7bcd65Smrg 11529e7bcd65Smrg<variablelist> 11539e7bcd65Smrg <varlistentry> 11549e7bcd65Smrg <term> 11559e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 11569e7bcd65Smrg </term> 11579e7bcd65Smrg <listitem> 11589e7bcd65Smrg <para> 11599e7bcd65SmrgSpecifies the widget in whose window the key was grabbed. 11609e7bcd65Smrg </para> 11619e7bcd65Smrg </listitem> 11629e7bcd65Smrg </varlistentry> 11639e7bcd65Smrg <varlistentry> 11649e7bcd65Smrg <term> 11659e7bcd65Smrg <emphasis remap='I'>keycode</emphasis> 11669e7bcd65Smrg </term> 11679e7bcd65Smrg <term> 11689e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 11699e7bcd65Smrg </term> 11709e7bcd65Smrg <listitem> 11719e7bcd65Smrg <para> 11729e7bcd65SmrgSpecify arguments to 11739e7bcd65Smrg<function>XUngrabKey</function>; 11749e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Keyboard_Grabbing'>Section 12.2</olink> 11750568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 11769e7bcd65Smrg </para> 11779e7bcd65Smrg </listitem> 11789e7bcd65Smrg </varlistentry> 11799e7bcd65Smrg</variablelist> 11809e7bcd65Smrg 11819e7bcd65Smrg<para> 11829e7bcd65SmrgThe 11839e7bcd65Smrg<xref linkend='XtUngrabKey' xrefstyle='select: title'/> 11849e7bcd65Smrgprocedure calls 11859e7bcd65Smrg<function>XUngrabKey</function> 11869e7bcd65Smrgspecifying the widget's 11879e7bcd65Smrgwindow as the ungrab window if the widget is realized. The remaining 11889e7bcd65Smrgarguments are exactly as for 11899e7bcd65Smrg<function>XUngrabKey</function>. 11909e7bcd65SmrgIf the widget is not realized, 11919e7bcd65Smrg<xref linkend='XtUngrabKey' xrefstyle='select: title'/> 11929e7bcd65Smrgremoves a deferred 11939e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 11949e7bcd65Smrgrequest, if any, for the specified widget, keycode, and modifiers. 11959e7bcd65Smrg</para> 11969e7bcd65Smrg 11979e7bcd65Smrg<para> 11989e7bcd65SmrgTo actively grab the keyboard, use 11999e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/>. 12009e7bcd65Smrg</para> 12019e7bcd65Smrg 12029e7bcd65Smrg<funcsynopsis id='XtGrabKeyboard'> 12039e7bcd65Smrg<funcprototype> 12049e7bcd65Smrg<funcdef>int <function>XtGrabKeyboard</function></funcdef> 12059e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 12069e7bcd65Smrg <paramdef>Boolean <parameter>owner_events</parameter></paramdef> 12079e7bcd65Smrg <paramdef>int <parameter>pointer_mode</parameter></paramdef> 12080568f49bSmrg <paramdef>int <parameter>keyboard_mode</parameter></paramdef> 12099e7bcd65Smrg <paramdef>Time <parameter>time</parameter></paramdef> 12109e7bcd65Smrg</funcprototype> 12119e7bcd65Smrg</funcsynopsis> 12129e7bcd65Smrg 12139e7bcd65Smrg<variablelist> 12149e7bcd65Smrg <varlistentry> 12159e7bcd65Smrg <term> 12169e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 12179e7bcd65Smrg </term> 12189e7bcd65Smrg <listitem> 12199e7bcd65Smrg <para> 12209e7bcd65SmrgSpecifies the widget for whose window the keyboard is to be grabbed. 12219e7bcd65SmrgMust be of class Core or any subclass thereof. 12229e7bcd65Smrg </para> 12239e7bcd65Smrg </listitem> 12249e7bcd65Smrg </varlistentry> 12259e7bcd65Smrg <varlistentry> 12269e7bcd65Smrg <term> 12279e7bcd65Smrg <emphasis remap='I'>owner_events</emphasis> 12289e7bcd65Smrg </term> 12299e7bcd65Smrg <term> 12309e7bcd65Smrg <emphasis remap='I'>pointer_mode</emphasis> 12319e7bcd65Smrg </term> 12329e7bcd65Smrg <term> 12339e7bcd65Smrg <emphasis remap='I'>keyboard_mode</emphasis> 12349e7bcd65Smrg </term> 12359e7bcd65Smrg <term> 12369e7bcd65Smrg <emphasis remap='I'>time</emphasis> 12379e7bcd65Smrg </term> 12389e7bcd65Smrg <listitem> 12399e7bcd65Smrg <para> 12409e7bcd65SmrgSpecify arguments to 12419e7bcd65Smrg<function>XGrabKeyboard</function>; 12429e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Keyboard_Grabbing'>Section 12.2</olink> 12430568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 12449e7bcd65Smrg </para> 12459e7bcd65Smrg </listitem> 12469e7bcd65Smrg </varlistentry> 12479e7bcd65Smrg</variablelist> 12489e7bcd65Smrg 12499e7bcd65Smrg<para> 12509e7bcd65SmrgIf the specified widget is realized, 12519e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/> 12529e7bcd65Smrgcalls 12539e7bcd65Smrg<function>XGrabKeyboard</function> 12549e7bcd65Smrgspecifying the widget's window as the grab window. The remaining 12559e7bcd65Smrgarguments and return value are exactly as for 12569e7bcd65Smrg<function>XGrabKeyboard</function>. 12579e7bcd65SmrgIf the widget is not realized, 12589e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/> 12599e7bcd65Smrgimmediately returns 12609e7bcd65Smrg<function>GrabNotViewable</function>. 12619e7bcd65SmrgNo future automatic ungrab is implied by 12629e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/>. 12639e7bcd65Smrg</para> 12649e7bcd65Smrg 12659e7bcd65Smrg<para> 12669e7bcd65SmrgTo cancel an active keyboard grab, use 12679e7bcd65Smrg<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/>. 12689e7bcd65Smrg</para> 12699e7bcd65Smrg 12709e7bcd65Smrg<funcsynopsis id='XtUngrabKeyboard'> 12719e7bcd65Smrg<funcprototype> 12729e7bcd65Smrg<funcdef>void <function>XtUngrabKeyboard</function></funcdef> 12739e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 12749e7bcd65Smrg <paramdef>Time <parameter>time</parameter></paramdef> 12759e7bcd65Smrg</funcprototype> 12769e7bcd65Smrg</funcsynopsis> 12779e7bcd65Smrg 12789e7bcd65Smrg<variablelist> 12799e7bcd65Smrg <varlistentry> 12809e7bcd65Smrg <term> 12819e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 12829e7bcd65Smrg </term> 12839e7bcd65Smrg <listitem> 12849e7bcd65Smrg <para> 12859e7bcd65SmrgSpecifies the widget that has the active keyboard grab. 12869e7bcd65Smrg </para> 12879e7bcd65Smrg </listitem> 12889e7bcd65Smrg </varlistentry> 12899e7bcd65Smrg <varlistentry> 12909e7bcd65Smrg <term> 12919e7bcd65Smrg <emphasis remap='I'>time</emphasis> 12929e7bcd65Smrg </term> 12939e7bcd65Smrg <listitem> 12949e7bcd65Smrg <para> 12959e7bcd65SmrgSpecifies the additional argument to 12969e7bcd65Smrg<function>XUngrabKeyboard</function>; 12979e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Keyboard_Grabbing'>Section 12.2</olink> 12980568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 12999e7bcd65Smrg </para> 13009e7bcd65Smrg </listitem> 13019e7bcd65Smrg </varlistentry> 13029e7bcd65Smrg</variablelist> 13039e7bcd65Smrg 13049e7bcd65Smrg<para> 13059e7bcd65Smrg<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/> 13069e7bcd65Smrgcalls 13079e7bcd65Smrg<function>XUngrabKeyboard</function> 13089e7bcd65Smrgwith the specified time. 13099e7bcd65Smrg</para> 13109e7bcd65Smrg 13119e7bcd65Smrg<para> 13129e7bcd65SmrgTo passively grab a single pointer button, use 13139e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/>. 13149e7bcd65Smrg</para> 13159e7bcd65Smrg 13169e7bcd65Smrg<funcsynopsis id='XtGrabButton'> 13179e7bcd65Smrg<funcprototype> 13189e7bcd65Smrg<funcdef>void <function>XtGrabButton</function></funcdef> 13199e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 13209e7bcd65Smrg <paramdef>int <parameter>button</parameter></paramdef> 13219e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 13229e7bcd65Smrg <paramdef>Boolean <parameter>owner_events</parameter></paramdef> 13239e7bcd65Smrg <paramdef>unsigned int <parameter>event_mask</parameter></paramdef> 13249e7bcd65Smrg <paramdef>int <parameter>pointer_mode</parameter></paramdef> 13250568f49bSmrg <paramdef>int <parameter>keyboard_mode</parameter></paramdef> 13269e7bcd65Smrg <paramdef>Window <parameter>confine_to</parameter></paramdef> 13279e7bcd65Smrg <paramdef>Cursor <parameter>cursor</parameter></paramdef> 13289e7bcd65Smrg</funcprototype> 13299e7bcd65Smrg</funcsynopsis> 13309e7bcd65Smrg 13319e7bcd65Smrg<variablelist> 13329e7bcd65Smrg <varlistentry> 13339e7bcd65Smrg <term> 13349e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 13359e7bcd65Smrg </term> 13369e7bcd65Smrg <listitem> 13379e7bcd65Smrg <para> 13389e7bcd65SmrgSpecifies the widget in whose window the button is to be grabbed. Must be of class Core or any subclass thereof. 13399e7bcd65Smrg </para> 13409e7bcd65Smrg </listitem> 13419e7bcd65Smrg </varlistentry> 13429e7bcd65Smrg <varlistentry> 13439e7bcd65Smrg <term> 13449e7bcd65Smrg <emphasis remap='I'>button</emphasis> 13459e7bcd65Smrg </term> 13469e7bcd65Smrg <term> 13479e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 13489e7bcd65Smrg </term> 13499e7bcd65Smrg <term> 13509e7bcd65Smrg <emphasis remap='I'>owner_events</emphasis> 13519e7bcd65Smrg </term> 13529e7bcd65Smrg <term> 13539e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 13549e7bcd65Smrg </term> 13559e7bcd65Smrg <term> 13569e7bcd65Smrg <emphasis remap='I'>pointer_mode</emphasis> 13579e7bcd65Smrg </term> 13589e7bcd65Smrg <term> 13599e7bcd65Smrg <emphasis remap='I'>keyboard_mode</emphasis> 13609e7bcd65Smrg </term> 13619e7bcd65Smrg <term> 13629e7bcd65Smrg <emphasis remap='I'>confine_to</emphasis> 13639e7bcd65Smrg </term> 13649e7bcd65Smrg <term> 13659e7bcd65Smrg <emphasis remap='I'>cursor</emphasis> 13669e7bcd65Smrg </term> 13679e7bcd65Smrg <listitem> 13689e7bcd65Smrg <para> 13699e7bcd65SmrgSpecify arguments to 13709e7bcd65Smrg<function>XGrabButton</function>; 13719e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Pointer_Grabbing'>Section 12.1</olink> 13720568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 13739e7bcd65Smrg </para> 13749e7bcd65Smrg </listitem> 13759e7bcd65Smrg </varlistentry> 13769e7bcd65Smrg</variablelist> 13779e7bcd65Smrg 13789e7bcd65Smrg<para> 13799e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/> 13809e7bcd65Smrgcalls 13819e7bcd65Smrg<function>XGrabButton</function> 13829e7bcd65Smrgspecifying the widget's window as the 13839e7bcd65Smrggrab window if the widget is realized. The remaining arguments are 13849e7bcd65Smrgexactly as for 13859e7bcd65Smrg<function>XGrabButton</function>. 13869e7bcd65SmrgIf the widget is not realized, or is later unrealized, the call to 13879e7bcd65Smrg<function>XGrabButton</function> 13889e7bcd65Smrgis performed (again) 13899e7bcd65Smrgwhen the widget is realized and its window becomes mapped. In the 13909e7bcd65Smrgfuture, if 13919e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 13929e7bcd65Smrgis called with a 13939e7bcd65Smrg<function>ButtonPress</function> 13949e7bcd65Smrgevent matching the specified button and modifiers (which may be 13959e7bcd65Smrg<function>AnyButton</function> 13969e7bcd65Smrgor 13979e7bcd65Smrg<function>AnyModifier</function>, 13989e7bcd65Smrgrespectively) 13999e7bcd65Smrgfor the widget's window, the Intrinsics will call 14009e7bcd65Smrg<xref linkend='XtUngrabPointer' xrefstyle='select: title'/> 14019e7bcd65Smrgwith the timestamp from the 14029e7bcd65Smrg<function>ButtonPress</function> 14039e7bcd65Smrgevent if either of the following conditions is true: 14049e7bcd65Smrg</para> 14059e7bcd65Smrg<itemizedlist spacing='compact'> 14069e7bcd65Smrg <listitem> 14079e7bcd65Smrg <para> 14089e7bcd65SmrgThere is a modal cascade and the 14099e7bcd65Smrgwidget is not in the active subset of the cascade and the pointer was 14109e7bcd65Smrgnot previously grabbed, or 14119e7bcd65Smrg </para> 14129e7bcd65Smrg </listitem> 14139e7bcd65Smrg <listitem> 14149e7bcd65Smrg <para> 14159e7bcd65Smrg<function>XFilterEvent</function> 14169e7bcd65Smrgreturns 14179e7bcd65Smrg<function>True</function>. 14189e7bcd65Smrg </para> 14199e7bcd65Smrg </listitem> 14209e7bcd65Smrg</itemizedlist> 14219e7bcd65Smrg<para> 14229e7bcd65SmrgTo cancel a passive button grab, use 14239e7bcd65Smrg<xref linkend='XtUngrabButton' xrefstyle='select: title'/>. 14249e7bcd65Smrg</para> 14259e7bcd65Smrg 14269e7bcd65Smrg<funcsynopsis id='XtUngrabButton'> 14279e7bcd65Smrg<funcprototype> 14289e7bcd65Smrg<funcdef>void <function>XtUngrabButton</function></funcdef> 14299e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 14309e7bcd65Smrg <paramdef>unsigned int <parameter>button</parameter></paramdef> 14319e7bcd65Smrg <paramdef>Modifiers <parameter>modifiers</parameter></paramdef> 14329e7bcd65Smrg</funcprototype> 14339e7bcd65Smrg</funcsynopsis> 14349e7bcd65Smrg 14359e7bcd65Smrg<variablelist> 14369e7bcd65Smrg <varlistentry> 14379e7bcd65Smrg <term> 14389e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 14399e7bcd65Smrg </term> 14409e7bcd65Smrg <listitem> 14419e7bcd65Smrg <para> 14429e7bcd65SmrgSpecifies the widget in whose window the button was grabbed. 14439e7bcd65Smrg </para> 14449e7bcd65Smrg </listitem> 14459e7bcd65Smrg </varlistentry> 14469e7bcd65Smrg <varlistentry> 14479e7bcd65Smrg <term> 14489e7bcd65Smrg <emphasis remap='I'>button</emphasis> 14499e7bcd65Smrg </term> 14509e7bcd65Smrg <term> 14519e7bcd65Smrg <emphasis remap='I'>modifiers</emphasis> 14529e7bcd65Smrg </term> 14539e7bcd65Smrg <listitem> 14549e7bcd65Smrg <para> 14559e7bcd65SmrgSpecify arguments to 14569e7bcd65Smrg<function>XUngrabButton</function>; 14579e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Pointer_Grabbing'>Section 12.1</olink> 14580568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 14599e7bcd65Smrg </para> 14609e7bcd65Smrg </listitem> 14619e7bcd65Smrg </varlistentry> 14629e7bcd65Smrg</variablelist> 14639e7bcd65Smrg 14649e7bcd65Smrg<para> 14659e7bcd65SmrgThe 14669e7bcd65Smrg<xref linkend='XtUngrabButton' xrefstyle='select: title'/> 14679e7bcd65Smrgprocedure calls 14689e7bcd65Smrg<function>XUngrabButton</function> 14699e7bcd65Smrgspecifying the 14709e7bcd65Smrgwidget's window as the ungrab window if the widget is realized. The 14719e7bcd65Smrgremaining arguments are exactly as for 14729e7bcd65Smrg<function>XUngrabButton</function>. 14739e7bcd65SmrgIf the widget is not realized, 14749e7bcd65Smrg<xref linkend='XtUngrabButton' xrefstyle='select: title'/> 14759e7bcd65Smrgremoves a deferred 14769e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/> 14779e7bcd65Smrgrequest, if any, for the specified widget, button, and modifiers. 14789e7bcd65Smrg</para> 14799e7bcd65Smrg 14809e7bcd65Smrg<para> 14819e7bcd65SmrgTo actively grab the pointer, use 14829e7bcd65Smrg<xref linkend='XtGrabPointer' xrefstyle='select: title'/>. 14839e7bcd65Smrg</para> 14849e7bcd65Smrg 14859e7bcd65Smrg<funcsynopsis id='XtGrabPointer'> 14869e7bcd65Smrg<funcprototype> 14879e7bcd65Smrg<funcdef>int <function>XtGrabPointer</function></funcdef> 14889e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 14899e7bcd65Smrg <paramdef>Boolean <parameter>owner_events</parameter></paramdef> 14909e7bcd65Smrg <paramdef>unsigned int <parameter>event_mask</parameter></paramdef> 14919e7bcd65Smrg <paramdef>int <parameter>pointer_mode</parameter></paramdef> 14920568f49bSmrg <paramdef>int <parameter>keyboard_mode</parameter></paramdef> 14939e7bcd65Smrg <paramdef>Window <parameter>confine_to</parameter></paramdef> 14949e7bcd65Smrg <paramdef>Cursor <parameter>cursor</parameter></paramdef> 14959e7bcd65Smrg <paramdef>Time <parameter>time</parameter></paramdef> 14969e7bcd65Smrg</funcprototype> 14979e7bcd65Smrg</funcsynopsis> 14989e7bcd65Smrg 14999e7bcd65Smrg<variablelist> 15009e7bcd65Smrg <varlistentry> 15019e7bcd65Smrg <term> 15029e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 15039e7bcd65Smrg </term> 15049e7bcd65Smrg <listitem> 15059e7bcd65Smrg <para> 15069e7bcd65SmrgSpecifies the widget for whose window the pointer is to be grabbed. Must be of class Core or any subclass thereof. 15079e7bcd65Smrg </para> 15089e7bcd65Smrg </listitem> 15099e7bcd65Smrg </varlistentry> 15109e7bcd65Smrg <varlistentry> 15119e7bcd65Smrg <term> 15129e7bcd65Smrg <emphasis remap='I'>owner_events</emphasis> 15139e7bcd65Smrg </term> 15149e7bcd65Smrg <term> 15159e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 15169e7bcd65Smrg </term> 15179e7bcd65Smrg <term> 15189e7bcd65Smrg <emphasis remap='I'>pointer_mode</emphasis> 15199e7bcd65Smrg </term> 15209e7bcd65Smrg <term> 15219e7bcd65Smrg <emphasis remap='I'>keyboard_mode</emphasis> 15229e7bcd65Smrg </term> 15239e7bcd65Smrg <term> 15249e7bcd65Smrg <emphasis remap='I'>confine_to</emphasis> 15259e7bcd65Smrg </term> 15269e7bcd65Smrg <term> 15279e7bcd65Smrg <emphasis remap='I'>cursor</emphasis> 15289e7bcd65Smrg </term> 15299e7bcd65Smrg <term> 15309e7bcd65Smrg <emphasis remap='I'>time</emphasis> 15319e7bcd65Smrg </term> 15329e7bcd65Smrg <listitem> 15339e7bcd65Smrg <para> 15349e7bcd65SmrgSpecify arguments to 15359e7bcd65Smrg<function>XGrabPointer</function>; 15369e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Pointer_Grabbing'>Section 12.1</olink> 15370568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 15389e7bcd65Smrg </para> 15399e7bcd65Smrg </listitem> 15409e7bcd65Smrg </varlistentry> 15419e7bcd65Smrg</variablelist> 15429e7bcd65Smrg 15439e7bcd65Smrg<para> 15449e7bcd65SmrgIf the specified widget is realized, 15459e7bcd65Smrg<xref linkend='XtGrabPointer' xrefstyle='select: title'/> 15469e7bcd65Smrgcalls 15479e7bcd65Smrg<function>XGrabPointer</function>, 15489e7bcd65Smrgspecifying the widget's window as the grab window. The remaining 15499e7bcd65Smrgarguments and return value are exactly as for 15509e7bcd65Smrg<function>XGrabPointer</function>. 15519e7bcd65SmrgIf the widget is not realized, 15529e7bcd65Smrg<xref linkend='XtGrabPointer' xrefstyle='select: title'/> 15539e7bcd65Smrgimmediately returns 15549e7bcd65Smrg<function>GrabNotViewable</function>. 15559e7bcd65SmrgNo future automatic ungrab is implied by 15569e7bcd65Smrg<xref linkend='XtGrabPointer' xrefstyle='select: title'/>. 15579e7bcd65Smrg</para> 15589e7bcd65Smrg 15599e7bcd65Smrg<para> 15609e7bcd65SmrgTo cancel an active pointer grab, use 15619e7bcd65Smrg<xref linkend='XtUngrabPointer' xrefstyle='select: title'/>. 15629e7bcd65Smrg</para> 15639e7bcd65Smrg 15649e7bcd65Smrg<funcsynopsis id='XtUngrabPointer'> 15659e7bcd65Smrg<funcprototype> 15669e7bcd65Smrg<funcdef>void <function>XtUngrabPointer</function></funcdef> 15679e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 15689e7bcd65Smrg <paramdef>Time <parameter>time</parameter></paramdef> 15699e7bcd65Smrg</funcprototype> 15709e7bcd65Smrg</funcsynopsis> 15719e7bcd65Smrg 15729e7bcd65Smrg<variablelist> 15739e7bcd65Smrg <varlistentry> 15749e7bcd65Smrg <term> 15759e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 15769e7bcd65Smrg </term> 15779e7bcd65Smrg <listitem> 15789e7bcd65Smrg <para> 15799e7bcd65SmrgSpecifies the widget that has the active pointer grab. 15809e7bcd65Smrg </para> 15819e7bcd65Smrg </listitem> 15829e7bcd65Smrg </varlistentry> 15839e7bcd65Smrg <varlistentry> 15849e7bcd65Smrg <term> 15859e7bcd65Smrg <emphasis remap='I'>time</emphasis> 15869e7bcd65Smrg </term> 15879e7bcd65Smrg <listitem> 15889e7bcd65Smrg <para> 15899e7bcd65SmrgSpecifies the time argument to 15909e7bcd65Smrg<function>XUngrabPointer</function>; 15919e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Pointer_Grabbing'>Section 12.1</olink> 15920568f49bSmrgin <olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 15939e7bcd65Smrg </para> 15949e7bcd65Smrg </listitem> 15959e7bcd65Smrg </varlistentry> 15969e7bcd65Smrg</variablelist> 15979e7bcd65Smrg 15989e7bcd65Smrg<para> 15999e7bcd65Smrg<xref linkend='XtUngrabPointer' xrefstyle='select: title'/> 16009e7bcd65Smrgcalls 16019e7bcd65Smrg<function>XUngrabPointer</function> 16029e7bcd65Smrgwith the specified time. 16039e7bcd65Smrg</para> 16049e7bcd65Smrg</sect2> 16059e7bcd65Smrg</sect1> 16069e7bcd65Smrg 16079e7bcd65Smrg<sect1 id="Focusing_Events_on_a_Child"> 16089e7bcd65Smrg<title>Focusing Events on a Child</title> 16099e7bcd65Smrg<para> 16109e7bcd65SmrgTo redirect keyboard input to a normal descendant of a 16119e7bcd65Smrgwidget without calling 16129e7bcd65Smrg<function>XSetInputFocus</function>, 16139e7bcd65Smrguse 16149e7bcd65Smrg<xref linkend='XtSetKeyboardFocus' xrefstyle='select: title'/>. 16159e7bcd65Smrg</para> 16169e7bcd65Smrg 16179e7bcd65Smrg<funcsynopsis id='XtSetKeyboardFocus'> 16189e7bcd65Smrg<funcprototype> 16199e7bcd65Smrg<funcdef>void <function>XtSetKeyboardFocus</function></funcdef> 16209e7bcd65Smrg <paramdef>Widget <parameter>subtree</parameter></paramdef> 16210568f49bSmrg <paramdef>Widget <parameter>descendent</parameter></paramdef> 16229e7bcd65Smrg</funcprototype> 16239e7bcd65Smrg</funcsynopsis> 16249e7bcd65Smrg 16259e7bcd65Smrg<variablelist> 16269e7bcd65Smrg <varlistentry> 16279e7bcd65Smrg <term> 16289e7bcd65Smrg <emphasis remap='I'>subtree</emphasis> 16299e7bcd65Smrg </term> 16309e7bcd65Smrg <listitem> 16319e7bcd65Smrg <para> 16329e7bcd65SmrgSpecifies the subtree of the hierarchy for which the keyboard focus is 16339e7bcd65Smrgto be set. Must be of class Core or any subclass thereof. 16349e7bcd65Smrg </para> 16359e7bcd65Smrg </listitem> 16369e7bcd65Smrg </varlistentry> 16379e7bcd65Smrg <varlistentry> 16389e7bcd65Smrg <term> 16399e7bcd65Smrg <emphasis remap='I'>descendant</emphasis> 16409e7bcd65Smrg </term> 16419e7bcd65Smrg <listitem> 16429e7bcd65Smrg <para> 16439e7bcd65SmrgSpecifies either the normal (non-pop-up) descendant of <emphasis remap='I'>subtree</emphasis> to which 16449e7bcd65Smrgkeyboard events are logically directed, or 16459e7bcd65Smrg<function>None</function>. 16469e7bcd65SmrgIt is not an error to specify 16479e7bcd65Smrg<function>None</function> 16489e7bcd65Smrgwhen no input focus was previously set. Must be of class Object or any subclass thereof. 16499e7bcd65Smrg </para> 16509e7bcd65Smrg </listitem> 16519e7bcd65Smrg </varlistentry> 16529e7bcd65Smrg</variablelist> 16539e7bcd65Smrg 16549e7bcd65Smrg<para> 16559e7bcd65Smrg<xref linkend='XtSetKeyboardFocus' xrefstyle='select: title'/> 16569e7bcd65Smrgcauses 16579e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 16589e7bcd65Smrgto remap keyboard events occurring within the specified subtree 16599e7bcd65Smrgand dispatch them to the specified descendant widget or to an ancestor. 16609e7bcd65SmrgIf the descendant's class is not a subclass of Core, the descendant is 16619e7bcd65Smrgreplaced by its closest windowed ancestor. 16629e7bcd65Smrg</para> 16639e7bcd65Smrg 16649e7bcd65Smrg<para> 16659e7bcd65SmrgWhen there is no modal cascade, keyboard events can be dispatched 16669e7bcd65Smrgto a widget in one of five ways. Assume the server delivered the 16679e7bcd65Smrgevent to the window for widget E (because of X input focus, key or 16689e7bcd65Smrgkeyboard grabs, or pointer position). 16699e7bcd65Smrg</para> 16709e7bcd65Smrg<itemizedlist spacing='compact'> 16719e7bcd65Smrg <listitem> 16729e7bcd65Smrg <para> 16739e7bcd65SmrgIf neither E nor any of E's ancestors have redirected the keyboard 16749e7bcd65Smrgfocus, or if the event activated a grab for E as specified by a call 16759e7bcd65Smrgto 16769e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 16779e7bcd65Smrgwith any value of <emphasis remap='I'>owner_events</emphasis>, or 16789e7bcd65Smrgif the keyboard is actively grabbed by E with <emphasis remap='I'>owner_events</emphasis> 16799e7bcd65Smrg<function>False</function> 16809e7bcd65Smrgvia 16819e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/> 16829e7bcd65Smrgor 16839e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 16849e7bcd65Smrgon a previous key press, the event is dispatched to E. 16859e7bcd65Smrg </para> 16869e7bcd65Smrg </listitem> 16879e7bcd65Smrg <listitem> 16889e7bcd65Smrg <para> 16899e7bcd65SmrgBeginning with the ancestor of E closest to the root that has 16909e7bcd65Smrgredirected the keyboard focus or E if no such ancestor exists, if 16919e7bcd65Smrgthe target of that focus redirection has in turn redirected the 16929e7bcd65Smrgkeyboard focus, recursively follow this focus chain to find a widget 16939e7bcd65SmrgF that has not redirected focus. 16949e7bcd65Smrg </para> 16959e7bcd65Smrg </listitem> 16969e7bcd65Smrg <listitem> 16979e7bcd65Smrg <itemizedlist spacing='compact'> 16989e7bcd65Smrg <listitem> 16999e7bcd65Smrg <para> 17009e7bcd65SmrgIf E is the final focus target widget F or a descendant of F, the 17019e7bcd65Smrgevent is dispatched to E. 17029e7bcd65Smrg </para> 17039e7bcd65Smrg </listitem> 17049e7bcd65Smrg <listitem> 17059e7bcd65Smrg <para> 17069e7bcd65SmrgIf E is not F, an ancestor of F, or a descendant of F, and the event 17079e7bcd65Smrgactivated a grab for E as specified by a call to 17089e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 17099e7bcd65Smrgfor E, 17109e7bcd65Smrg<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/> 17119e7bcd65Smrgis called. 17129e7bcd65Smrg </para> 17139e7bcd65Smrg </listitem> 17149e7bcd65Smrg <listitem> 17159e7bcd65Smrg <para> 17169e7bcd65SmrgIf E is an ancestor of F, and the event is a key press, and either 17179e7bcd65Smrg </para> 17189e7bcd65Smrg <itemizedlist spacing='compact'> 17199e7bcd65Smrg <listitem> 17209e7bcd65Smrg <para> 17219e7bcd65SmrgE has grabbed the key with 17229e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 17239e7bcd65Smrgand <emphasis remap='I'>owner_events</emphasis> 17249e7bcd65Smrg<function>False</function>, 17259e7bcd65Smrgor 17269e7bcd65Smrg </para> 17279e7bcd65Smrg </listitem> 17289e7bcd65Smrg <listitem> 17299e7bcd65Smrg <para> 17309e7bcd65SmrgE has grabbed the key with 17319e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 17329e7bcd65Smrgand <emphasis remap='I'>owner_events</emphasis> 17339e7bcd65Smrg<function>True</function>, 17349e7bcd65Smrgand the coordinates of the event are outside the rectangle specified 17359e7bcd65Smrgby E's geometry, 17369e7bcd65Smrgthen the event is dispatched to E. 17379e7bcd65Smrg </para> 17389e7bcd65Smrg </listitem> 17399e7bcd65Smrg </itemizedlist> 17409e7bcd65Smrg </listitem> 17419e7bcd65Smrg <listitem> 17429e7bcd65Smrg <para> 17439e7bcd65SmrgOtherwise, define A as the closest common ancestor of E and F: 17449e7bcd65Smrg </para> 17459e7bcd65Smrg <itemizedlist spacing='compact'> 17469e7bcd65Smrg <listitem> 17479e7bcd65Smrg <para> 17489e7bcd65SmrgIf there is an active keyboard grab for any widget via either 17499e7bcd65Smrg<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/> 17509e7bcd65Smrgor 17519e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 17529e7bcd65Smrgon a previous key press, or 17539e7bcd65Smrgif no widget between F and A (noninclusive) has grabbed 17549e7bcd65Smrgthe key and modifier combination with 17559e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 17569e7bcd65Smrgand any value of <emphasis remap='I'>owner_events</emphasis>, the event is dispatched to F. 17579e7bcd65Smrg </para> 17589e7bcd65Smrg </listitem> 17599e7bcd65Smrg <listitem> 17609e7bcd65Smrg <para> 17619e7bcd65SmrgElse, the event is dispatched to the ancestor of F closest to A 17629e7bcd65Smrgthat has grabbed the key and modifier combination with 17639e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/>. 17649e7bcd65Smrg </para> 17659e7bcd65Smrg </listitem> 17669e7bcd65Smrg </itemizedlist> 17679e7bcd65Smrg </listitem> 17689e7bcd65Smrg </itemizedlist> 17699e7bcd65Smrg </listitem> 17709e7bcd65Smrg</itemizedlist> 17719e7bcd65Smrg<para> 17729e7bcd65SmrgWhen there is a modal cascade, if the final destination widget as 17739e7bcd65Smrgidentified above is in the active subset of the cascade, the event is 17749e7bcd65Smrgdispatched; otherwise the event is remapped to a spring-loaded shell 17759e7bcd65Smrgor discarded. 17769e7bcd65SmrgRegardless of where it is dispatched, the Intrinsics do not modify 17779e7bcd65Smrgthe contents of the event. 17789e7bcd65Smrg</para> 17799e7bcd65Smrg 17809e7bcd65Smrg<para> 17819e7bcd65SmrgWhen <emphasis remap='I'>subtree</emphasis> or one of its descendants acquires the X input focus 17829e7bcd65Smrgor the pointer moves into the subtree such that keyboard events would 17839e7bcd65Smrgnow be delivered to the subtree, a 17849e7bcd65Smrg<function>FocusIn</function> 17859e7bcd65Smrgevent is generated for the descendant if 17869e7bcd65Smrg<function>FocusChange</function> 17879e7bcd65Smrgevents have been selected by the descendant. 17889e7bcd65SmrgSimilarly, when <emphasis remap='I'>subtree</emphasis> loses the X input focus 17899e7bcd65Smrgor the keyboard focus for one of its ancestors, a 17909e7bcd65Smrg<function>FocusOut</function> 17919e7bcd65Smrgevent is generated for descendant if 17929e7bcd65Smrg<function>FocusChange</function> 17939e7bcd65Smrgevents have been selected by the descendant. 17949e7bcd65Smrg</para> 17959e7bcd65Smrg 17969e7bcd65Smrg<para> 17979e7bcd65SmrgA widget tree may also actively manage the X server input focus. To 17989e7bcd65Smrgdo so, a widget class specifies an accept_focus procedure. 17999e7bcd65Smrg</para> 18009e7bcd65Smrg 18019e7bcd65Smrg<para> 18029e7bcd65SmrgThe accept_focus procedure pointer is of type 18039e7bcd65Smrg<xref linkend='XtAcceptFocusProc' xrefstyle='select: title'/>. 18049e7bcd65Smrg</para> 18059e7bcd65Smrg 18069e7bcd65Smrg<funcsynopsis id='XtAcceptFocusProc'> 18079e7bcd65Smrg<funcprototype> 18080568f49bSmrg<funcdef>typedef Boolean *<function>XtAcceptFocusProc</function></funcdef> 18099e7bcd65Smrg 18109e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 18119e7bcd65Smrg <paramdef>Time *<parameter>time</parameter></paramdef> 18129e7bcd65Smrg</funcprototype> 18139e7bcd65Smrg</funcsynopsis> 18149e7bcd65Smrg 18159e7bcd65Smrg<variablelist> 18169e7bcd65Smrg <varlistentry> 18179e7bcd65Smrg <term> 18189e7bcd65Smrg <emphasis remap='I'>w</emphasis> 18199e7bcd65Smrg </term> 18209e7bcd65Smrg <listitem> 18219e7bcd65Smrg <para> 18229e7bcd65SmrgSpecifies the widget. 18239e7bcd65Smrg </para> 18249e7bcd65Smrg </listitem> 18259e7bcd65Smrg </varlistentry> 18269e7bcd65Smrg <varlistentry> 18279e7bcd65Smrg <term> 18289e7bcd65Smrg <emphasis remap='I'>time</emphasis> 18299e7bcd65Smrg </term> 18309e7bcd65Smrg <listitem> 18319e7bcd65Smrg <para> 18329e7bcd65SmrgSpecifies the X time of the event causing the accept focus. 18339e7bcd65Smrg </para> 18349e7bcd65Smrg </listitem> 18359e7bcd65Smrg </varlistentry> 18369e7bcd65Smrg</variablelist> 18379e7bcd65Smrg 18389e7bcd65Smrg<para> 18399e7bcd65SmrgWidgets that need the input focus can call 18409e7bcd65Smrg<function>XSetInputFocus</function> 18410568f49bSmrgexplicitly, pursuant to the restrictions of the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>. 18429e7bcd65SmrgTo allow outside agents, such as the parent, 18439e7bcd65Smrgto cause a widget to take the input focus, 18449e7bcd65Smrgevery widget exports an accept_focus procedure. 18459e7bcd65SmrgThe widget returns a value indicating 18469e7bcd65Smrgwhether it actually took the focus or not, 18479e7bcd65Smrgso that the parent can give the focus to another widget. 18489e7bcd65SmrgWidgets that need to know when they lose the input focus must use 18499e7bcd65Smrgthe Xlib focus notification mechanism explicitly 18509e7bcd65Smrg(typically by specifying translations for 18519e7bcd65Smrg<function>FocusIn</function> 18529e7bcd65Smrgand 18539e7bcd65Smrg<function>FocusOut</function> 18549e7bcd65Smrgevents). 18559e7bcd65SmrgWidgets classes that never want the input focus should set the 18569e7bcd65Smrg<emphasis remap='I'>accept_focus</emphasis> field to NULL. 18579e7bcd65Smrg</para> 18589e7bcd65Smrg 18599e7bcd65Smrg<para> 18609e7bcd65SmrgTo call a widget's accept_focus procedure, use 18619e7bcd65Smrg<xref linkend='XtCallAcceptFocus' xrefstyle='select: title'/>. 18629e7bcd65Smrg</para> 18639e7bcd65Smrg 18649e7bcd65Smrg<funcsynopsis id='XtCallAcceptFocus'> 18659e7bcd65Smrg<funcprototype> 18669e7bcd65Smrg<funcdef>Boolean <function>XtCallAcceptFocus</function></funcdef> 18679e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 18689e7bcd65Smrg <paramdef>Time *<parameter>time</parameter></paramdef> 18699e7bcd65Smrg</funcprototype> 18709e7bcd65Smrg</funcsynopsis> 18719e7bcd65Smrg 18729e7bcd65Smrg<variablelist> 18739e7bcd65Smrg <varlistentry> 18749e7bcd65Smrg <term> 18759e7bcd65Smrg <emphasis remap='I'>w</emphasis> 18769e7bcd65Smrg </term> 18779e7bcd65Smrg <listitem> 18789e7bcd65Smrg <para> 18799e7bcd65SmrgSpecifies the widget. Must be of class Core or any subclass thereof. 18809e7bcd65Smrg </para> 18819e7bcd65Smrg </listitem> 18829e7bcd65Smrg </varlistentry> 18839e7bcd65Smrg <varlistentry> 18849e7bcd65Smrg <term> 18859e7bcd65Smrg <emphasis remap='I'>time</emphasis> 18869e7bcd65Smrg </term> 18879e7bcd65Smrg <listitem> 18889e7bcd65Smrg <para> 18899e7bcd65SmrgSpecifies the X time of the event that is causing the focus change. 18909e7bcd65Smrg </para> 18919e7bcd65Smrg </listitem> 18929e7bcd65Smrg </varlistentry> 18939e7bcd65Smrg</variablelist> 18949e7bcd65Smrg 18959e7bcd65Smrg<para> 18969e7bcd65SmrgThe 18979e7bcd65Smrg<xref linkend='XtCallAcceptFocus' xrefstyle='select: title'/> 18989e7bcd65Smrgfunction calls the specified widget's accept_focus procedure, 18999e7bcd65Smrgpassing it the specified widget and time, and returns what the accept_focus 19009e7bcd65Smrgprocedure returns. 19019e7bcd65SmrgIf <emphasis remap='I'>accept_focus</emphasis> is NULL, 19029e7bcd65Smrg<xref linkend='XtCallAcceptFocus' xrefstyle='select: title'/> 19039e7bcd65Smrgreturns 19049e7bcd65Smrg<function>False</function>. 19059e7bcd65Smrg</para> 19069e7bcd65Smrg<sect2 id="Events_for_Drawables_That_Are_Not_a_Widget_s_Window"> 19079e7bcd65Smrg<title>Events for Drawables That Are Not a Widget's Window</title> 19089e7bcd65Smrg<para> 19099e7bcd65SmrgSometimes an application must handle events for drawables that are not 19109e7bcd65Smrgassociated with widgets in its widget tree. Examples include handling 19119e7bcd65Smrg<function>GraphicsExpose</function> 19129e7bcd65Smrgand 19139e7bcd65Smrg<function>NoExpose</function> 19149e7bcd65Smrgevents on Pixmaps, and handling 19159e7bcd65Smrg<function>PropertyNotify</function> 19169e7bcd65Smrgevents on the root window. 19179e7bcd65Smrg</para> 19189e7bcd65Smrg 19199e7bcd65Smrg<para> 19209e7bcd65SmrgTo register a drawable with the Intrinsics event dispatching, use 19219e7bcd65Smrg<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/>. 19229e7bcd65Smrg</para> 19239e7bcd65Smrg 19249e7bcd65Smrg<funcsynopsis id='XtRegisterDrawable'> 19259e7bcd65Smrg<funcprototype> 19269e7bcd65Smrg<funcdef>void <function>XtRegisterDrawable</function></funcdef> 19279e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 19289e7bcd65Smrg <paramdef>Drawable <parameter>drawable</parameter></paramdef> 19299e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 19309e7bcd65Smrg</funcprototype> 19319e7bcd65Smrg</funcsynopsis> 19329e7bcd65Smrg 19339e7bcd65Smrg<variablelist> 19349e7bcd65Smrg <varlistentry> 19359e7bcd65Smrg <term> 19369e7bcd65Smrg <emphasis remap='I'>display</emphasis> 19379e7bcd65Smrg </term> 19389e7bcd65Smrg <listitem> 19399e7bcd65Smrg <para> 19409e7bcd65SmrgSpecifies the drawable's display. 19419e7bcd65Smrg </para> 19429e7bcd65Smrg </listitem> 19439e7bcd65Smrg </varlistentry> 19449e7bcd65Smrg <varlistentry> 19459e7bcd65Smrg <term> 19469e7bcd65Smrg <emphasis remap='I'>drawable</emphasis> 19479e7bcd65Smrg </term> 19489e7bcd65Smrg <listitem> 19499e7bcd65Smrg <para> 19509e7bcd65SmrgSpecifies the drawable to register. 19519e7bcd65Smrg </para> 19529e7bcd65Smrg </listitem> 19539e7bcd65Smrg </varlistentry> 19549e7bcd65Smrg <varlistentry> 19559e7bcd65Smrg <term> 19569e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 19579e7bcd65Smrg </term> 19589e7bcd65Smrg <listitem> 19599e7bcd65Smrg <para> 19609e7bcd65SmrgSpecifies the widget to register the drawable for. 19619e7bcd65Smrg </para> 19629e7bcd65Smrg </listitem> 19639e7bcd65Smrg </varlistentry> 19649e7bcd65Smrg</variablelist> 19659e7bcd65Smrg 19669e7bcd65Smrg<para> 19679e7bcd65Smrg<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/> 19689e7bcd65Smrgassociates the specified drawable with the specified widget 19699e7bcd65Smrgso that future calls to 19709e7bcd65Smrg<xref linkend='XtWindowToWidget' xrefstyle='select: title'/> 19719e7bcd65Smrgwith the drawable will return the widget. 19729e7bcd65SmrgThe default event dispatcher will dispatch future events that 19739e7bcd65Smrgarrive for the drawable to the widget in the same manner as 19749e7bcd65Smrgevents that contain the widget's window. 19759e7bcd65Smrg</para> 19769e7bcd65Smrg 19779e7bcd65Smrg<para> 19789e7bcd65SmrgIf the drawable is already registered with another widget, or if the 19799e7bcd65Smrgdrawable is the window of a widget in the client's widget tree, the 19809e7bcd65Smrgresults of calling 19819e7bcd65Smrg<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/> 19829e7bcd65Smrgare undefined. 19839e7bcd65Smrg</para> 19849e7bcd65Smrg 19859e7bcd65Smrg<para> 19869e7bcd65SmrgTo unregister a drawable with the Intrinsics event dispatching, use 19879e7bcd65Smrg<xref linkend='XtUnregisterDrawable' xrefstyle='select: title'/>. 19889e7bcd65Smrg</para> 19899e7bcd65Smrg 19909e7bcd65Smrg<funcsynopsis id='XtUnregisterDrawable'> 19919e7bcd65Smrg<funcprototype> 19929e7bcd65Smrg<funcdef>void <function>XtUnregisterDrawable</function></funcdef> 19939e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 19949e7bcd65Smrg <paramdef>Drawable <parameter>drawable</parameter></paramdef> 19959e7bcd65Smrg</funcprototype> 19969e7bcd65Smrg</funcsynopsis> 19979e7bcd65Smrg 19989e7bcd65Smrg<variablelist> 19999e7bcd65Smrg <varlistentry> 20009e7bcd65Smrg <term> 20019e7bcd65Smrg <emphasis remap='I'>display</emphasis> 20029e7bcd65Smrg </term> 20039e7bcd65Smrg <listitem> 20049e7bcd65Smrg <para> 20059e7bcd65SmrgSpecifies the drawable's display. 20069e7bcd65Smrg </para> 20079e7bcd65Smrg </listitem> 20089e7bcd65Smrg </varlistentry> 20099e7bcd65Smrg <varlistentry> 20109e7bcd65Smrg <term> 20119e7bcd65Smrg <emphasis remap='I'>drawable</emphasis> 20129e7bcd65Smrg </term> 20139e7bcd65Smrg <listitem> 20149e7bcd65Smrg <para> 20159e7bcd65SmrgSpecifies the drawable to unregister. 20169e7bcd65Smrg </para> 20179e7bcd65Smrg </listitem> 20189e7bcd65Smrg </varlistentry> 20199e7bcd65Smrg</variablelist> 20209e7bcd65Smrg 20219e7bcd65Smrg<para> 20229e7bcd65Smrg<xref linkend='XtUnregisterDrawable' xrefstyle='select: title'/> 20239e7bcd65Smrgremoves an association created with 20249e7bcd65Smrg<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/>. 20259e7bcd65SmrgIf the drawable is the window of a widget in the client's widget tree 20269e7bcd65Smrgthe results of calling 20279e7bcd65Smrg<xref linkend='XtUnregisterDrawable' xrefstyle='select: title'/> 20289e7bcd65Smrgare undefined. 20299e7bcd65Smrg</para> 20309e7bcd65Smrg</sect2> 20319e7bcd65Smrg</sect1> 20329e7bcd65Smrg 20339e7bcd65Smrg<sect1 id="Querying_Event_Sources"> 20349e7bcd65Smrg<title>Querying Event Sources</title> 20359e7bcd65Smrg<para> 20369e7bcd65SmrgThe event manager provides several functions to examine and read events 20379e7bcd65Smrg(including file and timer events) that are in the queue. 20389e7bcd65SmrgThe next three functions are Intrinsics equivalents of the 20399e7bcd65Smrg<function>XPending</function>, 20409e7bcd65Smrg<function>XPeekEvent</function>, 20419e7bcd65Smrgand 20429e7bcd65Smrg<function>XNextEvent</function> 20439e7bcd65SmrgXlib calls. 20449e7bcd65Smrg</para> 20459e7bcd65Smrg 20469e7bcd65Smrg<para> 20479e7bcd65SmrgTo determine if there are any events on the input queue for a given application, 20489e7bcd65Smrguse 20499e7bcd65Smrg<xref linkend='XtAppPending' xrefstyle='select: title'/>. 20509e7bcd65Smrg</para> 20519e7bcd65Smrg 20529e7bcd65Smrg<funcsynopsis id='XtAppPending'> 20539e7bcd65Smrg<funcprototype> 20549e7bcd65Smrg<funcdef>XtInputMask <function>XtAppPending</function></funcdef> 20559e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 20569e7bcd65Smrg</funcprototype> 20579e7bcd65Smrg</funcsynopsis> 20589e7bcd65Smrg 20599e7bcd65Smrg<variablelist> 20609e7bcd65Smrg <varlistentry> 20619e7bcd65Smrg <term> 20629e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 20639e7bcd65Smrg </term> 20649e7bcd65Smrg <listitem> 20659e7bcd65Smrg <para> 20669e7bcd65SmrgSpecifies the application context that identifies the application to check. 20679e7bcd65Smrg </para> 20689e7bcd65Smrg </listitem> 20699e7bcd65Smrg </varlistentry> 20709e7bcd65Smrg</variablelist> 20719e7bcd65Smrg 20729e7bcd65Smrg<para> 20739e7bcd65SmrgThe 20749e7bcd65Smrg<xref linkend='XtAppPending' xrefstyle='select: title'/> 20759e7bcd65Smrgfunction returns a nonzero value if there are 20769e7bcd65Smrgevents pending from the X server, timer pending, other input sources 20779e7bcd65Smrgpending, or signal sources pending. The 20789e7bcd65Smrgvalue returned is a bit mask that is the OR of 20799e7bcd65Smrg<function>XtIMXEvent</function>, 20809e7bcd65Smrg<function>XtIMTimer</function>, 20819e7bcd65Smrg<function>XtIMAlternateInput</function>, 20829e7bcd65Smrgand 20839e7bcd65Smrg<function>XtIMSignal</function> 20849e7bcd65Smrg(see 20859e7bcd65Smrg<function>XtAppProcessEvent ).</function> 20869e7bcd65SmrgIf there are no events pending, 20879e7bcd65Smrg<xref linkend='XtAppPending' xrefstyle='select: title'/> 20889e7bcd65Smrgflushes the output buffers of each Display in the application context 20899e7bcd65Smrgand returns zero. 20909e7bcd65Smrg</para> 20919e7bcd65Smrg 20929e7bcd65Smrg<para> 20939e7bcd65SmrgTo return the event from the head of a given application's input queue 20949e7bcd65Smrgwithout removing input from the queue, use 20959e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/>. 20969e7bcd65Smrg</para> 20979e7bcd65Smrg 20989e7bcd65Smrg<funcsynopsis id='XtAppPeekEvent'> 20999e7bcd65Smrg<funcprototype> 21009e7bcd65Smrg<funcdef>Boolean <function>XtAppPeekEvent</function></funcdef> 21019e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 21029e7bcd65Smrg <paramdef>XEvent *<parameter>event_return</parameter></paramdef> 21039e7bcd65Smrg</funcprototype> 21049e7bcd65Smrg</funcsynopsis> 21059e7bcd65Smrg 21069e7bcd65Smrg<variablelist> 21079e7bcd65Smrg <varlistentry> 21089e7bcd65Smrg <term> 21099e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 21109e7bcd65Smrg </term> 21119e7bcd65Smrg <listitem> 21129e7bcd65Smrg <para> 21139e7bcd65SmrgSpecifies the application context that identifies the application. 21149e7bcd65Smrg </para> 21159e7bcd65Smrg </listitem> 21169e7bcd65Smrg </varlistentry> 21179e7bcd65Smrg <varlistentry> 21189e7bcd65Smrg <term> 21199e7bcd65Smrg <emphasis remap='I'>event_return</emphasis> 21209e7bcd65Smrg </term> 21219e7bcd65Smrg <listitem> 21229e7bcd65Smrg <para> 21239e7bcd65SmrgReturns the event information to the specified event structure. 21249e7bcd65Smrg </para> 21259e7bcd65Smrg </listitem> 21269e7bcd65Smrg </varlistentry> 21279e7bcd65Smrg</variablelist> 21289e7bcd65Smrg 21299e7bcd65Smrg<para> 21309e7bcd65SmrgIf there is an X event in the queue, 21319e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/> 21329e7bcd65Smrgcopies it into <emphasis remap='I'>event_return</emphasis> and returns 21339e7bcd65Smrg<function>True</function>. 21349e7bcd65SmrgIf no X input is on the queue, 21359e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/> 21369e7bcd65Smrgflushes the output buffers of each Display in the application context 21379e7bcd65Smrgand blocks until some input is available 21389e7bcd65Smrg(possibly calling some timeout callbacks in the interim). 21399e7bcd65SmrgIf the next available input is an X event, 21409e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/> 21419e7bcd65Smrgfills in <emphasis remap='I'>event_return</emphasis> and returns 21429e7bcd65Smrg<function>True</function>. 21439e7bcd65SmrgOtherwise, the input is for an input source 21449e7bcd65Smrgregistered with 21459e7bcd65Smrg<xref linkend='XtAppAddInput' xrefstyle='select: title'/>, 21469e7bcd65Smrgand 21479e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/> 21489e7bcd65Smrgreturns 21499e7bcd65Smrg<function>False</function>. 21509e7bcd65SmrgThe sample implementations provides XtAppPeekEvent as described. Timeout callbacks 21519e7bcd65Smrgare called while blocking for input. If some input for an input source is 21529e7bcd65Smrgavailable, 21539e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/> 21549e7bcd65Smrgwill return 21559e7bcd65Smrg<function>True</function> 21569e7bcd65Smrgwithout returning an event. 21579e7bcd65Smrg</para> 21589e7bcd65Smrg 21599e7bcd65Smrg<para> 21609e7bcd65SmrgTo remove and return the event 21619e7bcd65Smrgfrom the head of a given application's X event queue, 21629e7bcd65Smrguse 21639e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/>. 21649e7bcd65Smrg</para> 21659e7bcd65Smrg 21669e7bcd65Smrg<funcsynopsis id='XtAppNextEvent'> 21679e7bcd65Smrg<funcprototype> 21689e7bcd65Smrg<funcdef>void <function>XtAppNextEvent</function></funcdef> 21699e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 21709e7bcd65Smrg <paramdef>XEvent *<parameter>event_return</parameter></paramdef> 21719e7bcd65Smrg</funcprototype> 21729e7bcd65Smrg</funcsynopsis> 21739e7bcd65Smrg 21749e7bcd65Smrg<variablelist> 21759e7bcd65Smrg <varlistentry> 21769e7bcd65Smrg <term> 21779e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 21789e7bcd65Smrg </term> 21799e7bcd65Smrg <listitem> 21809e7bcd65Smrg <para> 21819e7bcd65SmrgSpecifies the application context that identifies the application. 21829e7bcd65Smrg </para> 21839e7bcd65Smrg </listitem> 21849e7bcd65Smrg </varlistentry> 21859e7bcd65Smrg <varlistentry> 21869e7bcd65Smrg <term> 21879e7bcd65Smrg <emphasis remap='I'>event_return</emphasis> 21889e7bcd65Smrg </term> 21899e7bcd65Smrg <listitem> 21909e7bcd65Smrg <para> 21919e7bcd65SmrgReturns the event information to the specified event structure. 21929e7bcd65Smrg </para> 21939e7bcd65Smrg </listitem> 21949e7bcd65Smrg </varlistentry> 21959e7bcd65Smrg</variablelist> 21969e7bcd65Smrg 21979e7bcd65Smrg<para> 21989e7bcd65SmrgIf the X event queue is empty, 21999e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/> 22009e7bcd65Smrgflushes the X output buffers of each Display in the application context 22019e7bcd65Smrgand waits for an X event while looking at the other input sources 22029e7bcd65Smrgand timeout values and calling any callback procedures triggered by them. 22039e7bcd65SmrgThis wait time can be used for background processing; 22049e7bcd65Smrgsee <xref linkend='Adding_Background_Work_Procedures' />. 22059e7bcd65Smrg</para> 22069e7bcd65Smrg</sect1> 22079e7bcd65Smrg 22089e7bcd65Smrg<sect1 id="Dispatching_Events"> 22099e7bcd65Smrg<title>Dispatching Events</title> 22109e7bcd65Smrg<para> 22119e7bcd65SmrgThe Intrinsics provide functions that dispatch events 22129e7bcd65Smrgto widgets or other application code. 22139e7bcd65SmrgEvery client interested in X events on a widget uses 22149e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 22159e7bcd65Smrgto register which events it is 22169e7bcd65Smrginterested in and a procedure (event handler) to be called 22179e7bcd65Smrgwhen the event happens in that window. 22189e7bcd65SmrgThe translation manager automatically registers event handlers for widgets 22199e7bcd65Smrgthat use translation tables; see <xref linkend='Translation_Management' />. 22209e7bcd65Smrg</para> 22219e7bcd65Smrg 22229e7bcd65Smrg<para> 22239e7bcd65SmrgApplications that need direct control of the processing of different types 22249e7bcd65Smrgof input should use 22259e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/>. 22269e7bcd65Smrg</para> 22279e7bcd65Smrg 22289e7bcd65Smrg<funcsynopsis id='XtAppProcessEvent'> 22299e7bcd65Smrg<funcprototype> 22309e7bcd65Smrg<funcdef>void <function>XtAppProcessEvent</function></funcdef> 22319e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 22329e7bcd65Smrg <paramdef>XtInputMask <parameter>mask</parameter></paramdef> 22339e7bcd65Smrg</funcprototype> 22349e7bcd65Smrg</funcsynopsis> 22359e7bcd65Smrg 22369e7bcd65Smrg<variablelist> 22379e7bcd65Smrg <varlistentry> 22389e7bcd65Smrg <term> 22399e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 22409e7bcd65Smrg </term> 22419e7bcd65Smrg <listitem> 22429e7bcd65Smrg <para> 22439e7bcd65SmrgSpecifies the application context that identifies the 22449e7bcd65Smrgapplication for which to process input. 22459e7bcd65Smrg </para> 22469e7bcd65Smrg </listitem> 22479e7bcd65Smrg </varlistentry> 22489e7bcd65Smrg <varlistentry> 22499e7bcd65Smrg <term> 22509e7bcd65Smrg <emphasis remap='I'>mask</emphasis> 22519e7bcd65Smrg </term> 22529e7bcd65Smrg <listitem> 22539e7bcd65Smrg <para> 22549e7bcd65SmrgSpecifies what types of events to process. 22559e7bcd65SmrgThe mask is the bitwise inclusive OR of any combination of 22569e7bcd65Smrg<function>XtIMXEvent</function>, 22579e7bcd65Smrg<function>XtIMTimer</function>, 22589e7bcd65Smrg<function>XtIMAlternateInput</function>, 22599e7bcd65Smrgand 22609e7bcd65Smrg<function>XtIMSignal</function>. 22619e7bcd65SmrgAs a convenience, 22620568f49bSmrg<filename class="headerfile">Intrinsic.h</filename> 22639e7bcd65Smrgdefines the symbolic name 22649e7bcd65Smrg<function>XtIMAll</function> 22659e7bcd65Smrgto be the bitwise inclusive OR of these four event types. 22669e7bcd65Smrg </para> 22679e7bcd65Smrg </listitem> 22689e7bcd65Smrg </varlistentry> 22699e7bcd65Smrg</variablelist> 22709e7bcd65Smrg 22719e7bcd65Smrg<para> 22729e7bcd65SmrgThe 22739e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 22749e7bcd65Smrgfunction processes one timer, input source, signal source, or X event. 22759e7bcd65SmrgIf there is no event or input of the appropriate type to process, then 22769e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 22779e7bcd65Smrgblocks until there is. 22789e7bcd65SmrgIf there is more than one type of input available to process, 22799e7bcd65Smrgit is undefined which will get processed. 22809e7bcd65SmrgUsually, this procedure is not called by client applications; see 22819e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/>. 22829e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 22839e7bcd65Smrgprocesses timer events by calling any appropriate timer callbacks, 22849e7bcd65Smrginput sources by calling any appropriate input callbacks, 22859e7bcd65Smrgsignal source by calling any appropriate signal callbacks, 22869e7bcd65Smrgand X events by 22879e7bcd65Smrgcalling 22889e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>. 22899e7bcd65Smrg</para> 22909e7bcd65Smrg 22919e7bcd65Smrg<para> 22929e7bcd65SmrgWhen an X event is received, 22939e7bcd65Smrgit is passed to 22949e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>, 22959e7bcd65Smrgwhich calls the appropriate event handlers 22969e7bcd65Smrgand passes them the widget, the event, and client-specific data 22979e7bcd65Smrgregistered with each procedure. 22989e7bcd65SmrgIf no handlers for that event are registered, 22999e7bcd65Smrgthe event is ignored and the dispatcher simply returns. 23009e7bcd65Smrg</para> 23019e7bcd65Smrg 23029e7bcd65Smrg<para> 23039e7bcd65SmrgTo dispatch an event returned by 23049e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/>, 23059e7bcd65Smrgretrieved directly from the Xlib queue, or synthetically constructed, 23069e7bcd65Smrgto any registered event filters or event handlers, call 23079e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>. 23089e7bcd65Smrg</para> 23099e7bcd65Smrg 23109e7bcd65Smrg<funcsynopsis id='XtDispatchEvent'> 23119e7bcd65Smrg<funcprototype> 23129e7bcd65Smrg<funcdef>Boolean <function>XtDispatchEvent</function></funcdef> 23139e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 23149e7bcd65Smrg</funcprototype> 23159e7bcd65Smrg</funcsynopsis> 23169e7bcd65Smrg 23179e7bcd65Smrg<variablelist> 23189e7bcd65Smrg <varlistentry> 23199e7bcd65Smrg <term> 23209e7bcd65Smrg <emphasis remap='I'>event</emphasis> 23219e7bcd65Smrg </term> 23229e7bcd65Smrg <listitem> 23239e7bcd65Smrg <para> 23249e7bcd65SmrgSpecifies a pointer to the event structure to be dispatched 23259e7bcd65Smrgto the appropriate event handlers. 23269e7bcd65Smrg </para> 23279e7bcd65Smrg </listitem> 23289e7bcd65Smrg </varlistentry> 23299e7bcd65Smrg</variablelist> 23309e7bcd65Smrg 23319e7bcd65Smrg<para> 23329e7bcd65SmrgThe 23339e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23349e7bcd65Smrgfunction first calls 23359e7bcd65Smrg<function>XFilterEvent</function> 23369e7bcd65Smrgwith the <emphasis remap='I'>event</emphasis> and the window of the widget to which the 23379e7bcd65SmrgIntrinsics intend to dispatch the event, or the event window if 23389e7bcd65Smrgthe Intrinsics would not dispatch the event to any handlers. 23399e7bcd65SmrgIf 23409e7bcd65Smrg<function>XFilterEvent</function> 23419e7bcd65Smrgreturns 23429e7bcd65Smrg<function>True</function> 23439e7bcd65Smrgand the event activated a server grab as identified 23449e7bcd65Smrgby a previous call to 23459e7bcd65Smrg<xref linkend='XtGrabKey' xrefstyle='select: title'/> 23469e7bcd65Smrgor 23479e7bcd65Smrg<xref linkend='XtGrabButton' xrefstyle='select: title'/>, 23489e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23499e7bcd65Smrgcalls 23509e7bcd65Smrg<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/> 23519e7bcd65Smrgor 23529e7bcd65Smrg<xref linkend='XtUngrabPointer' xrefstyle='select: title'/> 23539e7bcd65Smrgwith the timestamp from the event and immediately returns 23549e7bcd65Smrg<function>True</function>. 23559e7bcd65SmrgIf 23569e7bcd65Smrg<function>XFilterEvent</function> 23579e7bcd65Smrgreturns 23589e7bcd65Smrg<function>True</function> 23599e7bcd65Smrgand a grab was not activated, 23609e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23619e7bcd65Smrgjust immediately returns 23629e7bcd65Smrg<function>True</function>. 23639e7bcd65SmrgOtherwise, 23649e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23659e7bcd65Smrgsends the event to the event handler functions that 23669e7bcd65Smrghave been previously registered with the dispatch routine. 23679e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23689e7bcd65Smrgreturns 23699e7bcd65Smrg<function>True</function> 23709e7bcd65Smrgif 23719e7bcd65Smrg<function>XFilterEvent</function> 23729e7bcd65Smrgreturned 23739e7bcd65Smrg<function>True</function>, 23749e7bcd65Smrgor if the event was dispatched to some handler, and 23759e7bcd65Smrg<function>False</function> 23769e7bcd65Smrgif it found no handler to which to dispatch the event. 23779e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23789e7bcd65Smrgrecords the last timestamp in any event that 23799e7bcd65Smrgcontains a timestamp (see 23800568f49bSmrg<function>XtLastTimestampProcessed</function>), 23819e7bcd65Smrgregardless of whether it was filtered or dispatched. 23829e7bcd65SmrgIf a modal cascade is active with <emphasis remap='I'>spring_loaded</emphasis> 23839e7bcd65Smrg<function>True</function>, 23849e7bcd65Smrgand if the event is a remap event as defined by 23859e7bcd65Smrg<xref linkend='XtAddGrab' xrefstyle='select: title'/>, 23869e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23879e7bcd65Smrgmay dispatch the event a second time. If it does so, 23889e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 23899e7bcd65Smrgwill call 23909e7bcd65Smrg<function>XFilterEvent</function> 23919e7bcd65Smrgagain with the window of the spring-loaded widget prior to the second 23929e7bcd65Smrgdispatch, and if 23939e7bcd65Smrg<function>XFilterEvent</function> 23949e7bcd65Smrgreturns 23959e7bcd65Smrg<function>True</function>, 23969e7bcd65Smrgthe second dispatch will not be performed. 23979e7bcd65Smrg</para> 23989e7bcd65Smrg</sect1> 23999e7bcd65Smrg 24009e7bcd65Smrg<sect1 id="The_Application_Input_Loop"> 24019e7bcd65Smrg<title>The Application Input Loop</title> 24029e7bcd65Smrg<para> 24039e7bcd65SmrgTo process all input from a given application in a continuous loop, 24049e7bcd65Smrguse the convenience procedure 24059e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/>. 24069e7bcd65Smrg</para> 24079e7bcd65Smrg 24089e7bcd65Smrg<funcsynopsis id='XtAppMainLoop'> 24099e7bcd65Smrg<funcprototype> 24109e7bcd65Smrg<funcdef>void <function>XtAppMainLoop</function></funcdef> 24119e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 24129e7bcd65Smrg</funcprototype> 24139e7bcd65Smrg</funcsynopsis> 24149e7bcd65Smrg 24159e7bcd65Smrg<variablelist> 24169e7bcd65Smrg <varlistentry> 24179e7bcd65Smrg <term> 24189e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 24199e7bcd65Smrg </term> 24209e7bcd65Smrg <listitem> 24219e7bcd65Smrg <para> 24229e7bcd65SmrgSpecifies the application context that identifies the application. 24239e7bcd65Smrg </para> 24249e7bcd65Smrg </listitem> 24259e7bcd65Smrg </varlistentry> 24269e7bcd65Smrg</variablelist> 24279e7bcd65Smrg 24289e7bcd65Smrg<para> 24290568f49bSmrgThe <xref linkend='XtAppMainLoop' xrefstyle='select: title'/> 24300568f49bSmrgfunction processes events using 24310568f49bSmrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/>, 24320568f49bSmrgvarying the <emphasis remap='I'>mask parameter</emphasis> 24330568f49bSmrgand using <xref linkend='XtAppPending' xrefstyle='select: title'/> 24340568f49bSmrgto ensure that it has a chance to handle events of all types, 24350568f49bSmrgi.e., X events, timer events, input events and signal sources. 24369e7bcd65SmrgThis constitutes the main loop of X Toolkit applications. 24379e7bcd65SmrgThere is nothing special about 24389e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/>; 24390568f49bSmrgit simply processes events in a conditional loop. 24409e7bcd65SmrgAt the bottom of the loop, it checks to see if the specified 24419e7bcd65Smrgapplication context's destroy flag is set. 24429e7bcd65SmrgIf the flag is set, the loop breaks. 24439e7bcd65SmrgThe whole loop is enclosed between a matching 24449e7bcd65Smrg<xref linkend='XtAppLock' xrefstyle='select: title'/> 24459e7bcd65Smrgand 24469e7bcd65Smrg<xref linkend='XtAppUnlock' xrefstyle='select: title'/>. 24479e7bcd65Smrg</para> 24489e7bcd65Smrg 24499e7bcd65Smrg<para> 24509e7bcd65SmrgApplications can provide their own version of this loop, 24519e7bcd65Smrgwhich tests some global termination flag or tests that the number 24520568f49bSmrgof top-level widgets is larger than zero before 24530568f49bSmrgcircling back for the next event. 24540568f49bSmrg</para> 24550568f49bSmrg 24560568f49bSmrg<para> 24570568f49bSmrgThe design of 24580568f49bSmrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/> 24590568f49bSmrghas changed since Release 6. 24600568f49bSmrgOriginally it looped over calls to 24610568f49bSmrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/>, 24620568f49bSmrgand 24630568f49bSmrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>, 24640568f49bSmrgbut because the latter returns only after an X event 24650568f49bSmrg(not for timers, signals, inputs), 24660568f49bSmrgit was modified to allow any type of event to break out of the loop. 24679e7bcd65Smrg</para> 24689e7bcd65Smrg</sect1> 24699e7bcd65Smrg 24709e7bcd65Smrg<sect1 id="Setting_and_Checking_the_Sensitivity_State_of_a_Widget"> 24719e7bcd65Smrg<title>Setting and Checking the Sensitivity State of a Widget</title> 24729e7bcd65Smrg<para> 24739e7bcd65SmrgMany widgets have a mode in which they assume a different appearance 24749e7bcd65Smrg(for example, are grayed out or stippled), do not respond to user events, 24759e7bcd65Smrgand become dormant. 24769e7bcd65Smrg</para> 24779e7bcd65Smrg 24789e7bcd65Smrg<para> 24799e7bcd65SmrgWhen dormant, 24809e7bcd65Smrga widget is considered to be insensitive. 24819e7bcd65SmrgIf a widget is insensitive, 24829e7bcd65Smrgthe event manager does not dispatch any events to the widget 24839e7bcd65Smrgwith an event type of 24849e7bcd65Smrg<function>KeyPress</function>, 24859e7bcd65Smrg<function>KeyRelease</function>, 24869e7bcd65Smrg<function>ButtonPress</function>, 24879e7bcd65Smrg<function>ButtonRelease</function>, 24889e7bcd65Smrg<function>MotionNotify</function>, 24899e7bcd65Smrg<function>EnterNotify</function>, 24909e7bcd65Smrg<function>LeaveNotify</function>, 24919e7bcd65Smrg<function>FocusIn</function>, 24929e7bcd65Smrgor 24939e7bcd65Smrg<function>FocusOut</function>. 24949e7bcd65Smrg</para> 24959e7bcd65Smrg 24969e7bcd65Smrg<para> 24979e7bcd65SmrgA widget can be insensitive because its <emphasis remap='I'>sensitive</emphasis> field is 24989e7bcd65Smrg<function>False</function> 24999e7bcd65Smrgor because one of its ancestors is insensitive and thus the widget's 25009e7bcd65Smrg<emphasis remap='I'>ancestor_sensitive</emphasis> field also is 25019e7bcd65Smrg<function>False</function>. 25029e7bcd65SmrgA widget can but does not need to distinguish these two cases visually. 25039e7bcd65Smrg</para> 25049e7bcd65Smrg 25059e7bcd65Smrg<note> 25069e7bcd65Smrg<para> 25079e7bcd65SmrgPop-up shells will have 25089e7bcd65Smrg<emphasis remap='I'>ancestor_sensitive</emphasis> 25099e7bcd65Smrg<function>False</function> 25109e7bcd65Smrgif the parent was insensitive when the shell 25119e7bcd65Smrgwas created. Since 25129e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 25139e7bcd65Smrgon the parent will not 25149e7bcd65Smrgmodify the resource of the pop-up child, clients are advised to include 25159e7bcd65Smrga resource specification of the form 25160568f49bSmrg“*TransientShell.ancestorSensitive: True” 25179e7bcd65Smrgin the application defaults resource file or to 25189e7bcd65Smrgotherwise ensure that the parent is 25199e7bcd65Smrgsensitive when creating pop-up shells. 25209e7bcd65Smrg</para> 25219e7bcd65Smrg</note> 25229e7bcd65Smrg 25239e7bcd65Smrg<para> 25249e7bcd65SmrgTo set the sensitivity state of a widget, use 25259e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/>. 25269e7bcd65Smrg</para> 25279e7bcd65Smrg 25289e7bcd65Smrg<funcsynopsis id='XtSetSensitive'> 25299e7bcd65Smrg<funcprototype> 25309e7bcd65Smrg<funcdef>void <function>XtSetSensitive</function></funcdef> 25319e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 25329e7bcd65Smrg <paramdef>Boolean <parameter>sensitive</parameter></paramdef> 25339e7bcd65Smrg</funcprototype> 25349e7bcd65Smrg</funcsynopsis> 25359e7bcd65Smrg 25369e7bcd65Smrg<variablelist> 25379e7bcd65Smrg <varlistentry> 25389e7bcd65Smrg <term> 25399e7bcd65Smrg <emphasis remap='I'>w</emphasis> 25409e7bcd65Smrg </term> 25419e7bcd65Smrg <listitem> 25429e7bcd65Smrg <para> 25439e7bcd65SmrgSpecifies the widget. Must be of class RectObj or any subclass thereof. 25449e7bcd65Smrg </para> 25459e7bcd65Smrg </listitem> 25469e7bcd65Smrg </varlistentry> 25479e7bcd65Smrg <varlistentry> 25489e7bcd65Smrg <term> 25499e7bcd65Smrg <emphasis remap='I'>sensitive</emphasis> 25509e7bcd65Smrg </term> 25519e7bcd65Smrg <listitem> 25529e7bcd65Smrg <para> 25539e7bcd65SmrgSpecifies whether the widget should receive 25549e7bcd65Smrgkeyboard, pointer, and focus events. 25559e7bcd65Smrg </para> 25569e7bcd65Smrg </listitem> 25579e7bcd65Smrg </varlistentry> 25589e7bcd65Smrg</variablelist> 25599e7bcd65Smrg 25609e7bcd65Smrg<para> 25619e7bcd65SmrgThe 25629e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 25639e7bcd65Smrgfunction first calls 25649e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 25659e7bcd65Smrgon the current widget with an argument list specifying the 25669e7bcd65SmrgXtNsensitive resource and the new value. 25679e7bcd65SmrgIf <emphasis remap='I'>sensitive</emphasis> is 25689e7bcd65Smrg<function>False</function> 25699e7bcd65Smrgand the widget's class is a subclass of 25709e7bcd65SmrgComposite, 25719e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 25729e7bcd65Smrgrecursively propagates the new value 25739e7bcd65Smrgdown the child tree by calling 25749e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 25759e7bcd65Smrgon each child to set <emphasis remap='I'>ancestor_sensitive</emphasis> to 25769e7bcd65Smrg<function>False</function>. 25779e7bcd65SmrgIf <emphasis remap='I'>sensitive</emphasis> is 25789e7bcd65Smrg<function>True</function> 25799e7bcd65Smrgand the widget's class is a subclass of 25809e7bcd65SmrgComposite 25819e7bcd65Smrgand the widget's <emphasis remap='I'>ancestor_sensitive</emphasis> field is 25829e7bcd65Smrg<function>True</function>, 25839e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 25849e7bcd65Smrgsets the <emphasis remap='I'>ancestor_sensitive</emphasis> of each child to 25859e7bcd65Smrg<function>True</function> 25869e7bcd65Smrgand then recursively calls 25879e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 25889e7bcd65Smrgon each normal descendant that is now sensitive to set 25899e7bcd65Smrg<emphasis remap='I'>ancestor_sensitive</emphasis> to 25909e7bcd65Smrg<function>True</function>. 25919e7bcd65Smrg</para> 25929e7bcd65Smrg 25939e7bcd65Smrg<para> 25949e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 25959e7bcd65Smrgcalls 25969e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 25979e7bcd65Smrgto change the <emphasis remap='I'>sensitive</emphasis> and <emphasis remap='I'>ancestor_sensitive</emphasis> fields 25989e7bcd65Smrgof each affected widget. 25999e7bcd65SmrgTherefore, when one of these changes, 26009e7bcd65Smrgthe widget's set_values procedure should 26019e7bcd65Smrgtake whatever display actions are needed 26029e7bcd65Smrg(for example, graying out or stippling the widget). 26039e7bcd65Smrg</para> 26049e7bcd65Smrg 26059e7bcd65Smrg<para> 26069e7bcd65Smrg<xref linkend='XtSetSensitive' xrefstyle='select: title'/> 26079e7bcd65Smrgmaintains the invariant that, if the parent has either <emphasis remap='I'>sensitive</emphasis> 26089e7bcd65Smrgor <emphasis remap='I'>ancestor_sensitive</emphasis> 26099e7bcd65Smrg<function>False</function>, 26109e7bcd65Smrgthen all children have <emphasis remap='I'>ancestor_sensitive</emphasis> 26119e7bcd65Smrg<function>False</function>. 26129e7bcd65Smrg</para> 26139e7bcd65Smrg 26149e7bcd65Smrg<para> 26159e7bcd65SmrgTo check the current sensitivity state of a widget, 26169e7bcd65Smrguse 26179e7bcd65Smrg<xref linkend='XtIsSensitive' xrefstyle='select: title'/>. 26189e7bcd65Smrg</para> 26199e7bcd65Smrg 26209e7bcd65Smrg<funcsynopsis id='XtIsSensitive'> 26219e7bcd65Smrg<funcprototype> 26229e7bcd65Smrg<funcdef>Boolean <function>XtIsSensitive</function></funcdef> 26239e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 26249e7bcd65Smrg</funcprototype> 26259e7bcd65Smrg</funcsynopsis> 26269e7bcd65Smrg 26279e7bcd65Smrg<variablelist> 26289e7bcd65Smrg <varlistentry> 26299e7bcd65Smrg <term> 26309e7bcd65Smrg <emphasis remap='I'>w</emphasis> 26319e7bcd65Smrg </term> 26329e7bcd65Smrg <listitem> 26339e7bcd65Smrg <para> 26349e7bcd65SmrgSpecifies the object. Must be of class Object or any subclass thereof. 26359e7bcd65Smrg </para> 26369e7bcd65Smrg </listitem> 26379e7bcd65Smrg </varlistentry> 26389e7bcd65Smrg</variablelist> 26399e7bcd65Smrg 26409e7bcd65Smrg<para> 26419e7bcd65SmrgThe 26429e7bcd65Smrg<xref linkend='XtIsSensitive' xrefstyle='select: title'/> 26439e7bcd65Smrgfunction returns 26449e7bcd65Smrg<function>True</function> 26459e7bcd65Smrgor 26469e7bcd65Smrg<function>False</function> 26479e7bcd65Smrgto indicate whether user input events are being dispatched. 26489e7bcd65SmrgIf object's class is a subclass of RectObj and 26499e7bcd65Smrgboth <emphasis remap='I'>sensitive</emphasis> and <emphasis remap='I'>ancestor_sensitive</emphasis> are 26509e7bcd65Smrg<function>True</function>, 26519e7bcd65Smrg<xref linkend='XtIsSensitive' xrefstyle='select: title'/> 26529e7bcd65Smrgreturns 26539e7bcd65Smrg<function>True</function>; 26549e7bcd65Smrgotherwise, it returns 26559e7bcd65Smrg<function>False</function>. 26569e7bcd65Smrg</para> 26579e7bcd65Smrg</sect1> 26589e7bcd65Smrg 26599e7bcd65Smrg<sect1 id="Adding_Background_Work_Procedures"> 26609e7bcd65Smrg<title>Adding Background Work Procedures</title> 26619e7bcd65Smrg<para> 26629e7bcd65SmrgThe Intrinsics have some limited support for background processing. 26639e7bcd65SmrgBecause most applications spend most of their time waiting for input, 26649e7bcd65Smrgyou can register an idle-time work procedure 26659e7bcd65Smrgthat is called when the toolkit would otherwise block in 26669e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/> 26679e7bcd65Smrgor 26689e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/>. 26699e7bcd65SmrgWork procedure pointers are of type 26709e7bcd65Smrg<xref linkend='XtWorkProc' xrefstyle='select: title'/>. 26719e7bcd65Smrg</para> 26729e7bcd65Smrg 26739e7bcd65Smrg<funcsynopsis id='XtWorkProc'> 26749e7bcd65Smrg<funcprototype> 26759e7bcd65Smrg<funcdef>typedef Boolean <function>(*XtWorkProc)</function></funcdef> 26769e7bcd65Smrg 26779e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 26789e7bcd65Smrg</funcprototype> 26799e7bcd65Smrg</funcsynopsis> 26809e7bcd65Smrg 26819e7bcd65Smrg<variablelist> 26829e7bcd65Smrg <varlistentry> 26839e7bcd65Smrg <term> 26849e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 26859e7bcd65Smrg </term> 26869e7bcd65Smrg <listitem> 26879e7bcd65Smrg <para> 26889e7bcd65SmrgPasses the client data specified when the work procedure was registered. 26899e7bcd65Smrg </para> 26909e7bcd65Smrg </listitem> 26919e7bcd65Smrg </varlistentry> 26929e7bcd65Smrg</variablelist> 26939e7bcd65Smrg 26949e7bcd65Smrg<para> 26959e7bcd65SmrgThis procedure should return 26969e7bcd65Smrg<function>True</function> 26979e7bcd65Smrgwhen it is done to indicate that it 26989e7bcd65Smrgshould be removed. 26999e7bcd65SmrgIf the procedure returns 27009e7bcd65Smrg<function>False</function>, 27019e7bcd65Smrgit will remain registered and called again when the 27029e7bcd65Smrgapplication is next idle. 27039e7bcd65SmrgWork procedures should be very judicious about how much they do. 27049e7bcd65SmrgIf they run for more than a small part of a second, 27059e7bcd65Smrginteractive feel is likely to suffer. 27069e7bcd65Smrg</para> 27079e7bcd65Smrg 27089e7bcd65Smrg<para> 27099e7bcd65SmrgTo register a work procedure for a given application, use 27109e7bcd65Smrg<xref linkend='XtAppAddWorkProc' xrefstyle='select: title'/>. 27119e7bcd65Smrg</para> 27129e7bcd65Smrg 27139e7bcd65Smrg<funcsynopsis id='XtAppAddWorkProc'> 27149e7bcd65Smrg<funcprototype> 27159e7bcd65Smrg<funcdef>XtWorkProcId <function>XtAppAddWorkProc</function></funcdef> 27169e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 27179e7bcd65Smrg <paramdef>XtWorkProc <parameter>proc</parameter></paramdef> 27189e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 27199e7bcd65Smrg</funcprototype> 27209e7bcd65Smrg</funcsynopsis> 27219e7bcd65Smrg 27229e7bcd65Smrg<variablelist> 27239e7bcd65Smrg <varlistentry> 27249e7bcd65Smrg <term> 27259e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 27269e7bcd65Smrg </term> 27279e7bcd65Smrg <listitem> 27289e7bcd65Smrg <para> 27299e7bcd65SmrgSpecifies the application context that identifies the application. 27309e7bcd65Smrg </para> 27319e7bcd65Smrg </listitem> 27329e7bcd65Smrg </varlistentry> 27339e7bcd65Smrg <varlistentry> 27349e7bcd65Smrg <term> 27359e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 27369e7bcd65Smrg </term> 27379e7bcd65Smrg <listitem> 27389e7bcd65Smrg <para> 27399e7bcd65SmrgSpecifies the procedure to be called when the application is idle. 27409e7bcd65Smrg </para> 27419e7bcd65Smrg </listitem> 27429e7bcd65Smrg </varlistentry> 27439e7bcd65Smrg <varlistentry> 27449e7bcd65Smrg <term> 27459e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 27469e7bcd65Smrg </term> 27479e7bcd65Smrg <listitem> 27489e7bcd65Smrg <para> 27499e7bcd65SmrgSpecifies the argument passed to the specified procedure 27509e7bcd65Smrgwhen it is called. 27519e7bcd65Smrg </para> 27529e7bcd65Smrg </listitem> 27539e7bcd65Smrg </varlistentry> 27549e7bcd65Smrg</variablelist> 27559e7bcd65Smrg 27569e7bcd65Smrg<para> 27579e7bcd65SmrgThe 27589e7bcd65Smrg<xref linkend='XtAppAddWorkProc' xrefstyle='select: title'/> 27599e7bcd65Smrgfunction adds the specified work procedure for the application identified 27609e7bcd65Smrgby <emphasis remap='I'>app_context</emphasis> 27619e7bcd65Smrgand returns an opaque unique identifier for this work procedure. 27629e7bcd65SmrgMultiple work procedures can be registered, 27639e7bcd65Smrgand the most recently added one is always the one that is called. 27649e7bcd65SmrgHowever, if a work procedure adds another work procedure, 27659e7bcd65Smrgthe newly added one has lower priority than the current one. 27669e7bcd65Smrg</para> 27679e7bcd65Smrg 27689e7bcd65Smrg<para> 27699e7bcd65SmrgTo remove a work procedure, either return 27709e7bcd65Smrg<function>True</function> 27719e7bcd65Smrgfrom the procedure when it is called or use 27729e7bcd65Smrg<xref linkend='XtRemoveWorkProc' xrefstyle='select: title'/> 27739e7bcd65Smrgoutside of the procedure. 27749e7bcd65Smrg</para> 27759e7bcd65Smrg 27769e7bcd65Smrg<funcsynopsis id='XtRemoveWorkProc'> 27779e7bcd65Smrg<funcprototype> 27789e7bcd65Smrg<funcdef>void <function>XtRemoveWorkProc</function></funcdef> 27799e7bcd65Smrg <paramdef>XtWorkProcId <parameter>id</parameter></paramdef> 27809e7bcd65Smrg</funcprototype> 27819e7bcd65Smrg</funcsynopsis> 27829e7bcd65Smrg 27839e7bcd65Smrg<variablelist> 27849e7bcd65Smrg <varlistentry> 27859e7bcd65Smrg <term> 27869e7bcd65Smrg <emphasis remap='I'>id</emphasis> 27879e7bcd65Smrg </term> 27889e7bcd65Smrg <listitem> 27899e7bcd65Smrg <para> 27909e7bcd65SmrgSpecifies which work procedure to remove. 27919e7bcd65Smrg </para> 27929e7bcd65Smrg </listitem> 27939e7bcd65Smrg </varlistentry> 27949e7bcd65Smrg</variablelist> 27959e7bcd65Smrg 27969e7bcd65Smrg<para> 27979e7bcd65SmrgThe 27989e7bcd65Smrg<xref linkend='XtRemoveWorkProc' xrefstyle='select: title'/> 27999e7bcd65Smrgfunction explicitly removes the specified background work procedure. 28009e7bcd65Smrg</para> 28019e7bcd65Smrg</sect1> 28029e7bcd65Smrg 28039e7bcd65Smrg<sect1 id="X_Event_Filters"> 28049e7bcd65Smrg<title>X Event Filters</title> 28059e7bcd65Smrg<para> 28069e7bcd65SmrgThe event manager provides filters that can be applied to 28079e7bcd65Smrgspecific X events. 28089e7bcd65SmrgThe filters, which screen out events that are redundant or are temporarily 28099e7bcd65Smrgunwanted, handle 28109e7bcd65Smrgpointer motion compression, 28119e7bcd65Smrgenter/leave compression, and 28129e7bcd65Smrgexposure compression. 28139e7bcd65Smrg</para> 28149e7bcd65Smrg<sect2 id="Pointer_Motion_Compression"> 28159e7bcd65Smrg<title>Pointer Motion Compression</title> 28169e7bcd65Smrg<para> 28179e7bcd65SmrgWidgets can have a hard time keeping up with a rapid stream of 28189e7bcd65Smrgpointer motion events. Furthermore, 28199e7bcd65Smrgthey usually do not care about every motion event. To throw out 28209e7bcd65Smrgredundant motion events, the widget class field <emphasis remap='I'>compress_motion</emphasis> should be 28219e7bcd65Smrg<function>True</function>. 28229e7bcd65SmrgWhen a request for an event would return a motion event, 28239e7bcd65Smrgthe Intrinsics check if there are any other motion events 28249e7bcd65Smrgfor the same widget immediately 28259e7bcd65Smrgfollowing the current one and, if so, skip all but the last of them. 28269e7bcd65Smrg</para> 28279e7bcd65Smrg</sect2> 28289e7bcd65Smrg 28299e7bcd65Smrg<sect2 id="Enter_Leave_Compression"> 28309e7bcd65Smrg<title>Enter/Leave Compression</title> 28319e7bcd65Smrg<para> 28329e7bcd65SmrgTo throw out pairs of enter and leave events that have no intervening events, 28339e7bcd65Smrgas can happen when the user moves the pointer across a widget 28349e7bcd65Smrgwithout stopping in it, 28359e7bcd65Smrgthe widget class field <emphasis remap='I'>compress_enterleave</emphasis> should be 28369e7bcd65Smrg<function>True</function>. 28379e7bcd65SmrgThese enter and leave events are not delivered to the client 28389e7bcd65Smrgif they are found together in the input queue. 28399e7bcd65Smrg</para> 28409e7bcd65Smrg</sect2> 28419e7bcd65Smrg 28429e7bcd65Smrg<sect2 id="Exposure_Compression"> 28439e7bcd65Smrg<title>Exposure Compression</title> 28449e7bcd65Smrg<para> 28459e7bcd65SmrgMany widgets prefer to process a series of exposure events as a 28469e7bcd65Smrgsingle expose region rather than as individual rectangles. Widgets 28479e7bcd65Smrgwith complex displays might use the expose region as a clip list 28489e7bcd65Smrgin a graphics context, and widgets with simple displays might 28499e7bcd65Smrgignore the region entirely and redisplay their whole window or 28509e7bcd65Smrgmight get the bounding box from the region and redisplay only that 28519e7bcd65Smrgrectangle. 28529e7bcd65Smrg</para> 28539e7bcd65Smrg 28549e7bcd65Smrg<para> 28559e7bcd65SmrgIn either case, these widgets do not care about getting partial exposure events. 28569e7bcd65SmrgThe <emphasis remap='I'>compress_exposure</emphasis> field in the widget class 28579e7bcd65Smrgstructure specifies the type and number of exposure events that are 28589e7bcd65Smrgdispatched to the widget's expose procedure. This field must be 28599e7bcd65Smrginitialized to one of the following values: 28609e7bcd65Smrg</para> 28619e7bcd65Smrg 28620568f49bSmrg<programlisting> 28630568f49bSmrg#define XtExposeNoCompress ((XtEnum)False) 28640568f49bSmrg#define XtExposeCompressSeries ((XtEnum)True) 28650568f49bSmrg#define XtExposeCompressMultiple <implementation-defined> 28660568f49bSmrg#define XtExposeCompressMaximal <implementation-defined> 28670568f49bSmrg</programlisting> 28689e7bcd65Smrg 28699e7bcd65Smrg<para> 28709e7bcd65Smrgoptionally ORed with any combination of the following flags (all with 28719e7bcd65Smrgimplementation-defined values): 28729e7bcd65Smrg<function>XtExposeGraphicsExpose</function>, 28739e7bcd65Smrg<function>XtExposeGraphicsExposeMerged</function>, 28749e7bcd65Smrg<function>XtExposeNoExpose</function>, 28759e7bcd65Smrgand 28769e7bcd65Smrg<function>XtExposeNoRegion</function>. 28779e7bcd65Smrg</para> 28789e7bcd65Smrg 28799e7bcd65Smrg<para> 28809e7bcd65SmrgIf the <emphasis remap='I'>compress_exposure</emphasis> field in the widget class structure does not 28819e7bcd65Smrgspecify 28829e7bcd65Smrg<function>XtExposeNoCompress</function>, 28839e7bcd65Smrgthe event manager calls the widget's expose procedure only 28849e7bcd65Smrgonce for a series of exposure events. 28859e7bcd65SmrgIn this case, all 28869e7bcd65Smrg<function>Expose</function> 28879e7bcd65Smrgor 28889e7bcd65Smrg<function>GraphicsExpose</function> 28899e7bcd65Smrgevents are accumulated into a region. 28909e7bcd65SmrgWhen the final event is received, 28919e7bcd65Smrgthe event manager replaces the rectangle in the event with the 28929e7bcd65Smrgbounding box for the region 28939e7bcd65Smrgand calls the widget's expose procedure, 28949e7bcd65Smrgpassing the modified exposure event and (unless 28959e7bcd65Smrg<function>XtExposeNoRegion</function> 28969e7bcd65Smrgis specified) the region. 28979e7bcd65SmrgFor more information on regions, see 28989e7bcd65Smrg<olink targetdoc='libX11' targetptr='Manipulating_Regions'>Section 16.5</olink> in 28990568f49bSmrg<olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface</olink>. 29009e7bcd65Smrg</para> 29019e7bcd65Smrg 29029e7bcd65Smrg<para> 29039e7bcd65SmrgThe values have the following interpretation: 29049e7bcd65Smrg</para> 29059e7bcd65Smrg 29069e7bcd65Smrg<para> 29079e7bcd65Smrg<function>XtExposeNoCompress</function> 29089e7bcd65Smrg</para> 29099e7bcd65Smrg<itemizedlist spacing='compact'> 29109e7bcd65Smrg <listitem> 29119e7bcd65Smrg <para> 29129e7bcd65SmrgNo exposure compression is performed; every selected event is 29139e7bcd65Smrgindividually dispatched to the expose procedure with a <emphasis remap='I'>region</emphasis> 29149e7bcd65Smrgargument of NULL. 29159e7bcd65Smrg </para> 29169e7bcd65Smrg </listitem> 29179e7bcd65Smrg</itemizedlist> 29189e7bcd65Smrg<para> 29199e7bcd65Smrg<function>XtExposeCompressSeries</function> 29209e7bcd65Smrg</para> 29219e7bcd65Smrg<itemizedlist spacing='compact'> 29229e7bcd65Smrg <listitem> 29239e7bcd65Smrg <para> 29249e7bcd65SmrgEach series of exposure events is coalesced into a single event, 29259e7bcd65Smrgwhich is dispatched 29269e7bcd65Smrgwhen an exposure event with count equal to zero is reached. 29279e7bcd65Smrg </para> 29289e7bcd65Smrg </listitem> 29299e7bcd65Smrg</itemizedlist> 29309e7bcd65Smrg<para> 29319e7bcd65Smrg<function>XtExposeCompressMultiple</function> 29329e7bcd65Smrg</para> 29339e7bcd65Smrg<itemizedlist spacing='compact'> 29349e7bcd65Smrg <listitem> 29359e7bcd65Smrg <para> 29369e7bcd65SmrgConsecutive series of exposure events are coalesced into a single 29379e7bcd65Smrgevent, which is dispatched 29389e7bcd65Smrgwhen an exposure event with count equal to zero is reached and either 29399e7bcd65Smrgthe event queue is empty or the next event is not an exposure event 29409e7bcd65Smrgfor the same widget. 29419e7bcd65Smrg </para> 29429e7bcd65Smrg </listitem> 29439e7bcd65Smrg</itemizedlist> 29449e7bcd65Smrg<para> 29459e7bcd65Smrg<function>XtExposeCompressMaximal</function> 29469e7bcd65Smrg</para> 29479e7bcd65Smrg<itemizedlist spacing='compact'> 29489e7bcd65Smrg <listitem> 29499e7bcd65Smrg <para> 29509e7bcd65SmrgAll expose series currently in the queue for the widget 29519e7bcd65Smrgare coalesced into a single 29529e7bcd65Smrgevent without regard to intervening nonexposure events. If a 29539e7bcd65Smrgpartial series is in the end of the queue, the Intrinsics will 29549e7bcd65Smrgblock until the end of the series is received. 29559e7bcd65Smrg </para> 29569e7bcd65Smrg </listitem> 29579e7bcd65Smrg</itemizedlist> 29589e7bcd65Smrg<para> 29599e7bcd65SmrgThe additional flags have the following meaning: 29609e7bcd65Smrg</para> 29619e7bcd65Smrg 29629e7bcd65Smrg<para> 29639e7bcd65Smrg<function>XtExposeGraphicsExpose</function> 29649e7bcd65Smrg</para> 29659e7bcd65Smrg<itemizedlist spacing='compact'> 29669e7bcd65Smrg <listitem> 29679e7bcd65Smrg <para> 29689e7bcd65SmrgSpecifies that 29699e7bcd65Smrg<function>GraphicsExpose</function> 29709e7bcd65Smrgevents are also to be dispatched to 29719e7bcd65Smrgthe expose procedure. 29729e7bcd65Smrg<function>GraphicsExpose</function> 29739e7bcd65Smrgevents are compressed, if specified, in the same manner as 29749e7bcd65Smrg<function>Expose</function> 29759e7bcd65Smrgevents. 29769e7bcd65Smrg </para> 29779e7bcd65Smrg </listitem> 29789e7bcd65Smrg</itemizedlist> 29799e7bcd65Smrg<para> 29809e7bcd65Smrg<function>XtExposeGraphicsExposeMerged</function> 29819e7bcd65Smrg</para> 29829e7bcd65Smrg<itemizedlist spacing='compact'> 29839e7bcd65Smrg <listitem> 29849e7bcd65Smrg <para> 29859e7bcd65SmrgSpecifies in the case of 29869e7bcd65Smrg<function>XtExposeCompressMultiple</function> 29879e7bcd65Smrgand 29889e7bcd65Smrg<function>XtExposeCompressMaximal</function> 29899e7bcd65Smrgthat series of 29909e7bcd65Smrg<function>GraphicsExpose</function> 29919e7bcd65Smrgand 29929e7bcd65Smrg<function>Expose</function> 29939e7bcd65Smrgevents are to be compressed together, with the final event type 29949e7bcd65Smrgdetermining the type of the event passed to the expose procedure. 29959e7bcd65SmrgIf this flag is not set, then only series of the same event type 29969e7bcd65Smrgas the event at the head of the queue are coalesced. This flag 29979e7bcd65Smrgalso implies 29989e7bcd65Smrg<function>XtExposeGraphicsExpose</function>. 29999e7bcd65Smrg </para> 30009e7bcd65Smrg </listitem> 30019e7bcd65Smrg</itemizedlist> 30029e7bcd65Smrg<para> 30039e7bcd65Smrg<function>XtExposeNoExpose</function> 30049e7bcd65Smrg</para> 30059e7bcd65Smrg<itemizedlist spacing='compact'> 30069e7bcd65Smrg <listitem> 30079e7bcd65Smrg <para> 30089e7bcd65SmrgSpecifies that 30099e7bcd65Smrg<function>NoExpose</function> 30109e7bcd65Smrgevents are also to be dispatched to the expose procedure. 30119e7bcd65Smrg<function>NoExpose</function> 30129e7bcd65Smrgevents are never coalesced with 30139e7bcd65Smrgother exposure events or with each other. 30149e7bcd65Smrg </para> 30159e7bcd65Smrg </listitem> 30169e7bcd65Smrg</itemizedlist> 30179e7bcd65Smrg<para> 30189e7bcd65Smrg<function>XtExposeNoRegion</function> 30199e7bcd65Smrg</para> 30209e7bcd65Smrg<itemizedlist spacing='compact'> 30219e7bcd65Smrg <listitem> 30229e7bcd65Smrg <para> 30239e7bcd65SmrgSpecifies that the final region argument passed to the expose 30249e7bcd65Smrgprocedure is NULL. The rectangle in the event will still 30259e7bcd65Smrgcontain bounding box information for the entire series of 30269e7bcd65Smrgcompressed exposure events. This option saves processing time when the 30279e7bcd65Smrgregion is not needed by the widget. 30289e7bcd65Smrg </para> 30299e7bcd65Smrg </listitem> 30309e7bcd65Smrg</itemizedlist> 30319e7bcd65Smrg</sect2> 30329e7bcd65Smrg</sect1> 30339e7bcd65Smrg 30349e7bcd65Smrg<sect1 id="Widget_Exposure_and_Visibility"> 30359e7bcd65Smrg<title>Widget Exposure and Visibility</title> 30369e7bcd65Smrg<para> 30379e7bcd65SmrgEvery primitive widget and some composite widgets display data on the screen 30389e7bcd65Smrgby means of direct Xlib calls. 30399e7bcd65SmrgWidgets cannot simply write to the screen and forget what they have done. 30409e7bcd65SmrgThey must keep enough state to redisplay the window or parts 30419e7bcd65Smrgof it if a portion is obscured and then reexposed. 30429e7bcd65Smrg</para> 30439e7bcd65Smrg 30449e7bcd65Smrg<sect2 id="Redisplay_of_a_Widget_The_expose_Procedure"> 30459e7bcd65Smrg<title>Redisplay of a Widget: The expose Procedure</title> 30469e7bcd65Smrg<para> 30479e7bcd65SmrgThe expose procedure pointer in a widget class is of type 30489e7bcd65Smrg<xref linkend='XtExposeProc' xrefstyle='select: title'/>. 30499e7bcd65Smrg</para> 30509e7bcd65Smrg 30519e7bcd65Smrg<funcsynopsis id='XtExposeProc'> 30529e7bcd65Smrg<funcprototype> 30539e7bcd65Smrg<funcdef>typedef void <function>(*XtExposeProc)</function></funcdef> 30549e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 30559e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 30569e7bcd65Smrg <paramdef>Region <parameter>region</parameter></paramdef> 30579e7bcd65Smrg</funcprototype> 30589e7bcd65Smrg</funcsynopsis> 30599e7bcd65Smrg 30609e7bcd65Smrg<variablelist> 30619e7bcd65Smrg <varlistentry> 30629e7bcd65Smrg <term> 30639e7bcd65Smrg <emphasis remap='I'>w</emphasis> 30649e7bcd65Smrg </term> 30659e7bcd65Smrg <listitem> 30669e7bcd65Smrg <para> 30679e7bcd65SmrgSpecifies the widget instance requiring redisplay. 30689e7bcd65Smrg </para> 30699e7bcd65Smrg </listitem> 30709e7bcd65Smrg </varlistentry> 30719e7bcd65Smrg <varlistentry> 30729e7bcd65Smrg <term> 30739e7bcd65Smrg <emphasis remap='I'>event</emphasis> 30749e7bcd65Smrg </term> 30759e7bcd65Smrg <listitem> 30769e7bcd65Smrg <para> 30779e7bcd65SmrgSpecifies the exposure event giving the rectangle requiring redisplay. 30789e7bcd65Smrg </para> 30799e7bcd65Smrg </listitem> 30809e7bcd65Smrg </varlistentry> 30819e7bcd65Smrg <varlistentry> 30829e7bcd65Smrg <term> 30839e7bcd65Smrg <emphasis remap='I'>region</emphasis> 30849e7bcd65Smrg </term> 30859e7bcd65Smrg <listitem> 30869e7bcd65Smrg <para> 30879e7bcd65SmrgSpecifies the union of all rectangles in this exposure sequence. 30889e7bcd65Smrg </para> 30899e7bcd65Smrg </listitem> 30909e7bcd65Smrg </varlistentry> 30919e7bcd65Smrg</variablelist> 30929e7bcd65Smrg 30939e7bcd65Smrg<para> 30949e7bcd65SmrgThe redisplay of a widget upon exposure is the responsibility of the 30959e7bcd65Smrgexpose procedure in the widget's class record. 30969e7bcd65SmrgIf a widget has no display semantics, 30979e7bcd65Smrgit can specify NULL for the <emphasis remap='I'>expose</emphasis> field. 30989e7bcd65SmrgMany composite widgets serve only as containers for their children 30999e7bcd65Smrgand have no expose procedure. 31009e7bcd65Smrg</para> 31019e7bcd65Smrg 31029e7bcd65Smrg<note> 31039e7bcd65Smrg<para> 31049e7bcd65SmrgIf the <emphasis remap='I'>expose</emphasis> procedure is NULL, 31059e7bcd65Smrg<xref linkend='XtRealizeWidget' xrefstyle='select: title'/> 31069e7bcd65Smrgfills in a default bit gravity of 31079e7bcd65Smrg<function>NorthWestGravity</function> 31089e7bcd65Smrgbefore it calls the widget's realize procedure. 31099e7bcd65Smrg</para> 31109e7bcd65Smrg</note> 31119e7bcd65Smrg 31129e7bcd65Smrg<para> 31139e7bcd65SmrgIf the widget's <emphasis remap='I'>compress_exposure</emphasis> class field specifies 31149e7bcd65Smrg<function>XtExposeNoCompress</function> 31159e7bcd65Smrgor 31169e7bcd65Smrg<function>XtExposeNoRegion</function>, 31179e7bcd65Smrgor if the event type is 31189e7bcd65Smrg<function>NoExpose</function> 31199e7bcd65Smrg(see <xref linkend='Exposure_Compression' />), 31209e7bcd65Smrg<emphasis remap='I'>region</emphasis> is NULL. If 31219e7bcd65Smrg<function>XtExposeNoCompress</function> 31229e7bcd65Smrgis not specified and the event type is not 31239e7bcd65Smrg<function>NoExpose</function>, 31249e7bcd65Smrgthe event is the final event in the compressed series 31259e7bcd65Smrgbut <emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>, <emphasis remap='I'>width</emphasis>, and <emphasis remap='I'>height</emphasis> contain 31269e7bcd65Smrgthe bounding box for all the compressed events. 31279e7bcd65SmrgThe region is created and destroyed by the Intrinsics, but 31289e7bcd65Smrgthe widget is permitted to modify the region contents. 31299e7bcd65Smrg</para> 31309e7bcd65Smrg 31319e7bcd65Smrg<para> 31329e7bcd65SmrgA small simple widget (for example, Label) can ignore the bounding box 31339e7bcd65Smrginformation in the event and redisplay the entire window. 31349e7bcd65SmrgA more complicated widget (for example, Text) can use the bounding box 31359e7bcd65Smrginformation to minimize the amount of calculation and redisplay it does. 31369e7bcd65SmrgA very complex widget uses the region as a clip list in a GC and 31379e7bcd65Smrgignores the event information. 31389e7bcd65SmrgThe expose procedure is not chained and is therefore 31399e7bcd65Smrgresponsible for exposure of all superclass data 31409e7bcd65Smrgas well as its own. 31419e7bcd65Smrg</para> 31429e7bcd65Smrg 31439e7bcd65Smrg<para> 31449e7bcd65SmrgHowever, 31459e7bcd65Smrgit often is possible to anticipate the display needs of several levels 31469e7bcd65Smrgof subclassing. 31479e7bcd65SmrgFor example, rather than implement separate display procedures for 31489e7bcd65Smrgthe widgets Label, Pushbutton, and Toggle, 31499e7bcd65Smrgyou could write a single display routine in Label that uses display state 31509e7bcd65Smrgfields like 31519e7bcd65Smrg</para> 31520568f49bSmrg<programlisting> 31530568f49bSmrgBoolean invert; 31540568f49bSmrgBoolean highlight; 31550568f49bSmrgDimension highlight_width; 31560568f49bSmrg</programlisting> 31579e7bcd65Smrg<para> 31589e7bcd65SmrgLabel would have <emphasis remap='I'>invert</emphasis> and <emphasis remap='I'>highlight</emphasis> always 31599e7bcd65Smrg<function>False</function> 31609e7bcd65Smrgand <emphasis remap='I'>highlight_width</emphasis> zero. 31619e7bcd65SmrgPushbutton would dynamically set <emphasis remap='I'>highlight</emphasis> and <emphasis remap='I'>highlight_width</emphasis>, 31629e7bcd65Smrgbut it would leave <emphasis remap='I'>invert</emphasis> always 31639e7bcd65Smrg<function>False</function>. 31649e7bcd65SmrgFinally, Toggle would dynamically set all three. 31659e7bcd65SmrgIn this case, 31669e7bcd65Smrgthe expose procedures for Pushbutton and Toggle inherit 31679e7bcd65Smrgtheir superclass's expose procedure; 31689e7bcd65Smrgsee <xref linkend='Inheritance_of_Superclass_Operations' />. 31699e7bcd65Smrg</para> 31709e7bcd65Smrg</sect2> 31719e7bcd65Smrg 31729e7bcd65Smrg<sect2 id="Widget_Visibility"> 31739e7bcd65Smrg<title>Widget Visibility</title> 31749e7bcd65Smrg<para> 31759e7bcd65SmrgSome widgets may use substantial computing resources to produce the 31769e7bcd65Smrgdata they will display. 31779e7bcd65SmrgHowever, this effort is wasted if the widget is not actually visible 31789e7bcd65Smrgon the screen, that is, if the widget is obscured by another application 31799e7bcd65Smrgor is iconified. 31809e7bcd65Smrg</para> 31819e7bcd65Smrg 31829e7bcd65Smrg<para> 31839e7bcd65SmrgThe <emphasis remap='I'>visible</emphasis> field in the 31849e7bcd65Smrgcore 31859e7bcd65Smrgwidget structure provides a hint to the widget that it need not compute 31869e7bcd65Smrgdisplay data. 31879e7bcd65SmrgThis field is guaranteed to be 31889e7bcd65Smrg<function>True</function> 31899e7bcd65Smrgby the time an 31909e7bcd65Smrgexposure 31919e7bcd65Smrgevent is processed if any part of the widget is visible, 31929e7bcd65Smrgbut is 31939e7bcd65Smrg<function>False</function> 31949e7bcd65Smrgif the widget is fully obscured. 31959e7bcd65Smrg</para> 31969e7bcd65Smrg 31979e7bcd65Smrg<para> 31989e7bcd65SmrgWidgets can use or ignore the <emphasis remap='I'>visible</emphasis> hint. 31999e7bcd65SmrgIf they ignore it, 32009e7bcd65Smrgthey should have <emphasis remap='I'>visible_interest</emphasis> in their widget class record set 32019e7bcd65Smrg<function>False</function>. 32029e7bcd65SmrgIn such cases, 32039e7bcd65Smrgthe <emphasis remap='I'>visible</emphasis> field is initialized 32049e7bcd65Smrg<function>True</function> 32059e7bcd65Smrgand never changes. 32069e7bcd65SmrgIf <emphasis remap='I'>visible_interest</emphasis> is 32079e7bcd65Smrg<function>True</function>, 32089e7bcd65Smrgthe event manager asks for 32099e7bcd65Smrg<function>VisibilityNotify</function> 32109e7bcd65Smrgevents for the widget and sets <emphasis remap='I'>visible</emphasis> to 32119e7bcd65Smrg<function>True</function> 32129e7bcd65Smrgon 32139e7bcd65Smrg<function>VisibilityUnobscured</function> 32149e7bcd65Smrgor 32159e7bcd65Smrg<function>VisibilityPartiallyObscured</function> 32169e7bcd65Smrgevents and 32179e7bcd65Smrg<function>False</function> 32189e7bcd65Smrgon 32199e7bcd65Smrg<function>VisibilityFullyObscured</function> 32209e7bcd65Smrgevents. 32219e7bcd65Smrg</para> 32229e7bcd65Smrg</sect2> 32239e7bcd65Smrg</sect1> 32249e7bcd65Smrg 32259e7bcd65Smrg<sect1 id="X_Event_Handlers"> 32269e7bcd65Smrg<title>X Event Handlers</title> 32279e7bcd65Smrg<para> 32289e7bcd65SmrgEvent handlers are procedures called when specified events 32299e7bcd65Smrgoccur in a widget. 32309e7bcd65SmrgMost widgets need not use event handlers explicitly. 32319e7bcd65SmrgInstead, they use the Intrinsics translation manager. 32329e7bcd65SmrgEvent handler procedure pointers are of the type 32339e7bcd65Smrg<xref linkend='XtEventHandler' xrefstyle='select: title'/>. 32349e7bcd65Smrg</para> 32359e7bcd65Smrg 32369e7bcd65Smrg<funcsynopsis id='XtEventHandler'> 32379e7bcd65Smrg<funcprototype> 32389e7bcd65Smrg<funcdef>typedef void <function>(*XtEventHandler)</function></funcdef> 32399e7bcd65Smrg 32409e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 32419e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 32429e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 32439e7bcd65Smrg <paramdef>Boolean *<parameter>continue_to_dispatch</parameter></paramdef> 32449e7bcd65Smrg</funcprototype> 32459e7bcd65Smrg</funcsynopsis> 32469e7bcd65Smrg 32479e7bcd65Smrg<variablelist> 32489e7bcd65Smrg <varlistentry> 32499e7bcd65Smrg <term> 32509e7bcd65Smrg <emphasis remap='I'>w</emphasis> 32519e7bcd65Smrg </term> 32529e7bcd65Smrg <listitem> 32539e7bcd65Smrg <para> 32549e7bcd65SmrgSpecifies the widget for which the event arrived. 32559e7bcd65Smrg </para> 32569e7bcd65Smrg </listitem> 32579e7bcd65Smrg </varlistentry> 32589e7bcd65Smrg <varlistentry> 32599e7bcd65Smrg <term> 32609e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 32619e7bcd65Smrg </term> 32629e7bcd65Smrg <listitem> 32639e7bcd65Smrg <para> 32649e7bcd65SmrgSpecifies any client-specific information registered with the event handler. 32659e7bcd65Smrg </para> 32669e7bcd65Smrg </listitem> 32679e7bcd65Smrg </varlistentry> 32689e7bcd65Smrg <varlistentry> 32699e7bcd65Smrg <term> 32709e7bcd65Smrg <emphasis remap='I'>event</emphasis> 32719e7bcd65Smrg </term> 32729e7bcd65Smrg <listitem> 32739e7bcd65Smrg <para> 32749e7bcd65SmrgSpecifies the triggering event. 32759e7bcd65Smrg </para> 32769e7bcd65Smrg </listitem> 32779e7bcd65Smrg </varlistentry> 32789e7bcd65Smrg <varlistentry> 32799e7bcd65Smrg <term> 32809e7bcd65Smrg <emphasis remap='I'>continue_to_dispatch</emphasis> 32819e7bcd65Smrg </term> 32829e7bcd65Smrg <listitem> 32839e7bcd65Smrg <para> 32849e7bcd65SmrgSpecifies whether the remaining event 32859e7bcd65Smrghandlers registered for the current event 32869e7bcd65Smrgshould be called. 32879e7bcd65Smrg </para> 32889e7bcd65Smrg </listitem> 32899e7bcd65Smrg </varlistentry> 32909e7bcd65Smrg</variablelist> 32919e7bcd65Smrg 32929e7bcd65Smrg<para> 32939e7bcd65SmrgAfter receiving an event and before calling any event handlers, the 32949e7bcd65SmrgBoolean pointed to by <emphasis remap='I'>continue_to_dispatch</emphasis> is initialized to 32959e7bcd65Smrg<function>True</function>. 32969e7bcd65SmrgWhen an event handler is called, it may decide that further processing 32979e7bcd65Smrgof the event is not desirable and may store 32989e7bcd65Smrg<function>False</function> 32999e7bcd65Smrgin this Boolean, in 33009e7bcd65Smrgwhich case any handlers remaining to be called for the event are 33019e7bcd65Smrgignored. 33029e7bcd65Smrg</para> 33039e7bcd65Smrg 33049e7bcd65Smrg<para> 33059e7bcd65SmrgThe circumstances under which the Intrinsics may add event handlers 33069e7bcd65Smrgto a widget are currently implementation-dependent. Clients must 33079e7bcd65Smrgtherefore be aware that storing 33089e7bcd65Smrg<function>False</function> 33099e7bcd65Smrginto the <emphasis remap='I'>continue_to_dispatch</emphasis> argument can lead to portability problems. 33109e7bcd65Smrg</para> 33119e7bcd65Smrg<sect2 id="Event_Handlers_That_Select_Events"> 33129e7bcd65Smrg<title>Event Handlers That Select Events</title> 33139e7bcd65Smrg<para> 33149e7bcd65SmrgTo register an event handler procedure with the dispatch mechanism, use 33159e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/>. 33169e7bcd65Smrg</para> 33179e7bcd65Smrg 33189e7bcd65Smrg<funcsynopsis id='XtAddEventHandler'> 33199e7bcd65Smrg<funcprototype> 33209e7bcd65Smrg<funcdef>void <function>XtAddEventHandler</function></funcdef> 33219e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 33229e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 33239e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 33249e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 33259e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 33269e7bcd65Smrg</funcprototype> 33279e7bcd65Smrg</funcsynopsis> 33289e7bcd65Smrg 33299e7bcd65Smrg<variablelist> 33309e7bcd65Smrg <varlistentry> 33319e7bcd65Smrg <term> 33329e7bcd65Smrg <emphasis remap='I'>w</emphasis> 33339e7bcd65Smrg </term> 33349e7bcd65Smrg <listitem> 33359e7bcd65Smrg <para> 33369e7bcd65SmrgSpecifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. 33379e7bcd65Smrg </para> 33389e7bcd65Smrg </listitem> 33399e7bcd65Smrg </varlistentry> 33409e7bcd65Smrg <varlistentry> 33419e7bcd65Smrg <term> 33429e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 33439e7bcd65Smrg </term> 33449e7bcd65Smrg <listitem> 33459e7bcd65Smrg <para> 33469e7bcd65SmrgSpecifies the event mask for which to call this procedure. 33479e7bcd65Smrg </para> 33489e7bcd65Smrg </listitem> 33499e7bcd65Smrg </varlistentry> 33509e7bcd65Smrg <varlistentry> 33519e7bcd65Smrg <term> 33529e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 33539e7bcd65Smrg </term> 33549e7bcd65Smrg <listitem> 33559e7bcd65Smrg <para> 33569e7bcd65SmrgSpecifies whether this procedure should be 33579e7bcd65Smrgcalled on the nonmaskable events 33589e7bcd65Smrg<function>( GraphicsExpose</function>, 33599e7bcd65Smrg<function>NoExpose</function>, 33609e7bcd65Smrg<function>SelectionClear</function>, 33619e7bcd65Smrg<function>SelectionRequest</function>, 33629e7bcd65Smrg<function>SelectionNotify</function>, 33639e7bcd65Smrg<function>ClientMessage</function>, 33649e7bcd65Smrgand 33659e7bcd65Smrg<function>MappingNotify ).</function> 33669e7bcd65Smrg </para> 33679e7bcd65Smrg </listitem> 33689e7bcd65Smrg </varlistentry> 33699e7bcd65Smrg <varlistentry> 33709e7bcd65Smrg <term> 33719e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 33729e7bcd65Smrg </term> 33739e7bcd65Smrg <listitem> 33749e7bcd65Smrg <para> 33759e7bcd65SmrgSpecifies the procedure to be called. 33769e7bcd65Smrg </para> 33779e7bcd65Smrg </listitem> 33789e7bcd65Smrg </varlistentry> 33799e7bcd65Smrg <varlistentry> 33809e7bcd65Smrg <term> 33819e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 33829e7bcd65Smrg </term> 33839e7bcd65Smrg <listitem> 33849e7bcd65Smrg <para> 33859e7bcd65SmrgSpecifies additional data to be passed to the event handler. 33869e7bcd65Smrg </para> 33879e7bcd65Smrg </listitem> 33889e7bcd65Smrg </varlistentry> 33899e7bcd65Smrg</variablelist> 33909e7bcd65Smrg 33919e7bcd65Smrg<para> 33929e7bcd65SmrgThe 33939e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 33949e7bcd65Smrgfunction registers a procedure with the dispatch mechanism that is 33959e7bcd65Smrgto be called when an event that matches the mask occurs on the specified 33969e7bcd65Smrgwidget. 33979e7bcd65SmrgEach widget has a single registered event handler list, which will 33989e7bcd65Smrgcontain any procedure/client_data pair exactly once regardless of 33999e7bcd65Smrgthe manner in which it is registered. 34009e7bcd65SmrgIf the procedure is already registered with the same <emphasis remap='I'>client_data</emphasis> 34019e7bcd65Smrgvalue, 34029e7bcd65Smrgthe specified mask augments the existing mask. 34039e7bcd65SmrgIf the widget is realized, 34049e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 34059e7bcd65Smrgcalls 34069e7bcd65Smrg<function>XSelectInput</function>, 34079e7bcd65Smrgif necessary. 34089e7bcd65SmrgThe order in which this procedure is called relative to other handlers 34099e7bcd65Smrgregistered for the same event is not defined. 34109e7bcd65Smrg</para> 34119e7bcd65Smrg 34129e7bcd65Smrg<para> 34139e7bcd65SmrgTo remove a previously registered event handler, use 34149e7bcd65Smrg<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/>. 34159e7bcd65Smrg</para> 34169e7bcd65Smrg 34179e7bcd65Smrg<funcsynopsis id='XtRemoveEventHandler'> 34189e7bcd65Smrg<funcprototype> 34199e7bcd65Smrg<funcdef>void <function>XtRemoveEventHandler</function></funcdef> 34209e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 34219e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 34229e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 34239e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 34249e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 34259e7bcd65Smrg</funcprototype> 34269e7bcd65Smrg</funcsynopsis> 34279e7bcd65Smrg 34289e7bcd65Smrg<variablelist> 34299e7bcd65Smrg <varlistentry> 34309e7bcd65Smrg <term> 34319e7bcd65Smrg <emphasis remap='I'>w</emphasis> 34329e7bcd65Smrg </term> 34339e7bcd65Smrg <listitem> 34349e7bcd65Smrg <para> 34359e7bcd65SmrgSpecifies the widget for which this procedure is registered. Must be of class Core or any subclass thereof. 34369e7bcd65Smrg </para> 34379e7bcd65Smrg </listitem> 34389e7bcd65Smrg </varlistentry> 34399e7bcd65Smrg <varlistentry> 34409e7bcd65Smrg <term> 34419e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 34429e7bcd65Smrg </term> 34439e7bcd65Smrg <listitem> 34449e7bcd65Smrg <para> 34459e7bcd65SmrgSpecifies the event mask for which to unregister this procedure. 34469e7bcd65Smrg </para> 34479e7bcd65Smrg </listitem> 34489e7bcd65Smrg </varlistentry> 34499e7bcd65Smrg <varlistentry> 34509e7bcd65Smrg <term> 34519e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 34529e7bcd65Smrg </term> 34539e7bcd65Smrg <listitem> 34549e7bcd65Smrg <para> 34559e7bcd65SmrgSpecifies whether this procedure should be 34569e7bcd65Smrgremoved on the nonmaskable events 34579e7bcd65Smrg<function>( GraphicsExpose</function>, 34589e7bcd65Smrg<function>NoExpose</function>, 34599e7bcd65Smrg<function>SelectionClear</function>, 34609e7bcd65Smrg<function>SelectionRequest</function>, 34619e7bcd65Smrg<function>SelectionNotify</function>, 34629e7bcd65Smrg<function>ClientMessage</function>, 34639e7bcd65Smrgand 34649e7bcd65Smrg<function>MappingNotify ).</function> 34659e7bcd65Smrg </para> 34669e7bcd65Smrg </listitem> 34679e7bcd65Smrg </varlistentry> 34689e7bcd65Smrg <varlistentry> 34699e7bcd65Smrg <term> 34709e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 34719e7bcd65Smrg </term> 34729e7bcd65Smrg <listitem> 34739e7bcd65Smrg <para> 34749e7bcd65SmrgSpecifies the procedure to be removed. 34759e7bcd65Smrg </para> 34769e7bcd65Smrg </listitem> 34779e7bcd65Smrg </varlistentry> 34789e7bcd65Smrg <varlistentry> 34799e7bcd65Smrg <term> 34809e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 34819e7bcd65Smrg </term> 34829e7bcd65Smrg <listitem> 34839e7bcd65Smrg <para> 34849e7bcd65SmrgSpecifies the registered client data. 34859e7bcd65Smrg </para> 34869e7bcd65Smrg </listitem> 34879e7bcd65Smrg </varlistentry> 34889e7bcd65Smrg</variablelist> 34899e7bcd65Smrg 34909e7bcd65Smrg<para> 34919e7bcd65SmrgThe 34929e7bcd65Smrg<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/> 34939e7bcd65Smrgfunction unregisters an event handler registered with 34949e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 34959e7bcd65Smrgor 34969e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/> 34979e7bcd65Smrgfor the specified events. 34989e7bcd65SmrgThe request is ignored if <emphasis remap='I'>client_data</emphasis> does not match the value given 34999e7bcd65Smrgwhen the handler was registered. 35009e7bcd65SmrgIf the widget is realized and no other event handler requires the event, 35019e7bcd65Smrg<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/> 35029e7bcd65Smrgcalls 35039e7bcd65Smrg<function>XSelectInput</function>. 35049e7bcd65SmrgIf the specified procedure has not been registered 35059e7bcd65Smrgor if it has been registered with a different value of <emphasis remap='I'>client_data</emphasis>, 35069e7bcd65Smrg<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/> 35079e7bcd65Smrgreturns without reporting an error. 35089e7bcd65Smrg</para> 35099e7bcd65Smrg 35109e7bcd65Smrg<para> 35119e7bcd65SmrgTo stop a procedure registered with 35129e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 35139e7bcd65Smrgor 35149e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/> 35159e7bcd65Smrgfrom receiving all selected events, call 35169e7bcd65Smrg<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/> 35179e7bcd65Smrgwith an <emphasis remap='I'>event_mask</emphasis> of 35189e7bcd65Smrg<function>XtAllEvents</function> 35199e7bcd65Smrgand <emphasis remap='I'>nonmaskable</emphasis> 35209e7bcd65Smrg<function>True</function>. 35219e7bcd65SmrgThe procedure will continue to receive any events 35229e7bcd65Smrgthat have been specified in calls to 35239e7bcd65Smrg<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/> 35249e7bcd65Smrgor 35259e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/>. 35269e7bcd65Smrg</para> 35279e7bcd65Smrg 35289e7bcd65Smrg<para> 35299e7bcd65SmrgTo register an event handler procedure that receives events before or 35309e7bcd65Smrgafter all previously registered event handlers, use 35319e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/>. 35329e7bcd65Smrg</para> 35330568f49bSmrg<programlisting> 35349e7bcd65Smrgtypedef enum {XtListHead, XtListTail} XtListPosition; 35350568f49bSmrg</programlisting> 35369e7bcd65Smrg 35379e7bcd65Smrg<funcsynopsis id='XtInsertEventHandler'> 35389e7bcd65Smrg<funcprototype> 35399e7bcd65Smrg<funcdef>void <function>XtInsertEventHandler</function></funcdef> 35409e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 35419e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 35429e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 35439e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 35449e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 35459e7bcd65Smrg <paramdef>XtListPosition <parameter>position</parameter></paramdef> 35469e7bcd65Smrg</funcprototype> 35479e7bcd65Smrg</funcsynopsis> 35489e7bcd65Smrg 35499e7bcd65Smrg<variablelist> 35509e7bcd65Smrg <varlistentry> 35519e7bcd65Smrg <term> 35529e7bcd65Smrg <emphasis remap='I'>w</emphasis> 35539e7bcd65Smrg </term> 35549e7bcd65Smrg <listitem> 35559e7bcd65Smrg <para> 35569e7bcd65SmrgSpecifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. 35579e7bcd65Smrg </para> 35589e7bcd65Smrg </listitem> 35599e7bcd65Smrg </varlistentry> 35609e7bcd65Smrg <varlistentry> 35619e7bcd65Smrg <term> 35629e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 35639e7bcd65Smrg </term> 35649e7bcd65Smrg <listitem> 35659e7bcd65Smrg <para> 35669e7bcd65SmrgSpecifies the event mask for which to call this procedure. 35679e7bcd65Smrg </para> 35689e7bcd65Smrg </listitem> 35699e7bcd65Smrg </varlistentry> 35709e7bcd65Smrg <varlistentry> 35719e7bcd65Smrg <term> 35729e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 35739e7bcd65Smrg </term> 35749e7bcd65Smrg <listitem> 35759e7bcd65Smrg <para> 35769e7bcd65SmrgSpecifies whether this procedure should be 35779e7bcd65Smrgcalled on the nonmaskable events 35789e7bcd65Smrg<function>( GraphicsExpose</function>, 35799e7bcd65Smrg<function>NoExpose</function>, 35809e7bcd65Smrg<function>SelectionClear</function>, 35819e7bcd65Smrg<function>SelectionRequest</function>, 35829e7bcd65Smrg<function>SelectionNotify</function>, 35839e7bcd65Smrg<function>ClientMessage</function>, 35849e7bcd65Smrgand 35859e7bcd65Smrg<function>MappingNotify ).</function> 35869e7bcd65Smrg </para> 35879e7bcd65Smrg </listitem> 35889e7bcd65Smrg </varlistentry> 35899e7bcd65Smrg <varlistentry> 35909e7bcd65Smrg <term> 35919e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 35929e7bcd65Smrg </term> 35939e7bcd65Smrg <listitem> 35949e7bcd65Smrg <para> 35959e7bcd65SmrgSpecifies the procedure to be called. 35969e7bcd65Smrg </para> 35979e7bcd65Smrg </listitem> 35989e7bcd65Smrg </varlistentry> 35999e7bcd65Smrg <varlistentry> 36009e7bcd65Smrg <term> 36019e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 36029e7bcd65Smrg </term> 36039e7bcd65Smrg <listitem> 36049e7bcd65Smrg <para> 36059e7bcd65SmrgSpecifies additional data to be passed to the client's event handler. 36069e7bcd65Smrg </para> 36079e7bcd65Smrg </listitem> 36089e7bcd65Smrg </varlistentry> 36099e7bcd65Smrg <varlistentry> 36109e7bcd65Smrg <term> 36119e7bcd65Smrg <emphasis remap='I'>position</emphasis> 36129e7bcd65Smrg </term> 36139e7bcd65Smrg <listitem> 36149e7bcd65Smrg <para> 36159e7bcd65SmrgSpecifies when the event handler is to be called 36169e7bcd65Smrgrelative to other previously registered handlers. 36179e7bcd65Smrg </para> 36189e7bcd65Smrg </listitem> 36199e7bcd65Smrg </varlistentry> 36209e7bcd65Smrg</variablelist> 36219e7bcd65Smrg 36229e7bcd65Smrg<para> 36239e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/> 36249e7bcd65Smrgis identical to 36259e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 36269e7bcd65Smrgwith the additional <emphasis remap='I'>position</emphasis> argument. If <emphasis remap='I'>position</emphasis> is 36279e7bcd65Smrg<function>XtListHead</function>, 36289e7bcd65Smrgthe event 36299e7bcd65Smrghandler is registered so that it is called before any event 36309e7bcd65Smrghandlers that were previously registered for the same widget. If 36319e7bcd65Smrg<emphasis remap='I'>position</emphasis> is 36329e7bcd65Smrg<function>XtListTail</function>, 36339e7bcd65Smrgthe event handler is registered to be called 36349e7bcd65Smrgafter any previously registered event handlers. If the procedure is 36359e7bcd65Smrgalready registered with the same <emphasis remap='I'>client_data</emphasis> value, the specified mask 36369e7bcd65Smrgaugments the existing mask and the procedure is repositioned in 36379e7bcd65Smrgthe list. 36389e7bcd65Smrg</para> 36399e7bcd65Smrg</sect2> 36409e7bcd65Smrg 36419e7bcd65Smrg<sect2 id="Event_Handlers_That_Do_Not_Select_Events"> 36429e7bcd65Smrg<title>Event Handlers That Do Not Select Events</title> 36439e7bcd65Smrg<para> 36449e7bcd65SmrgOn occasion, 36459e7bcd65Smrgclients need to register an event handler procedure with the 36469e7bcd65Smrgdispatch mechanism without explicitly 36479e7bcd65Smrgcausing the X server to select for that event. 36489e7bcd65SmrgTo do this, use 36499e7bcd65Smrg<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/>. 36509e7bcd65Smrg</para> 36519e7bcd65Smrg 36529e7bcd65Smrg<funcsynopsis id='XtAddRawEventHandler'> 36539e7bcd65Smrg<funcprototype> 36549e7bcd65Smrg<funcdef>void <function>XtAddRawEventHandler</function></funcdef> 36559e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 36569e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 36579e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 36589e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 36599e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 36609e7bcd65Smrg</funcprototype> 36619e7bcd65Smrg</funcsynopsis> 36629e7bcd65Smrg 36639e7bcd65Smrg<variablelist> 36649e7bcd65Smrg <varlistentry> 36659e7bcd65Smrg <term> 36669e7bcd65Smrg <emphasis remap='I'>w</emphasis> 36679e7bcd65Smrg </term> 36689e7bcd65Smrg <listitem> 36699e7bcd65Smrg <para> 36709e7bcd65SmrgSpecifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. 36719e7bcd65Smrg </para> 36729e7bcd65Smrg </listitem> 36739e7bcd65Smrg </varlistentry> 36749e7bcd65Smrg <varlistentry> 36759e7bcd65Smrg <term> 36769e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 36779e7bcd65Smrg </term> 36789e7bcd65Smrg <listitem> 36799e7bcd65Smrg <para> 36809e7bcd65SmrgSpecifies the event mask for which to call this procedure. 36819e7bcd65Smrg </para> 36829e7bcd65Smrg </listitem> 36839e7bcd65Smrg </varlistentry> 36849e7bcd65Smrg <varlistentry> 36859e7bcd65Smrg <term> 36869e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 36879e7bcd65Smrg </term> 36889e7bcd65Smrg <listitem> 36899e7bcd65Smrg <para> 36909e7bcd65SmrgSpecifies whether this procedure should be 36919e7bcd65Smrgcalled on the nonmaskable events 36929e7bcd65Smrg<function>( GraphicsExpose</function>, 36939e7bcd65Smrg<function>NoExpose</function>, 36949e7bcd65Smrg<function>SelectionClear</function>, 36959e7bcd65Smrg<function>SelectionRequest</function>, 36969e7bcd65Smrg<function>SelectionNotify</function>, 36979e7bcd65Smrg<function>ClientMessage</function>, 36989e7bcd65Smrgand 36999e7bcd65Smrg<function>MappingNotify ).</function> 37009e7bcd65Smrg </para> 37019e7bcd65Smrg </listitem> 37029e7bcd65Smrg </varlistentry> 37039e7bcd65Smrg <varlistentry> 37049e7bcd65Smrg <term> 37059e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 37069e7bcd65Smrg </term> 37079e7bcd65Smrg <listitem> 37089e7bcd65Smrg <para> 37099e7bcd65SmrgSpecifies the procedure to be called. 37109e7bcd65Smrg </para> 37119e7bcd65Smrg </listitem> 37129e7bcd65Smrg </varlistentry> 37139e7bcd65Smrg <varlistentry> 37149e7bcd65Smrg <term> 37159e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 37169e7bcd65Smrg </term> 37179e7bcd65Smrg <listitem> 37189e7bcd65Smrg <para> 37199e7bcd65SmrgSpecifies additional data to be passed to the client's event handler. 37209e7bcd65Smrg </para> 37219e7bcd65Smrg </listitem> 37229e7bcd65Smrg </varlistentry> 37239e7bcd65Smrg</variablelist> 37249e7bcd65Smrg 37259e7bcd65Smrg<para> 37269e7bcd65SmrgThe 37279e7bcd65Smrg<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/> 37289e7bcd65Smrgfunction is similar to 37299e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 37309e7bcd65Smrgexcept that it does not affect the widget's event mask and never causes an 37319e7bcd65Smrg<function>XSelectInput</function> 37329e7bcd65Smrgfor its events. 37339e7bcd65SmrgNote that the widget might already have those mask bits set 37349e7bcd65Smrgbecause of other nonraw event handlers registered on it. 37359e7bcd65SmrgIf the procedure is already registered with the same <emphasis remap='I'>client_data</emphasis>, 37369e7bcd65Smrgthe specified mask augments the existing mask. 37379e7bcd65SmrgThe order in which this procedure is called relative to other handlers 37389e7bcd65Smrgregistered for the same event is not defined. 37399e7bcd65Smrg</para> 37409e7bcd65Smrg 37419e7bcd65Smrg<para> 37429e7bcd65SmrgTo remove a previously registered raw event handler, use 37439e7bcd65Smrg<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/>. 37449e7bcd65Smrg</para> 37459e7bcd65Smrg 37469e7bcd65Smrg<funcsynopsis id='XtRemoveRawEventHandler'> 37479e7bcd65Smrg<funcprototype> 37489e7bcd65Smrg<funcdef>void <function>XtRemoveRawEventHandler</function></funcdef> 37499e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 37509e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 37519e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 37529e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 37539e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 37549e7bcd65Smrg</funcprototype> 37559e7bcd65Smrg</funcsynopsis> 37569e7bcd65Smrg 37579e7bcd65Smrg<variablelist> 37589e7bcd65Smrg <varlistentry> 37599e7bcd65Smrg <term> 37609e7bcd65Smrg <emphasis remap='I'>w</emphasis> 37619e7bcd65Smrg </term> 37629e7bcd65Smrg <listitem> 37639e7bcd65Smrg <para> 37649e7bcd65SmrgSpecifies the widget for which this procedure is registered. Must be of class Core or any subclass thereof. 37659e7bcd65Smrg </para> 37669e7bcd65Smrg </listitem> 37679e7bcd65Smrg </varlistentry> 37689e7bcd65Smrg <varlistentry> 37699e7bcd65Smrg <term> 37709e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 37719e7bcd65Smrg </term> 37729e7bcd65Smrg <listitem> 37739e7bcd65Smrg <para> 37749e7bcd65SmrgSpecifies the event mask for which to unregister this procedure. 37759e7bcd65Smrg </para> 37769e7bcd65Smrg </listitem> 37779e7bcd65Smrg </varlistentry> 37789e7bcd65Smrg <varlistentry> 37799e7bcd65Smrg <term> 37809e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 37819e7bcd65Smrg </term> 37829e7bcd65Smrg <listitem> 37839e7bcd65Smrg <para> 37849e7bcd65SmrgSpecifies whether this procedure should be 37859e7bcd65Smrgremoved on the nonmaskable events 37869e7bcd65Smrg<function>( GraphicsExpose</function>, 37879e7bcd65Smrg<function>NoExpose</function>, 37889e7bcd65Smrg<function>SelectionClear</function>, 37899e7bcd65Smrg<function>SelectionRequest</function>, 37909e7bcd65Smrg<function>SelectionNotify</function>, 37919e7bcd65Smrg<function>ClientMessage</function>, 37929e7bcd65Smrgand 37939e7bcd65Smrg<function>MappingNotify ).</function> 37949e7bcd65Smrg </para> 37959e7bcd65Smrg </listitem> 37969e7bcd65Smrg </varlistentry> 37979e7bcd65Smrg <varlistentry> 37989e7bcd65Smrg <term> 37999e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 38009e7bcd65Smrg </term> 38019e7bcd65Smrg <listitem> 38029e7bcd65Smrg <para> 38039e7bcd65SmrgSpecifies the procedure to be registered. 38049e7bcd65Smrg </para> 38059e7bcd65Smrg </listitem> 38069e7bcd65Smrg </varlistentry> 38079e7bcd65Smrg <varlistentry> 38089e7bcd65Smrg <term> 38099e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 38109e7bcd65Smrg </term> 38119e7bcd65Smrg <listitem> 38129e7bcd65Smrg <para> 38139e7bcd65SmrgSpecifies the registered client data. 38149e7bcd65Smrg </para> 38159e7bcd65Smrg </listitem> 38169e7bcd65Smrg </varlistentry> 38179e7bcd65Smrg</variablelist> 38189e7bcd65Smrg 38199e7bcd65Smrg<para> 38209e7bcd65SmrgThe 38219e7bcd65Smrg<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/> 38229e7bcd65Smrgfunction unregisters an event handler registered with 38239e7bcd65Smrg<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/> 38249e7bcd65Smrgor 38259e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/> 38269e7bcd65Smrgfor the specified events without changing 38279e7bcd65Smrgthe window event mask. 38289e7bcd65SmrgThe request is ignored if <emphasis remap='I'>client_data</emphasis> does not match the value given 38299e7bcd65Smrgwhen the handler was registered. 38309e7bcd65SmrgIf the specified procedure has not been registered 38319e7bcd65Smrgor if it has been registered with a different value of <emphasis remap='I'>client_data</emphasis>, 38329e7bcd65Smrg<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/> 38339e7bcd65Smrgreturns without reporting an error. 38349e7bcd65Smrg</para> 38359e7bcd65Smrg 38369e7bcd65Smrg<para> 38379e7bcd65SmrgTo stop a procedure 38389e7bcd65Smrgregistered with 38399e7bcd65Smrg<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/> 38409e7bcd65Smrgor 38419e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/> 38429e7bcd65Smrgfrom receiving all nonselected events, call 38439e7bcd65Smrg<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/> 38449e7bcd65Smrgwith an <emphasis remap='I'>event_mask</emphasis> of 38459e7bcd65Smrg<function>XtAllEvents</function> 38469e7bcd65Smrgand <emphasis remap='I'>nonmaskable</emphasis> 38479e7bcd65Smrg<function>True</function>. 38489e7bcd65SmrgThe procedure 38499e7bcd65Smrgwill continue to receive any events that have been specified in calls to 38509e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 38519e7bcd65Smrgor 38529e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/>. 38539e7bcd65Smrg</para> 38549e7bcd65Smrg 38559e7bcd65Smrg<para> 38569e7bcd65SmrgTo register an event handler procedure that receives events before or 38579e7bcd65Smrgafter all previously registered event handlers without selecting for 38589e7bcd65Smrgthe events, use 38599e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/>. 38609e7bcd65Smrg</para> 38619e7bcd65Smrg 38629e7bcd65Smrg<funcsynopsis id='XtInsertRawEventHandler'> 38639e7bcd65Smrg<funcprototype> 38649e7bcd65Smrg<funcdef>void <function>XtInsertRawEventHandler</function></funcdef> 38659e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 38669e7bcd65Smrg <paramdef>EventMask <parameter>event_mask</parameter></paramdef> 38679e7bcd65Smrg <paramdef>Boolean <parameter>nonmaskable</parameter></paramdef> 38689e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 38699e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 38709e7bcd65Smrg <paramdef>XtListPosition <parameter>position</parameter></paramdef> 38719e7bcd65Smrg</funcprototype> 38729e7bcd65Smrg</funcsynopsis> 38739e7bcd65Smrg 38749e7bcd65Smrg<variablelist> 38759e7bcd65Smrg <varlistentry> 38769e7bcd65Smrg <term> 38779e7bcd65Smrg <emphasis remap='I'>w</emphasis> 38789e7bcd65Smrg </term> 38799e7bcd65Smrg <listitem> 38809e7bcd65Smrg <para> 38819e7bcd65SmrgSpecifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. 38829e7bcd65Smrg </para> 38839e7bcd65Smrg </listitem> 38849e7bcd65Smrg </varlistentry> 38859e7bcd65Smrg <varlistentry> 38869e7bcd65Smrg <term> 38879e7bcd65Smrg <emphasis remap='I'>event_mask</emphasis> 38889e7bcd65Smrg </term> 38899e7bcd65Smrg <listitem> 38909e7bcd65Smrg <para> 38919e7bcd65SmrgSpecifies the event mask for which to call this procedure. 38929e7bcd65Smrg </para> 38939e7bcd65Smrg </listitem> 38949e7bcd65Smrg </varlistentry> 38959e7bcd65Smrg <varlistentry> 38969e7bcd65Smrg <term> 38979e7bcd65Smrg <emphasis remap='I'>nonmaskable</emphasis> 38989e7bcd65Smrg </term> 38999e7bcd65Smrg <listitem> 39009e7bcd65Smrg <para> 39019e7bcd65SmrgSpecifies whether this procedure should be 39029e7bcd65Smrgcalled on the nonmaskable events 39039e7bcd65Smrg<function>( GraphicsExpose</function>, 39049e7bcd65Smrg<function>NoExpose</function>, 39059e7bcd65Smrg<function>SelectionClear</function>, 39069e7bcd65Smrg<function>SelectionRequest</function>, 39079e7bcd65Smrg<function>SelectionNotify</function>, 39089e7bcd65Smrg<function>ClientMessage</function>, 39099e7bcd65Smrgand 39109e7bcd65Smrg<function>MappingNotify ).</function> 39119e7bcd65Smrg </para> 39129e7bcd65Smrg </listitem> 39139e7bcd65Smrg </varlistentry> 39149e7bcd65Smrg <varlistentry> 39159e7bcd65Smrg <term> 39169e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 39179e7bcd65Smrg </term> 39189e7bcd65Smrg <listitem> 39199e7bcd65Smrg <para> 39209e7bcd65SmrgSpecifies the procedure to be registered. 39219e7bcd65Smrg </para> 39229e7bcd65Smrg </listitem> 39239e7bcd65Smrg </varlistentry> 39249e7bcd65Smrg <varlistentry> 39259e7bcd65Smrg <term> 39269e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 39279e7bcd65Smrg </term> 39289e7bcd65Smrg <listitem> 39299e7bcd65Smrg <para> 39309e7bcd65SmrgSpecifies additional data to be passed to the client's event handler. 39319e7bcd65Smrg </para> 39329e7bcd65Smrg </listitem> 39339e7bcd65Smrg </varlistentry> 39349e7bcd65Smrg <varlistentry> 39359e7bcd65Smrg <term> 39369e7bcd65Smrg <emphasis remap='I'>position</emphasis> 39379e7bcd65Smrg </term> 39389e7bcd65Smrg <listitem> 39399e7bcd65Smrg <para> 39409e7bcd65SmrgSpecifies when the event handler is to be called 39419e7bcd65Smrgrelative to other previously registered handlers. 39429e7bcd65Smrg </para> 39439e7bcd65Smrg </listitem> 39449e7bcd65Smrg </varlistentry> 39459e7bcd65Smrg</variablelist> 39469e7bcd65Smrg 39479e7bcd65Smrg<para> 39489e7bcd65SmrgThe 39499e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/> 39509e7bcd65Smrgfunction is similar to 39519e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/> 39529e7bcd65Smrgexcept that it does not modify the widget's event 39539e7bcd65Smrgmask and never causes an 39549e7bcd65Smrg<function>XSelectInput</function> 39559e7bcd65Smrgfor the specified events. If 39569e7bcd65Smrgthe procedure is already registered with the same <emphasis remap='I'>client_data</emphasis> 39579e7bcd65Smrgvalue, the 39589e7bcd65Smrgspecified mask augments the existing mask and the procedure is 39599e7bcd65Smrgrepositioned in the list. 39609e7bcd65Smrg</para> 39619e7bcd65Smrg</sect2> 39629e7bcd65Smrg 39639e7bcd65Smrg<sect2 id="Current_Event_Mask"> 39649e7bcd65Smrg<title>Current Event Mask</title> 39659e7bcd65Smrg<para> 39669e7bcd65SmrgTo retrieve the event mask for a given widget, use 39679e7bcd65Smrg<xref linkend='XtBuildEventMask' xrefstyle='select: title'/>. 39689e7bcd65Smrg</para> 39699e7bcd65Smrg 39709e7bcd65Smrg<funcsynopsis id='XtBuildEventMask'> 39719e7bcd65Smrg<funcprototype> 39729e7bcd65Smrg<funcdef>EventMask <function>XtBuildEventMask</function></funcdef> 39739e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 39749e7bcd65Smrg</funcprototype> 39759e7bcd65Smrg</funcsynopsis> 39769e7bcd65Smrg 39779e7bcd65Smrg<variablelist> 39789e7bcd65Smrg <varlistentry> 39799e7bcd65Smrg <term> 39809e7bcd65Smrg <emphasis remap='I'>w</emphasis> 39819e7bcd65Smrg </term> 39829e7bcd65Smrg <listitem> 39839e7bcd65Smrg <para> 39849e7bcd65SmrgSpecifies the widget. Must be of class Core or any subclass thereof. 39859e7bcd65Smrg </para> 39869e7bcd65Smrg </listitem> 39879e7bcd65Smrg </varlistentry> 39889e7bcd65Smrg</variablelist> 39899e7bcd65Smrg 39909e7bcd65Smrg<para> 39919e7bcd65SmrgThe 39929e7bcd65Smrg<xref linkend='XtBuildEventMask' xrefstyle='select: title'/> 39939e7bcd65Smrgfunction returns the event mask representing the logical OR 39949e7bcd65Smrgof all event masks for event handlers registered on the widget with 39959e7bcd65Smrg<xref linkend='XtAddEventHandler' xrefstyle='select: title'/> 39969e7bcd65Smrgand 39979e7bcd65Smrg<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/> 39989e7bcd65Smrgand all event translations, including accelerators, 39999e7bcd65Smrginstalled on the widget. 40009e7bcd65SmrgThis is the same event mask stored into the 40019e7bcd65Smrg<function>XSetWindowAttributes</function> 40029e7bcd65Smrgstructure by 40039e7bcd65Smrg<xref linkend='XtRealizeWidget' xrefstyle='select: title'/> 40049e7bcd65Smrgand sent to the server when event handlers and translations are installed or 40059e7bcd65Smrgremoved on the realized widget. 40069e7bcd65Smrg</para> 40079e7bcd65Smrg</sect2> 40089e7bcd65Smrg 40099e7bcd65Smrg<sect2 id="Event_Handlers_for_X_Protocol_Extensions"> 40109e7bcd65Smrg<title>Event Handlers for X11 Protocol Extensions</title> 40119e7bcd65Smrg<para> 40129e7bcd65SmrgTo register an event handler procedure with the Intrinsics dispatch 40139e7bcd65Smrgmechanism according to an event type, use 40149e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>. 40159e7bcd65Smrg</para> 40169e7bcd65Smrg 40179e7bcd65Smrg<funcsynopsis id='XtInsertEventTypeHandler'> 40189e7bcd65Smrg<funcprototype> 40199e7bcd65Smrg<funcdef>void <function>XtInsertEventTypeHandler</function></funcdef> 40209e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 40219e7bcd65Smrg <paramdef>int <parameter>event_type</parameter></paramdef> 40229e7bcd65Smrg <paramdef>XtPointer <parameter>select_data</parameter></paramdef> 40239e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 40249e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 40259e7bcd65Smrg <paramdef>XtListPosition <parameter>position</parameter></paramdef> 40269e7bcd65Smrg</funcprototype> 40279e7bcd65Smrg</funcsynopsis> 40289e7bcd65Smrg 40299e7bcd65Smrg<variablelist> 40309e7bcd65Smrg <varlistentry> 40319e7bcd65Smrg <term> 40329e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 40339e7bcd65Smrg </term> 40349e7bcd65Smrg <listitem> 40359e7bcd65Smrg <para> 40369e7bcd65SmrgSpecifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. 40379e7bcd65Smrg </para> 40389e7bcd65Smrg </listitem> 40399e7bcd65Smrg </varlistentry> 40409e7bcd65Smrg <varlistentry> 40419e7bcd65Smrg <term> 40429e7bcd65Smrg <emphasis remap='I'>event_type</emphasis> 40439e7bcd65Smrg </term> 40449e7bcd65Smrg <listitem> 40459e7bcd65Smrg <para> 40469e7bcd65SmrgSpecifies the event type for which to call this event handler. 40479e7bcd65Smrg </para> 40489e7bcd65Smrg </listitem> 40499e7bcd65Smrg </varlistentry> 40509e7bcd65Smrg <varlistentry> 40519e7bcd65Smrg <term> 40529e7bcd65Smrg <emphasis remap='I'>select_data</emphasis> 40539e7bcd65Smrg </term> 40549e7bcd65Smrg <listitem> 40559e7bcd65Smrg <para> 40569e7bcd65SmrgSpecifies data used to request events of the specified type from the server, 40579e7bcd65Smrgor NULL. 40589e7bcd65Smrg </para> 40599e7bcd65Smrg </listitem> 40609e7bcd65Smrg </varlistentry> 40619e7bcd65Smrg <varlistentry> 40629e7bcd65Smrg <term> 40639e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 40649e7bcd65Smrg </term> 40659e7bcd65Smrg <listitem> 40669e7bcd65Smrg <para> 40679e7bcd65SmrgSpecifies the event handler to be called. 40689e7bcd65Smrg </para> 40699e7bcd65Smrg </listitem> 40709e7bcd65Smrg </varlistentry> 40719e7bcd65Smrg <varlistentry> 40729e7bcd65Smrg <term> 40739e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 40749e7bcd65Smrg </term> 40759e7bcd65Smrg <listitem> 40769e7bcd65Smrg <para> 40779e7bcd65SmrgSpecifies additional data to be passed to the event handler. 40789e7bcd65Smrg </para> 40799e7bcd65Smrg </listitem> 40809e7bcd65Smrg </varlistentry> 40819e7bcd65Smrg <varlistentry> 40829e7bcd65Smrg <term> 40839e7bcd65Smrg <emphasis remap='I'>position</emphasis> 40849e7bcd65Smrg </term> 40859e7bcd65Smrg <listitem> 40869e7bcd65Smrg <para> 40879e7bcd65SmrgSpecifies when the event handler is to be called relative to other 40889e7bcd65Smrgpreviously registered handlers. 40899e7bcd65Smrg </para> 40909e7bcd65Smrg </listitem> 40919e7bcd65Smrg </varlistentry> 40929e7bcd65Smrg</variablelist> 40939e7bcd65Smrg 40949e7bcd65Smrg<para> 40959e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/> 40969e7bcd65Smrgregisters a procedure with the 40979e7bcd65Smrgdispatch mechanism that is to be called when an event that matches the 40989e7bcd65Smrgspecified <emphasis remap='I'>event_type</emphasis> is dispatched to the specified <emphasis remap='I'>widget</emphasis>. 40999e7bcd65Smrg</para> 41009e7bcd65Smrg 41019e7bcd65Smrg<para> 41029e7bcd65SmrgIf <emphasis remap='I'>event_type</emphasis> specifies one of the core X protocol events, then 41039e7bcd65Smrg<emphasis remap='I'>select_data</emphasis> must be a pointer to a value of type 41049e7bcd65Smrg<function>EventMask</function>, 41059e7bcd65Smrgindicating 41069e7bcd65Smrgthe event mask to be used to select for the desired event. This event 41079e7bcd65Smrgmask is included in the value returned by 41089e7bcd65Smrg<xref linkend='XtBuildEventMask' xrefstyle='select: title'/>. 41099e7bcd65SmrgIf the widget is realized, 41109e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/> 41119e7bcd65Smrgcalls 41129e7bcd65Smrg<function>XSelectInput</function> 41139e7bcd65Smrgif necessary. Specifying NULL for <emphasis remap='I'>select_data</emphasis> is equivalent to 41149e7bcd65Smrgspecifying a pointer to an event mask containing 0. This is similar 41159e7bcd65Smrgto the 41169e7bcd65Smrg<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/> 41179e7bcd65Smrgfunction. 41189e7bcd65Smrg</para> 41199e7bcd65Smrg 41209e7bcd65Smrg<para> 41219e7bcd65SmrgIf <emphasis remap='I'>event_type</emphasis> specifies an extension event type, then the semantics of 41229e7bcd65Smrgthe data pointed to by <emphasis remap='I'>select_data</emphasis> are defined by the extension 41239e7bcd65Smrgselector registered for the specified event type. 41249e7bcd65Smrg</para> 41259e7bcd65Smrg 41269e7bcd65Smrg<para> 41279e7bcd65SmrgIn either case the Intrinsics are not required to copy the data 41289e7bcd65Smrgpointed to by <emphasis remap='I'>select_data</emphasis>, so the caller must ensure that it remains 41299e7bcd65Smrgvalid as long as the event handler remains registered with this value 41309e7bcd65Smrgof <emphasis remap='I'>select_data</emphasis>. 41319e7bcd65Smrg</para> 41329e7bcd65Smrg 41339e7bcd65Smrg<para> 41349e7bcd65SmrgThe <emphasis remap='I'>position</emphasis> argument allows the client to control the order of 41359e7bcd65Smrginvocation of event handlers registered for the same event type. If 41369e7bcd65Smrgthe client does not care about the order, it should normally specify 41379e7bcd65Smrg<function>XtListTail</function>, 41389e7bcd65Smrgwhich registers this event handler after any previously 41399e7bcd65Smrgregistered handlers for this event type. 41409e7bcd65Smrg</para> 41419e7bcd65Smrg 41429e7bcd65Smrg<para> 41439e7bcd65SmrgEach widget has a single registered event handler list, which will 41449e7bcd65Smrgcontain any procedure/client_data pair exactly once if it is 41459e7bcd65Smrgregistered with 41469e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>, 41479e7bcd65Smrgregardless of the manner 41489e7bcd65Smrgin which it is registered and regardless of the value(s) 41499e7bcd65Smrgof <emphasis remap='I'>select_data</emphasis>. If the procedure is already registered with the 41509e7bcd65Smrgsame <emphasis remap='I'>client_data</emphasis> value, the specified mask augments the existing 41519e7bcd65Smrgmask and the procedure is repositioned in the list. 41529e7bcd65Smrg</para> 41539e7bcd65Smrg 41549e7bcd65Smrg<para> 41559e7bcd65SmrgTo remove an event handler registered with 41569e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>, 41579e7bcd65Smrguse 41589e7bcd65Smrg<xref linkend='XtRemoveEventTypeHandler' xrefstyle='select: title'/>. 41599e7bcd65Smrg</para> 41609e7bcd65Smrg 41619e7bcd65Smrg<funcsynopsis id='XtRemoveEventTypeHandler'> 41629e7bcd65Smrg<funcprototype> 41639e7bcd65Smrg<funcdef>void <function>XtRemoveEventTypeHandler</function></funcdef> 41649e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 41659e7bcd65Smrg <paramdef>int <parameter>event_type</parameter></paramdef> 41669e7bcd65Smrg <paramdef>XtPointer <parameter>select_data</parameter></paramdef> 41679e7bcd65Smrg <paramdef>XtEventHandler <parameter>proc</parameter></paramdef> 41689e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 41699e7bcd65Smrg</funcprototype> 41709e7bcd65Smrg</funcsynopsis> 41719e7bcd65Smrg 41729e7bcd65Smrg<variablelist> 41739e7bcd65Smrg <varlistentry> 41749e7bcd65Smrg <term> 41759e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 41769e7bcd65Smrg </term> 41779e7bcd65Smrg <listitem> 41789e7bcd65Smrg <para> 41799e7bcd65SmrgSpecifies the widget for which the event handler was registered. Must be of class Core or any subclass thereof. 41809e7bcd65Smrg </para> 41819e7bcd65Smrg </listitem> 41829e7bcd65Smrg </varlistentry> 41839e7bcd65Smrg <varlistentry> 41849e7bcd65Smrg <term> 41859e7bcd65Smrg <emphasis remap='I'>event_type</emphasis> 41869e7bcd65Smrg </term> 41879e7bcd65Smrg <listitem> 41889e7bcd65Smrg <para> 41899e7bcd65SmrgSpecifies the event type for which the handler was registered. 41909e7bcd65Smrg </para> 41919e7bcd65Smrg </listitem> 41929e7bcd65Smrg </varlistentry> 41939e7bcd65Smrg <varlistentry> 41949e7bcd65Smrg <term> 41959e7bcd65Smrg <emphasis remap='I'>select_data</emphasis> 41969e7bcd65Smrg </term> 41979e7bcd65Smrg <listitem> 41989e7bcd65Smrg <para> 41999e7bcd65SmrgSpecifies data used to deselect events of the specified type 42009e7bcd65Smrgfrom the server, or NULL. 42019e7bcd65Smrg </para> 42029e7bcd65Smrg </listitem> 42039e7bcd65Smrg </varlistentry> 42049e7bcd65Smrg <varlistentry> 42059e7bcd65Smrg <term> 42069e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 42079e7bcd65Smrg </term> 42089e7bcd65Smrg <listitem> 42099e7bcd65Smrg <para> 42109e7bcd65SmrgSpecifies the event handler to be removed. 42119e7bcd65Smrg </para> 42129e7bcd65Smrg </listitem> 42139e7bcd65Smrg </varlistentry> 42149e7bcd65Smrg <varlistentry> 42159e7bcd65Smrg <term> 42169e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 42179e7bcd65Smrg </term> 42189e7bcd65Smrg <listitem> 42199e7bcd65Smrg <para> 42209e7bcd65SmrgSpecifies the additional client data with which the procedure was registered. 42219e7bcd65Smrg </para> 42229e7bcd65Smrg </listitem> 42239e7bcd65Smrg </varlistentry> 42249e7bcd65Smrg</variablelist> 42259e7bcd65Smrg 42269e7bcd65Smrg<para> 42279e7bcd65SmrgThe 42289e7bcd65Smrg<xref linkend='XtRemoveEventTypeHandler' xrefstyle='select: title'/> 42299e7bcd65Smrgfunction unregisters an event handler 42309e7bcd65Smrgregistered with 42319e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/> 42329e7bcd65Smrgfor the specified event type. 42339e7bcd65SmrgThe request is ignored if <emphasis remap='I'>client_data</emphasis> does not match the value given 42349e7bcd65Smrgwhen the handler was registered. 42359e7bcd65Smrg</para> 42369e7bcd65Smrg 42379e7bcd65Smrg<para> 42389e7bcd65SmrgIf <emphasis remap='I'>event_type</emphasis> specifies one of the core X protocol events, 42399e7bcd65Smrg<emphasis remap='I'>select_data</emphasis> must be a pointer to a value of type 42409e7bcd65Smrg<function>EventMask, indicating the event</function> 42419e7bcd65Smrgmask to be used to deselect for the appropriate event. If the widget 42429e7bcd65Smrgis realized, 42439e7bcd65Smrg<xref linkend='XtRemoveEventTypeHandler' xrefstyle='select: title'/> 42449e7bcd65Smrgcalls 42459e7bcd65Smrg<function>XSelectInput</function> 42469e7bcd65Smrgif necessary. 42479e7bcd65SmrgSpecifying NULL for <emphasis remap='I'>select_data</emphasis> is equivalent to specifying a pointer 42489e7bcd65Smrgto an event mask containing 0. This is similar to the 42499e7bcd65Smrg<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/> 42509e7bcd65Smrgfunction. 42519e7bcd65Smrg</para> 42529e7bcd65Smrg 42539e7bcd65Smrg<para> 42549e7bcd65SmrgIf <emphasis remap='I'>event_type</emphasis> specifies an extension event type, then the semantics of 42559e7bcd65Smrgthe data pointed to by <emphasis remap='I'>select_data</emphasis> are defined by the extension 42569e7bcd65Smrgselector registered for the specified event type. 42579e7bcd65Smrg</para> 42589e7bcd65Smrg 42599e7bcd65Smrg<para> 42609e7bcd65SmrgTo register a procedure to select extension events for a widget, use 42619e7bcd65Smrg<xref linkend='XtRegisterExtensionSelector' xrefstyle='select: title'/>. 42629e7bcd65Smrg</para> 42639e7bcd65Smrg 42649e7bcd65Smrg<funcsynopsis id='XtRegisterExtensionSelector'> 42659e7bcd65Smrg<funcprototype> 42669e7bcd65Smrg<funcdef>void <function>XtRegisterExtensionSelector</function></funcdef> 42670568f49bSmrg <paramdef>Display *<parameter>display</parameter></paramdef> 42689e7bcd65Smrg <paramdef>int <parameter>min_event_type</parameter></paramdef> 42699e7bcd65Smrg <paramdef>int <parameter>max_event_type</parameter></paramdef> 42709e7bcd65Smrg <paramdef>XtExtensionSelectProc <parameter>proc</parameter></paramdef> 42719e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 42729e7bcd65Smrg</funcprototype> 42739e7bcd65Smrg</funcsynopsis> 42749e7bcd65Smrg 42759e7bcd65Smrg<variablelist> 42769e7bcd65Smrg <varlistentry> 42779e7bcd65Smrg <term> 42789e7bcd65Smrg <emphasis remap='I'>display</emphasis> 42799e7bcd65Smrg </term> 42809e7bcd65Smrg <listitem> 42819e7bcd65Smrg <para> 42829e7bcd65SmrgSpecifies the display for which the extension selector is to be registered. 42839e7bcd65Smrg </para> 42849e7bcd65Smrg </listitem> 42859e7bcd65Smrg </varlistentry> 42869e7bcd65Smrg <varlistentry> 42879e7bcd65Smrg <term> 42889e7bcd65Smrg <emphasis remap='I'>min_event_type</emphasis> 42899e7bcd65Smrg </term> 42909e7bcd65Smrg <listitem> 42919e7bcd65Smrg <para></para> 42929e7bcd65Smrg </listitem> 42939e7bcd65Smrg </varlistentry> 42949e7bcd65Smrg <varlistentry> 42959e7bcd65Smrg <term> 42969e7bcd65Smrg <emphasis remap='I'>max_event_type</emphasis> 42979e7bcd65Smrg </term> 42989e7bcd65Smrg <listitem> 42999e7bcd65Smrg <para> 43009e7bcd65SmrgSpecifies the range of event types for the extension. 43019e7bcd65Smrg </para> 43029e7bcd65Smrg </listitem> 43039e7bcd65Smrg </varlistentry> 43049e7bcd65Smrg <varlistentry> 43059e7bcd65Smrg <term> 43069e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 43079e7bcd65Smrg </term> 43089e7bcd65Smrg <listitem> 43099e7bcd65Smrg <para> 43109e7bcd65SmrgSpecifies the extension selector procedure. 43119e7bcd65Smrg </para> 43129e7bcd65Smrg </listitem> 43139e7bcd65Smrg </varlistentry> 43149e7bcd65Smrg <varlistentry> 43159e7bcd65Smrg <term> 43169e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 43179e7bcd65Smrg </term> 43189e7bcd65Smrg <listitem> 43199e7bcd65Smrg <para> 43209e7bcd65SmrgSpecifies additional data to be passed to the extension selector. 43219e7bcd65Smrg </para> 43229e7bcd65Smrg </listitem> 43239e7bcd65Smrg </varlistentry> 43249e7bcd65Smrg</variablelist> 43259e7bcd65Smrg 43269e7bcd65Smrg<para> 43279e7bcd65SmrgThe 43289e7bcd65Smrg<xref linkend='XtRegisterExtensionSelector' xrefstyle='select: title'/> 43299e7bcd65Smrgfunction registers a procedure to arrange 43309e7bcd65Smrgfor the delivery of extension events to widgets. 43319e7bcd65Smrg</para> 43329e7bcd65Smrg 43339e7bcd65Smrg<para> 43349e7bcd65SmrgIf <emphasis remap='I'>min_event_type</emphasis> and <emphasis remap='I'>max_event_type</emphasis> match the parameters 43359e7bcd65Smrgto a previous call to 43369e7bcd65Smrg<xref linkend='XtRegisterExtensionSelector' xrefstyle='select: title'/> 43379e7bcd65Smrgfor the same <emphasis remap='I'>display</emphasis>, then <emphasis remap='I'>proc</emphasis> and <emphasis remap='I'>client_data</emphasis> 43389e7bcd65Smrgreplace the previously 43399e7bcd65Smrgregistered values. If the range specified by <emphasis remap='I'>min_event_type</emphasis> 43409e7bcd65Smrgand <emphasis remap='I'>max_event_type</emphasis> overlaps the range of the parameters to a 43419e7bcd65Smrgprevious call for the same display in any other way, an error results. 43429e7bcd65Smrg</para> 43439e7bcd65Smrg 43449e7bcd65Smrg<para> 43459e7bcd65SmrgWhen a widget is realized, 43469e7bcd65Smrgafter the <emphasis remap='I'>core.realize</emphasis> method is called, 43479e7bcd65Smrgthe Intrinsics check to see if any event 43489e7bcd65Smrghandler specifies an event type within the range of a registered 43499e7bcd65Smrgextension selector. If so, the Intrinsics call each such selector. 43509e7bcd65SmrgIf an event type handler is added or removed, the Intrinsics check to 43519e7bcd65Smrgsee if the event type falls within the range of a registered extension 43529e7bcd65Smrgselector, and if it does, calls the selector. In either case the Intrinsics 43539e7bcd65Smrgpass a list of all the widget's event types that are within the 43549e7bcd65Smrgselector's range. The corresponding select data are also passed. The 43559e7bcd65Smrgselector is responsible for enabling the delivery of extension events 43569e7bcd65Smrgrequired by the widget. 43579e7bcd65Smrg</para> 43589e7bcd65Smrg 43599e7bcd65Smrg<para> 43609e7bcd65SmrgAn extension selector is of type 43619e7bcd65Smrg<xref linkend='XtExtensionSelectProc' xrefstyle='select: title'/>. 43629e7bcd65Smrg</para> 43639e7bcd65Smrg 43649e7bcd65Smrg<funcsynopsis id='XtExtensionSelectProc'> 43659e7bcd65Smrg<funcprototype> 43669e7bcd65Smrg<funcdef>typedef void <function>(*XtExtensionSelectProc)</function></funcdef> 43679e7bcd65Smrg 43689e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 43699e7bcd65Smrg <paramdef>int *<parameter>event_types</parameter></paramdef> 43709e7bcd65Smrg <paramdef>XtPointer *<parameter>select_data</parameter></paramdef> 43719e7bcd65Smrg <paramdef>int <parameter>count</parameter></paramdef> 43729e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 43739e7bcd65Smrg</funcprototype> 43749e7bcd65Smrg</funcsynopsis> 43759e7bcd65Smrg 43769e7bcd65Smrg<variablelist> 43779e7bcd65Smrg <varlistentry> 43789e7bcd65Smrg <term> 43799e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 43809e7bcd65Smrg </term> 43819e7bcd65Smrg <listitem> 43829e7bcd65Smrg <para> 43839e7bcd65SmrgSpecifies the widget that is being realized or is having 43849e7bcd65Smrgan event handler added or removed. 43859e7bcd65Smrg </para> 43869e7bcd65Smrg </listitem> 43879e7bcd65Smrg </varlistentry> 43889e7bcd65Smrg <varlistentry> 43899e7bcd65Smrg <term> 43909e7bcd65Smrg <emphasis remap='I'>event_types</emphasis> 43919e7bcd65Smrg </term> 43929e7bcd65Smrg <listitem> 43939e7bcd65Smrg <para> 43949e7bcd65SmrgSpecifies a list of event types that the widget has 43959e7bcd65Smrgregistered event handlers for. 43969e7bcd65Smrg </para> 43979e7bcd65Smrg </listitem> 43989e7bcd65Smrg </varlistentry> 43999e7bcd65Smrg <varlistentry> 44009e7bcd65Smrg <term> 44019e7bcd65Smrg <emphasis remap='I'>select_data</emphasis> 44029e7bcd65Smrg </term> 44039e7bcd65Smrg <listitem> 44049e7bcd65Smrg <para> 44059e7bcd65SmrgSpecifies a list of the select_data parameters specified in 44069e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>. 44079e7bcd65Smrg </para> 44089e7bcd65Smrg </listitem> 44099e7bcd65Smrg </varlistentry> 44109e7bcd65Smrg <varlistentry> 44119e7bcd65Smrg <term> 44129e7bcd65Smrg <emphasis remap='I'>count</emphasis> 44139e7bcd65Smrg </term> 44149e7bcd65Smrg <listitem> 44159e7bcd65Smrg <para> 44169e7bcd65SmrgSpecifies the number of entries in the <emphasis remap='I'>event_types</emphasis> and <emphasis remap='I'>select_data</emphasis> 44179e7bcd65Smrglists. 44189e7bcd65Smrg </para> 44199e7bcd65Smrg </listitem> 44209e7bcd65Smrg </varlistentry> 44219e7bcd65Smrg <varlistentry> 44229e7bcd65Smrg <term> 44239e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 44249e7bcd65Smrg </term> 44259e7bcd65Smrg <listitem> 44269e7bcd65Smrg <para> 44279e7bcd65SmrgSpecifies the additional client data with which the procedure was registered. 44289e7bcd65Smrg </para> 44299e7bcd65Smrg </listitem> 44309e7bcd65Smrg </varlistentry> 44319e7bcd65Smrg</variablelist> 44329e7bcd65Smrg 44339e7bcd65Smrg<para> 44349e7bcd65SmrgThe <emphasis remap='I'>event_types</emphasis> and <emphasis remap='I'>select_data</emphasis> lists will always have the 44359e7bcd65Smrgsame number of elements, specified by <emphasis remap='I'>count</emphasis>. 44369e7bcd65SmrgEach event type/select data pair represents one call to 44379e7bcd65Smrg<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>. 44389e7bcd65Smrg</para> 44399e7bcd65Smrg 44409e7bcd65Smrg<para> 44419e7bcd65SmrgTo register a procedure to dispatch events of a specific type within 44429e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/>, 44439e7bcd65Smrguse 44449e7bcd65Smrg<xref linkend='XtSetEventDispatcher' xrefstyle='select: title'/>. 44459e7bcd65Smrg</para> 44469e7bcd65Smrg 44479e7bcd65Smrg<funcsynopsis id='XtSetEventDispatcher'> 44489e7bcd65Smrg<funcprototype> 44499e7bcd65Smrg<funcdef>XtEventDispatchProc <function>XtSetEventDispatcher</function></funcdef> 44509e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 44519e7bcd65Smrg <paramdef>int <parameter>event_type</parameter></paramdef> 44529e7bcd65Smrg <paramdef>XtEventDispatchProc <parameter>proc</parameter></paramdef> 44539e7bcd65Smrg</funcprototype> 44549e7bcd65Smrg</funcsynopsis> 44559e7bcd65Smrg 44569e7bcd65Smrg<variablelist> 44579e7bcd65Smrg <varlistentry> 44589e7bcd65Smrg <term> 44599e7bcd65Smrg <emphasis remap='I'>display</emphasis> 44609e7bcd65Smrg </term> 44619e7bcd65Smrg <listitem> 44629e7bcd65Smrg <para> 44639e7bcd65SmrgSpecifies the display for which the event dispatcher is to be registered. 44649e7bcd65Smrg </para> 44659e7bcd65Smrg </listitem> 44669e7bcd65Smrg </varlistentry> 44679e7bcd65Smrg <varlistentry> 44689e7bcd65Smrg <term> 44699e7bcd65Smrg <emphasis remap='I'>event_type</emphasis> 44709e7bcd65Smrg </term> 44719e7bcd65Smrg <listitem> 44729e7bcd65Smrg <para> 44739e7bcd65SmrgSpecifies the event type for which the dispatcher should be invoked. 44749e7bcd65Smrg </para> 44759e7bcd65Smrg </listitem> 44769e7bcd65Smrg </varlistentry> 44779e7bcd65Smrg <varlistentry> 44789e7bcd65Smrg <term> 44799e7bcd65Smrg <emphasis remap='I'>proc</emphasis> 44809e7bcd65Smrg </term> 44819e7bcd65Smrg <listitem> 44829e7bcd65Smrg <para> 44839e7bcd65SmrgSpecifies the event dispatcher procedure. 44849e7bcd65Smrg </para> 44859e7bcd65Smrg </listitem> 44869e7bcd65Smrg </varlistentry> 44879e7bcd65Smrg</variablelist> 44889e7bcd65Smrg 44899e7bcd65Smrg<para> 44909e7bcd65SmrgThe 44919e7bcd65Smrg<xref linkend='XtSetEventDispatcher' xrefstyle='select: title'/> 44929e7bcd65Smrgfunction registers the event dispatcher procedure specified by <emphasis remap='I'>proc</emphasis> 44939e7bcd65Smrgfor events with the type <emphasis remap='I'>event_type</emphasis>. The previously registered 44949e7bcd65Smrgdispatcher (or the default dispatcher if there was no previously registered 44959e7bcd65Smrgdispatcher) is returned. If <emphasis remap='I'>proc</emphasis> is NULL, the default procedure is 44969e7bcd65Smrgrestored for the specified type. 44979e7bcd65Smrg</para> 44989e7bcd65Smrg 44999e7bcd65Smrg<para> 45009e7bcd65SmrgIn the future, when 45019e7bcd65Smrg<xref linkend='XtDispatchEvent' xrefstyle='select: title'/> 45029e7bcd65Smrgis called with an event type of <emphasis remap='I'>event_type</emphasis>, the specified <emphasis remap='I'>proc</emphasis> 45039e7bcd65Smrg(or the default dispatcher) is invoked to determine a widget 45049e7bcd65Smrgto which to dispatch the event. 45059e7bcd65Smrg</para> 45069e7bcd65Smrg 45079e7bcd65Smrg<para> 45089e7bcd65SmrgThe default dispatcher handles the Intrinsics modal cascade and keyboard 45099e7bcd65Smrgfocus mechanisms, handles the semantics of <emphasis remap='I'>compress_enterleave</emphasis> 45109e7bcd65Smrgand <emphasis remap='I'>compress_motion</emphasis>, and discards all extension events. 45119e7bcd65Smrg</para> 45129e7bcd65Smrg 45139e7bcd65Smrg<para> 45149e7bcd65SmrgAn event dispatcher procedure pointer is of type 45159e7bcd65Smrg<xref linkend='XtEventDispatchProc' xrefstyle='select: title'/>. 45169e7bcd65Smrg</para> 45179e7bcd65Smrg 45189e7bcd65Smrg<funcsynopsis id='XtEventDispatchProc'> 45199e7bcd65Smrg<funcprototype> 45209e7bcd65Smrg<funcdef>typedef Boolean <function>(*XtEventDispatchProc)</function></funcdef> 45219e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 45229e7bcd65Smrg</funcprototype> 45239e7bcd65Smrg</funcsynopsis> 45249e7bcd65Smrg 45259e7bcd65Smrg<variablelist> 45269e7bcd65Smrg <varlistentry> 45279e7bcd65Smrg <term> 45289e7bcd65Smrg <emphasis remap='I'>event</emphasis> 45299e7bcd65Smrg </term> 45309e7bcd65Smrg <listitem> 45319e7bcd65Smrg <para> 45329e7bcd65SmrgPasses the event to be dispatched. 45339e7bcd65Smrg </para> 45349e7bcd65Smrg </listitem> 45359e7bcd65Smrg </varlistentry> 45369e7bcd65Smrg</variablelist> 45379e7bcd65Smrg 45389e7bcd65Smrg<para> 45399e7bcd65SmrgThe event dispatcher procedure should determine whether this event is of 45409e7bcd65Smrga type that should be dispatched to a widget. 45419e7bcd65Smrg</para> 45429e7bcd65Smrg 45439e7bcd65Smrg<para> 45449e7bcd65SmrgIf the event should be dispatched to a widget, the event dispatcher 45459e7bcd65Smrgprocedure should determine the appropriate widget to receive the 45469e7bcd65Smrgevent, call 45479e7bcd65Smrg<function>XFilterEvent</function> 45489e7bcd65Smrgwith the window of this widget, or 45499e7bcd65Smrg<function>None</function> 45509e7bcd65Smrgif the event is to be discarded, and if 45519e7bcd65Smrg<function>XFilterEvent</function> 45529e7bcd65Smrgreturns 45539e7bcd65Smrg<function>False</function>, 45549e7bcd65Smrgdispatch the event to the widget using 45559e7bcd65Smrg<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/>. 45569e7bcd65SmrgThe procedure should return 45579e7bcd65Smrg<function>True</function> 45589e7bcd65Smrgif either 45599e7bcd65Smrg<function>XFilterEvent</function> 45609e7bcd65Smrgor 45619e7bcd65Smrg<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/> 45629e7bcd65Smrgreturned 45639e7bcd65Smrg<function>True</function> 45649e7bcd65Smrgand 45659e7bcd65Smrg<function>False</function> 45669e7bcd65Smrgotherwise. 45679e7bcd65Smrg</para> 45689e7bcd65Smrg 45699e7bcd65Smrg<para> 45709e7bcd65SmrgIf the event should not be dispatched to a widget, the event 45719e7bcd65Smrgdispatcher procedure should attempt to dispatch the event elsewhere as 45729e7bcd65Smrgappropriate and return 45739e7bcd65Smrg<function>True</function> 45749e7bcd65Smrgif it successfully dispatched the event and 45759e7bcd65Smrg<function>False</function> 45769e7bcd65Smrgotherwise. 45779e7bcd65Smrg</para> 45789e7bcd65Smrg 45799e7bcd65Smrg<para> 45809e7bcd65SmrgSome dispatchers for extension events may wish to forward events 45819e7bcd65Smrgaccording to the Intrinsics' keyboard focus mechanism. To determine 45829e7bcd65Smrgwhich widget is the end result of keyboard event forwarding, use 45839e7bcd65Smrg<xref linkend='XtGetKeyboardFocusWidget' xrefstyle='select: title'/>. 45849e7bcd65Smrg</para> 45859e7bcd65Smrg 45869e7bcd65Smrg<funcsynopsis id='XtGetKeyboardFocusWidget'> 45879e7bcd65Smrg<funcprototype> 45889e7bcd65Smrg<funcdef>Widget <function>XtGetKeyboardFocusWidget</function></funcdef> 45899e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 45909e7bcd65Smrg</funcprototype> 45919e7bcd65Smrg</funcsynopsis> 45929e7bcd65Smrg 45939e7bcd65Smrg<variablelist> 45949e7bcd65Smrg <varlistentry> 45959e7bcd65Smrg <term> 45969e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 45979e7bcd65Smrg </term> 45989e7bcd65Smrg <listitem> 45999e7bcd65Smrg <para> 46009e7bcd65SmrgSpecifies the widget to get forwarding information for. 46019e7bcd65Smrg </para> 46029e7bcd65Smrg </listitem> 46039e7bcd65Smrg </varlistentry> 46049e7bcd65Smrg</variablelist> 46059e7bcd65Smrg 46069e7bcd65Smrg<para> 46079e7bcd65SmrgThe 46089e7bcd65Smrg<xref linkend='XtGetKeyboardFocusWidget' xrefstyle='select: title'/> 46099e7bcd65Smrgfunction returns the widget that would be the end result of keyboard 46109e7bcd65Smrgevent forwarding for a keyboard event for the specified widget. 46119e7bcd65Smrg</para> 46129e7bcd65Smrg 46139e7bcd65Smrg<para> 46149e7bcd65SmrgTo dispatch an event to a specified widget, use 46159e7bcd65Smrg<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/>. 46169e7bcd65Smrg</para> 46179e7bcd65Smrg 46189e7bcd65Smrg<funcsynopsis id='XtDispatchEventToWidget'> 46199e7bcd65Smrg<funcprototype> 46209e7bcd65Smrg<funcdef>Boolean <function>XtDispatchEventToWidget</function></funcdef> 46219e7bcd65Smrg <paramdef>Widget <parameter>widget</parameter></paramdef> 46229e7bcd65Smrg <paramdef>XEvent *<parameter>event</parameter></paramdef> 46239e7bcd65Smrg</funcprototype> 46249e7bcd65Smrg</funcsynopsis> 46259e7bcd65Smrg 46269e7bcd65Smrg<variablelist> 46279e7bcd65Smrg <varlistentry> 46289e7bcd65Smrg <term> 46299e7bcd65Smrg <emphasis remap='I'>widget</emphasis> 46309e7bcd65Smrg </term> 46319e7bcd65Smrg <listitem> 46329e7bcd65Smrg <para> 46339e7bcd65SmrgSpecifies the widget to which to dispatch the event. 46349e7bcd65Smrg </para> 46359e7bcd65Smrg </listitem> 46369e7bcd65Smrg </varlistentry> 46379e7bcd65Smrg <varlistentry> 46389e7bcd65Smrg <term> 46399e7bcd65Smrg <emphasis remap='I'>event</emphasis> 46409e7bcd65Smrg </term> 46419e7bcd65Smrg <listitem> 46429e7bcd65Smrg <para> 46439e7bcd65SmrgSpecifies a pointer to the event to be dispatched. 46449e7bcd65Smrg </para> 46459e7bcd65Smrg </listitem> 46469e7bcd65Smrg </varlistentry> 46479e7bcd65Smrg</variablelist> 46489e7bcd65Smrg 46499e7bcd65Smrg<para> 46509e7bcd65SmrgThe 46519e7bcd65Smrg<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/> 46529e7bcd65Smrgfunction scans the list of registered event handlers for the 46539e7bcd65Smrgspecified widget and calls each handler that has been registered 46549e7bcd65Smrgfor the specified event type, subject to the <emphasis remap='I'>continue_to_dispatch</emphasis> 46559e7bcd65Smrgvalue returned by each handler. 46569e7bcd65SmrgThe Intrinsics behave as if event handlers were registered at the head 46579e7bcd65Smrgof the list for 46589e7bcd65Smrg<function>Expose</function>, 46599e7bcd65Smrg<function>NoExpose</function>, 46609e7bcd65Smrg<function>GraphicsExpose</function>, 46619e7bcd65Smrgand 46629e7bcd65Smrg<function>VisibilityNotify</function> 46639e7bcd65Smrgevents to invoke the widget's expose procedure according to the exposure 46649e7bcd65Smrgcompression rules and to update the widget's <emphasis remap='I'>visible</emphasis> field 46659e7bcd65Smrgif <emphasis remap='I'>visible_interest</emphasis> is 46669e7bcd65Smrg<function>True</function>. 46679e7bcd65SmrgThese internal event handlers never set <emphasis remap='I'>continue_to_dispatch</emphasis> to 46689e7bcd65Smrg<function>False</function>. 46699e7bcd65Smrg</para> 46709e7bcd65Smrg 46719e7bcd65Smrg<para> 46729e7bcd65Smrg<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/> 46739e7bcd65Smrgreturns 46749e7bcd65Smrg<function>True</function> 46759e7bcd65Smrgif any event handler was called and 46769e7bcd65Smrg<function>False</function> 46779e7bcd65Smrgotherwise. 46789e7bcd65Smrg</para> 46799e7bcd65Smrg</sect2> 46809e7bcd65Smrg</sect1> 46819e7bcd65Smrg 46829e7bcd65Smrg<sect1 id="Using_the_Intrinsics_in_a_Multi_Threaded_Environment"> 46839e7bcd65Smrg<title>Using the Intrinsics in a Multi-Threaded Environment</title> 46849e7bcd65Smrg<para> 46859e7bcd65SmrgThe Intrinsics may be used in environments that offer multiple threads 46869e7bcd65Smrgof execution within the context of a single process. A multi-threaded 46879e7bcd65Smrgapplication using the Intrinsics must explicitly initialize the toolkit 46889e7bcd65Smrgfor mutually exclusive access by calling 46899e7bcd65Smrg<xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/>. 46909e7bcd65Smrg</para> 46919e7bcd65Smrg<sect2 id="Initializing_a_Multi_Threaded_Intrinsics_Application"> 46929e7bcd65Smrg<title>Initializing a Multi-Threaded Intrinsics Application</title> 46939e7bcd65Smrg<para> 46949e7bcd65SmrgTo test and initialize Intrinsics support for mutually exclusive thread 46959e7bcd65Smrgaccess, call 46969e7bcd65Smrg<xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/>. 46979e7bcd65Smrg</para> 46989e7bcd65Smrg 46999e7bcd65Smrg<funcsynopsis id='XtToolkitThreadInitialize'> 47009e7bcd65Smrg<funcprototype> 47019e7bcd65Smrg<funcdef>Boolean <function>XtToolkitThreadInitialize</function></funcdef> 47020568f49bSmrg <paramdef><parameter>void</parameter></paramdef> 47039e7bcd65Smrg</funcprototype> 47049e7bcd65Smrg</funcsynopsis> 47059e7bcd65Smrg 47069e7bcd65Smrg<para> 47079e7bcd65Smrg<xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/> 47089e7bcd65Smrgreturns <function>True</function> if the Intrinsics support mutually exclusive thread 47099e7bcd65Smrgaccess, otherwise it returns <function>False</function>. <xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/> 47109e7bcd65Smrgmust be called before 47119e7bcd65Smrg<xref linkend='XtCreateApplicationContext' xrefstyle='select: title'/>, 47129e7bcd65Smrg<xref linkend='XtAppInitialize' xrefstyle='select: title'/>, 47139e7bcd65Smrg<xref linkend='XtOpenApplication' xrefstyle='select: title'/>, 47149e7bcd65Smrgor 47159e7bcd65Smrg<function>XtSetLanguageProc</function> 47169e7bcd65Smrgis called. <xref linkend='XtToolkitThreadInitialize' xrefstyle='select: title'/> may be called more than once; 47179e7bcd65Smrghowever, the application writer must ensure that it is not called 47189e7bcd65Smrgsimultaneously by two or more threads. 47199e7bcd65Smrg</para> 47209e7bcd65Smrg</sect2> 47219e7bcd65Smrg 47229e7bcd65Smrg<sect2 id="Locking_tk_Data_Structures"> 47239e7bcd65Smrg<title>Locking X Toolkit Data Structures</title> 47249e7bcd65Smrg<para> 47259e7bcd65SmrgThe Intrinsics employs two levels of locking: application context and 47269e7bcd65Smrgprocess. Locking an application context ensures mutually exclusive 47279e7bcd65Smrgaccess by a thread to the state associated with the application context, 47289e7bcd65Smrgincluding all displays and widgets associated with it. Locking a 47299e7bcd65Smrgprocess ensures mutually exclusive access by a thread to Intrinsics process 47309e7bcd65Smrgglobal data. 47319e7bcd65Smrg</para> 47329e7bcd65Smrg 47339e7bcd65Smrg<para> 47349e7bcd65SmrgA client may acquire a lock multiple times and the effect is cumulative. 47359e7bcd65SmrgThe client must ensure that the lock is released an equal number of times in 47369e7bcd65Smrgorder for the lock to be acquired by another thread. 47379e7bcd65Smrg</para> 47389e7bcd65Smrg 47399e7bcd65Smrg<para> 47409e7bcd65SmrgMost application writers will have little need to use locking as the 47419e7bcd65SmrgIntrinsics performs the necessary locking internally. 47429e7bcd65SmrgResource converters are an exception. 47439e7bcd65SmrgThey require the application context or process to be locked 47449e7bcd65Smrgbefore the application can safely call them directly, for example: 47459e7bcd65Smrg</para> 47460568f49bSmrg<programlisting> 47470568f49bSmrg ... 47480568f49bSmrg XtAppLock(app_context); 47490568f49bSmrg XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret); 47500568f49bSmrg XtAppUnlock(app_context); 47510568f49bSmrg ... 47520568f49bSmrg</programlisting> 47539e7bcd65Smrg<para> 47549e7bcd65SmrgWhen the application relies upon 47559e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 47569e7bcd65Smrgor a converter to provide the storage for the results of a 47579e7bcd65Smrgconversion, the application should acquire the process lock before 47589e7bcd65Smrgcalling out and hold the lock until the results have been copied. 47599e7bcd65Smrg</para> 47609e7bcd65Smrg 47619e7bcd65Smrg<para> 47629e7bcd65SmrgApplication writers who write their own 47639e7bcd65Smrgutility functions, such as one which retrieves the being_destroyed field from 47649e7bcd65Smrga widget instance, must lock the application context before accessing 47659e7bcd65Smrgwidget internal data. For example: 47669e7bcd65Smrg</para> 47670568f49bSmrg<programlisting> 47689e7bcd65Smrg#include <X11/CoreP.h> 47690568f49bSmrgBoolean BeingDestroyed (Widget widget) 47709e7bcd65Smrg{ 47710568f49bSmrg Boolean ret; 47720568f49bSmrg XtAppLock(XtWidgetToApplicationContext(widget)); 47730568f49bSmrg ret = widget->core.being_destroyed; 47740568f49bSmrg XtAppUnlock(XtWidgetToApplicationContext(widget)); 47750568f49bSmrg return ret; 47769e7bcd65Smrg} 47770568f49bSmrg</programlisting> 47789e7bcd65Smrg<para> 47799e7bcd65SmrgA client that wishes to atomically call two or more Intrinsics functions 47809e7bcd65Smrgmust lock the application context. For example: 47819e7bcd65Smrg</para> 47820568f49bSmrg<programlisting> 47830568f49bSmrg ... 47840568f49bSmrg XtAppLock(XtWidgetToApplicationContext(widget)); 47850568f49bSmrg XtUnmanageChild (widget1); 47860568f49bSmrg XtManageChild (widget2); 47870568f49bSmrg XtAppUnlock(XtWidgetToApplicationContext(widget)); 47880568f49bSmrg ... 47890568f49bSmrg</programlisting> 47909e7bcd65Smrg<sect3 id="Locking_the_Application_Context"> 47919e7bcd65Smrg<title>Locking the Application Context</title> 47929e7bcd65Smrg<para> 47939e7bcd65SmrgTo ensure mutual exclusion of application context, display, or 47949e7bcd65Smrgwidget internal state, use 47959e7bcd65Smrg<function>XtAppLock.</function> 47969e7bcd65Smrg</para> 47979e7bcd65Smrg 47989e7bcd65Smrg<funcsynopsis id='XtAppLock'> 47999e7bcd65Smrg<funcprototype> 48009e7bcd65Smrg<funcdef>void <function>XtAppLock</function></funcdef> 48019e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 48029e7bcd65Smrg</funcprototype> 48039e7bcd65Smrg</funcsynopsis> 48049e7bcd65Smrg 48059e7bcd65Smrg<variablelist> 48069e7bcd65Smrg <varlistentry> 48079e7bcd65Smrg <term> 48089e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 48099e7bcd65Smrg </term> 48109e7bcd65Smrg <listitem> 48119e7bcd65Smrg <para> 48129e7bcd65SmrgSpecifies the application context to lock. 48139e7bcd65Smrg </para> 48149e7bcd65Smrg </listitem> 48159e7bcd65Smrg </varlistentry> 48169e7bcd65Smrg</variablelist> 48179e7bcd65Smrg 48189e7bcd65Smrg<para> 48199e7bcd65Smrg<xref linkend='XtAppLock' xrefstyle='select: title'/> blocks until it is able to acquire the lock. Locking the 48209e7bcd65Smrgapplication context also ensures that only the thread holding the lock 48219e7bcd65Smrgmakes Xlib calls from within Xt. An application that makes its own 48229e7bcd65Smrgdirect Xlib calls must either lock the application context around every 48239e7bcd65Smrgcall or enable thread locking in Xlib. 48249e7bcd65Smrg</para> 48259e7bcd65Smrg 48269e7bcd65Smrg<para> 48279e7bcd65SmrgTo unlock a locked application context, use 48289e7bcd65Smrg<function>XtAppUnlock.</function> 48299e7bcd65Smrg</para> 48309e7bcd65Smrg 48319e7bcd65Smrg<funcsynopsis id='XtAppUnlock'> 48329e7bcd65Smrg<funcprototype> 48339e7bcd65Smrg<funcdef>void <function>XtAppUnlock</function></funcdef> 48349e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 48359e7bcd65Smrg</funcprototype> 48369e7bcd65Smrg</funcsynopsis> 48379e7bcd65Smrg 48389e7bcd65Smrg<variablelist> 48399e7bcd65Smrg <varlistentry> 48409e7bcd65Smrg <term> 48419e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 48429e7bcd65Smrg </term> 48439e7bcd65Smrg <listitem> 48449e7bcd65Smrg <para> 48459e7bcd65SmrgSpecifies the application context that was previously locked. 48469e7bcd65Smrg </para> 48479e7bcd65Smrg </listitem> 48489e7bcd65Smrg </varlistentry> 48499e7bcd65Smrg</variablelist> 48509e7bcd65Smrg 48519e7bcd65Smrg 48529e7bcd65Smrg</sect3> 48539e7bcd65Smrg<sect3 id="Locking_the_Process"> 48549e7bcd65Smrg<title>Locking the Process</title> 48559e7bcd65Smrg<para> 48569e7bcd65SmrgTo ensure mutual exclusion of X Toolkit process global data, a 48579e7bcd65Smrgwidget writer must use 48589e7bcd65Smrg<function>XtProcessLock.</function> 48599e7bcd65Smrg</para> 48609e7bcd65Smrg 48619e7bcd65Smrg<funcsynopsis id='XtProcessLock'> 48629e7bcd65Smrg<funcprototype> 48639e7bcd65Smrg<funcdef>void <function>XtProcessLock</function></funcdef> 48640568f49bSmrg <paramdef><parameter>void</parameter></paramdef> 48659e7bcd65Smrg</funcprototype> 48669e7bcd65Smrg</funcsynopsis> 48679e7bcd65Smrg 48689e7bcd65Smrg<para> 48699e7bcd65Smrg<xref linkend='XtProcessLock' xrefstyle='select: title'/> blocks until it is able to acquire the lock. 48709e7bcd65SmrgWidget writers may use XtProcessLock to guarantee mutually exclusive 48719e7bcd65Smrgaccess to widget static data. 48729e7bcd65Smrg</para> 48739e7bcd65Smrg 48749e7bcd65Smrg<para> 48759e7bcd65SmrgTo unlock a locked process, use 48769e7bcd65Smrg<xref linkend='XtProcessUnlock' xrefstyle='select: title'/>. 48779e7bcd65Smrg</para> 48789e7bcd65Smrg 48799e7bcd65Smrg<funcsynopsis id='XtProcessUnlock'> 48809e7bcd65Smrg<funcprototype> 48819e7bcd65Smrg<funcdef>void <function>XtProcessUnlock</function></funcdef> 48820568f49bSmrg <paramdef><parameter>void</parameter></paramdef> 48839e7bcd65Smrg</funcprototype> 48849e7bcd65Smrg</funcsynopsis> 48859e7bcd65Smrg 48869e7bcd65Smrg<para> 48879e7bcd65SmrgTo lock both an application context and the process at the same 48889e7bcd65Smrgtime, call 48899e7bcd65Smrg<xref linkend='XtAppLock' xrefstyle='select: title'/> 48909e7bcd65Smrgfirst and then 48919e7bcd65Smrg<xref linkend='XtProcessLock' xrefstyle='select: title'/>. 48929e7bcd65SmrgTo release both locks, call 48939e7bcd65Smrg<xref linkend='XtProcessUnlock' xrefstyle='select: title'/> 48949e7bcd65Smrgfirst and then 48959e7bcd65Smrg<xref linkend='XtAppUnlock' xrefstyle='select: title'/>. 48969e7bcd65SmrgThe order is important to avoid deadlock. 48979e7bcd65Smrg</para> 48989e7bcd65Smrg</sect3> 48999e7bcd65Smrg</sect2> 49009e7bcd65Smrg 49019e7bcd65Smrg<sect2 id="Event_Management_in_a_Multi_Threaded_Environment"> 49029e7bcd65Smrg<title>Event Management in a Multi-Threaded Environment</title> 49039e7bcd65Smrg<para> 49049e7bcd65SmrgIn a nonthreaded environment an application writer could reasonably 49059e7bcd65Smrgassume that it is safe to exit the application from a quit callback. 49069e7bcd65SmrgThis assumption may no longer hold true in a multi-threaded environment; 49079e7bcd65Smrgtherefore it is desirable to provide a mechanism to terminate an 49089e7bcd65Smrgevent-processing loop without necessarily terminating its thread. 49099e7bcd65Smrg</para> 49109e7bcd65Smrg 49119e7bcd65Smrg<para> 49129e7bcd65SmrgTo indicate that the event loop should terminate after the current 49139e7bcd65Smrgevent dispatch has completed, use 49149e7bcd65Smrg<xref linkend='XtAppSetExitFlag' xrefstyle='select: title'/>. 49159e7bcd65Smrg</para> 49169e7bcd65Smrg 49179e7bcd65Smrg<funcsynopsis id='XtAppSetExitFlag'> 49189e7bcd65Smrg<funcprototype> 49199e7bcd65Smrg<funcdef>void <function>XtAppSetExitFlag</function></funcdef> 49209e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 49219e7bcd65Smrg</funcprototype> 49229e7bcd65Smrg</funcsynopsis> 49239e7bcd65Smrg 49249e7bcd65Smrg<variablelist> 49259e7bcd65Smrg <varlistentry> 49269e7bcd65Smrg <term> 49279e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 49289e7bcd65Smrg </term> 49299e7bcd65Smrg <listitem> 49309e7bcd65Smrg <para> 49319e7bcd65SmrgSpecifies the application context. 49329e7bcd65Smrg </para> 49339e7bcd65Smrg </listitem> 49349e7bcd65Smrg </varlistentry> 49359e7bcd65Smrg</variablelist> 49369e7bcd65Smrg 49379e7bcd65Smrg<para> 49389e7bcd65Smrg<xref linkend='XtAppMainLoop' xrefstyle='select: title'/> 49399e7bcd65Smrgtests the value of the flag and will return if the flag is <function>True</function>. 49409e7bcd65Smrg</para> 49419e7bcd65Smrg 49429e7bcd65Smrg<para> 49439e7bcd65SmrgApplication writers who implement their own main loop may test the 49449e7bcd65Smrgvalue of the exit flag with 49459e7bcd65Smrg<xref linkend='XtAppGetExitFlag' xrefstyle='select: title'/>. 49469e7bcd65Smrg</para> 49479e7bcd65Smrg 49489e7bcd65Smrg<funcsynopsis id='XtAppGetExitFlag'> 49499e7bcd65Smrg<funcprototype> 49509e7bcd65Smrg<funcdef>Boolean <function>XtAppGetExitFlag</function></funcdef> 49519e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 49529e7bcd65Smrg</funcprototype> 49539e7bcd65Smrg</funcsynopsis> 49549e7bcd65Smrg 49559e7bcd65Smrg<variablelist> 49569e7bcd65Smrg <varlistentry> 49579e7bcd65Smrg <term> 49589e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 49599e7bcd65Smrg </term> 49609e7bcd65Smrg <listitem> 49619e7bcd65Smrg <para> 49629e7bcd65SmrgSpecifies the application context. 49639e7bcd65Smrg </para> 49649e7bcd65Smrg </listitem> 49659e7bcd65Smrg </varlistentry> 49669e7bcd65Smrg</variablelist> 49679e7bcd65Smrg 49689e7bcd65Smrg<para> 49699e7bcd65Smrg<xref linkend='XtAppGetExitFlag' xrefstyle='select: title'/> 49709e7bcd65Smrgwill normally return <function>False</function>, indicating that event processing 49719e7bcd65Smrgmay continue. When 49729e7bcd65Smrg<xref linkend='XtAppGetExitFlag' xrefstyle='select: title'/> 49739e7bcd65Smrgreturns <function>True</function>, the loop must terminate and return to the caller, 49749e7bcd65Smrgwhich might then destroy the application context. 49759e7bcd65Smrg</para> 49769e7bcd65Smrg 49779e7bcd65Smrg<para> 49789e7bcd65SmrgApplication writers should be aware that, if a thread is blocked in 49799e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/>, 49809e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/>, 49819e7bcd65Smrgor 49829e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/> 49839e7bcd65Smrgand another thread in the same application context opens a new display, 49849e7bcd65Smrgadds an alternate input, or a timeout, any new source(s) will not 49850568f49bSmrgnormally be “noticed” by the blocked thread. Any new sources are 49860568f49bSmrg“noticed” the next time one of these functions is called. 49879e7bcd65Smrg</para> 49889e7bcd65Smrg 49899e7bcd65Smrg<para> 49909e7bcd65SmrgThe Intrinsics manage access to events on a last-in, first-out basis. If 49919e7bcd65Smrgmultiple threads in the same application context block in 49929e7bcd65Smrg<xref linkend='XtAppNextEvent' xrefstyle='select: title'/>, 49939e7bcd65Smrg<xref linkend='XtAppPeekEvent' xrefstyle='select: title'/>, 49949e7bcd65Smrgor 49959e7bcd65Smrg<xref linkend='XtAppProcessEvent' xrefstyle='select: title'/>, 49969e7bcd65Smrgthe last thread to call one of these functions is the first 49979e7bcd65Smrgthread to return. 49989e7bcd65Smrg</para> 49999e7bcd65Smrg</sect2> 50009e7bcd65Smrg</sect1> 50019e7bcd65Smrg</chapter> 5002