HP OpenVMS Systems Documentation |
VMS DECwindows Guide to Xlib (Release 4) Programming: MIT C Binding
9.6.2 Handling Graphics ExposuresXlib reports graphics exposures when one of the following conditions occurs:
Instead of using the SELECT INPUT routine to indicate an interest in graphics exposure events, assign a value of true to the graphics_exposures member of the GC values data structure. Clients can set the value to true at the time they create a graphics context. If a graphics context exists, use the SET GRAPHICS EXPOSURES routine to set the value of the field. For information about creating a graphics context and using the SET GRAPHICS EXPOSURES routine, see Chapter 4. Xlib uses the graphics expose event data structure to report graphics exposures. The following illustrates the data structure:
Table 9-9 describes members of the graphics expose event data structure.
Xlib uses the no expose event data structure to report when a graphics request that might have produced an exposure did not. The following illustrates the data structure:
Table 9-10 describes members of the no expose event data structure.
Example 9-5 illustrates handling graphics exposure events. The program checks for graphics exposures and no exposures to scroll up a window. Figure 9-2 shows the resulting output of the program.
Figure 9-2 Window Scrolling 9.7 Key EventsXlib reports key press and key release events to interested clients. To receive event notification of key presses and releases, pass the window identifier and either the KeyPressMask mask or the KeyReleaseMask mask when using the selection method described in Section 9.2.
Xlib uses a key event data structure to report key presses and releases
to interested clients whenever any key changes state, even when the key
is mapped to modifier bits.
Xlib reports events related to the state of a window when a client does one of the following:
This section describes handling events that result from these
operations. For more information about these events, see the
X Window System.
To receive notification when a client circulates a window, pass either the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the SubstructureNotifyMask mask when using a selection method described in Section 9.2. Xlib reports to interested clients a change in the hierarchical position of a window when a client calls the CIRCULATE SUBWINDOWS, CIRCULATE SUBWINDOWS UP, or CIRCULATE SUBWINDOWS DOWN routine.
Xlib uses the circulate event data structure to report circulate events.
To receive notification when window size, position, border, or stacking order changes, pass either the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the constant SubstructureNotifyMask when using the selection method described in Section 9.2. Xlib reports changes in window configuration when the following occur:
For more information about these routines, see Chapter 3.
Xlib reports changes to interested clients using the configure event
data structure.
To receive notification when a client creates a window, pass the identifier of the parent window and the constant SubstructureNotifyMask when using the selection method described in Section 9.2.
Xlib reports window creations using the create window event data
structure.
To receive notification when a client destroys a window, pass either the window identifier and the constant StructureNotifyMask or the identifier of the parent window and the SubstructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports window destructions using the destroy window event data
structure.
To receive notification when a window is moved because a client has changed the size of its parent, pass the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the SubstructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports window gravity events using the gravity event data
structure.
To receive notification when a window changes state from unmapped to mapped, pass either the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the SubstructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports window mapping events using the map event data structure.
All clients receive notification of changes in key, keyboard, and pointer mapping. Xlib reports these events when a client has successfully done one of the following:
Xlib reports key, keyboard, and pointer mapping events using the
mapping event data structure.
To receive notification when the parent of a window changes, pass either the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the SubstructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports window reparenting events using the reparent event data
structure.
To receive notification when a window changes from mapped to unmapped, pass either the window identifier and the StructureNotifyMask mask or the identifier of the parent window and the SubstructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports window unmapping events using the unmap event data
structure.
All or part of a window is visible if it is mapped to a screen, if all of its ancestors are mapped, and if it is at least partially visible on the screen. To receive notification when the visibility of a window changes, pass the window identifier and the StructureNotifyMask mask when using the selection method described in Section 9.2.
Xlib reports changes in visibility to interested clients using the
visibility event data structure.
Xlib reports changes in the state of the key map immediately after every enter notify and focus in event. To receive notification of key map state events, pass the window identifier and the KeymapStateMask mask when using the selection method described in Section 9.2.
Xlib uses the keymap event data structure to report changes in the key
map state.
Xlib reports a color map event when the window manager installs, changes, or removes the color map. To receive notification of color map events, pass the window identifier and the ColormapChangeMask mask when using the selection method described in Section 9.2. Xlib reports color map events to interested clients when the following occur:
Xlib reports color map events using the color map event data structure.
Xlib reports an event when one of the following occurs:
This section describes how to handle communication between clients.
Clients can notify each other of events by calling the SEND EVENT routine.
Xlib sends notification between clients using the client message event
data structure.
As Chapter 3 notes, a property associates a constant with data of a particular type. Xlib reports a property event when a client does one of the following:
To receive information about property changes, pass the window identifier and the PropertyChangeMask mask when using the selection method described in Section 9.2.
Xlib reports changes in properties to interested clients using the
property event data structure.
Clients receive notification automatically when they lose ownership of a selection in a window. Xlib reports the event when a client takes ownership of a selection by calling the SET SELECTION OWNER routine.
To report the event, Xlib uses the selection clear event data structure.
The server issues a selection request event to the owner of a selection when a client calls the CONVERT SELECTION routine. For information about the CONVERT SELECTION routine, see Section 3.6.
To report the event, Xlib uses the selection request event data
structure.
The server issues a selection notify event after a client calls the CONVERT SELECTION routine. The owner of the selection being converted should initiate this event by calling SEND EVENT when either the selection has been converted and stored as a property or the selection conversion could not be performed. For information about converting selections, see Section 3.6.
To report the event, Xlib uses the selection event data structure.
Xlib maintains an input queue known as the event queue. When an event occurs, the server sends the event to Xlib, which places it at the end of an event queue. By using routines described in this section, the client can check, remove, and process the events on the queue. As the client removes an event, remaining events move up the event queue.
Certain routines may block or prevent other routine
calls from accessing the event queue. If the blocking routine does not
find an event that the client is interested in, Xlib flushes the output
buffer and waits until an event is received from the server.
To check the event queue without preventing other routines from accessing the queue, use the EVENTS QUEUED routine. Clients can check events already queued by calling the EVENTS QUEUED routine and specifying one of the following constants:
To return the number of events in the event queue, use the PENDING routine. If there are no events in the queue, PENDING flushes the output buffer, attempts to read more events out of the client connection, and returns the number read. The PENDING routine is identical to EVENTS QUEUED with constant QueuedAfterFlush specified.
|