Chapter 9 X Property Library
© National Instruments Corporation 9-3 LabWindows/CVI Standard Libraries
With the LabWindows/CVI X Property Library functions, you can connect to X displays and
obtain the root window ID, read and write properties on windows, and monitor when specific
properties change.
Property Handles and TypesBefore you can read or write properties on windows, you must create the property and its type.
The function CreateXProperty takes a property name and a property type and returns a
property handle you can use to access properties on windows. The property type, created by the
function CreateXPropType, contains the attributes that determine how data for the property
are stored and retrieved. More specifically, these attributes are the size and unit. The size is the
number of bytes in a single property item. The unit is the number of bytes in the basic entities
that make up a property item. See the description of CreateXPropType for more information
on the meanings of the size and unit attributes.
Table 9-2 lists the three predefined property types that you do not have to create. These types are
useful for defining properties to store X window IDs, integers, and strings.
Table 9-2. Predefined Property Types
Property Type Name Size/Unit
WINDOW_X_PROP_TYPE "WINDOW" sizeof(WindowX)
INTEGER_X_PROP_TYPE "INTEGER" sizeof(int)
STRING_X_PROP_TYPE "STRING" sizeof(char)
Communicating with Local ApplicationsYou can use the function ConnectToXDisplay to connect to any X server on a network.
However, if your program communicates only with other applications connected to the same
display as LabWindows/CVI, you do not need to connect to the display using
ConnectToXDisplay. Instead, use the global variable CVIXDisplay, which is a pointer to
the X display that LabWindows/CVI uses. The variable CVIXRootWindow contains the
X window ID of the root window of the display that LabWindows/CVI uses.
The Hidden WindowBefore you can read or write property data, you need the X window IDs of the windows that will
have the properties associated with them.
One option is to always use the root window ID for attaching properties. You could get the root
window ID for the local display from the variable CVIXRootWindow. To get the root window
ID for a remote display you could use the value returned by ConnectToXDisplay. This
approach has disadvantages. First, if your program adds a property to the root window and does