HP Xlib Extensions ABCDE HP Part No. B1171-90078 Printed in U.S.A.
Notice The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MANUAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material.
Warranty A copy of the speci c warranty terms applicable to your Hewlett-Packard product and replacement parts can be obtained from your local Sales and Service O ce. UNIX is a registered trademark of UNIX Software Laboratories, Inc. in the USA and other countries. Intellifont is a registered trademark of Agfa Corporation. CG Century Schoolbook and CG Times, based on Times New Roman under license from The Monotype Corporation plc, are products of the Agfa Corporation.
Warranty Printing History The manual printing date and part number indicate its current edition. The printing date will change when a new edition is printed. Minor changes may be made at reprint without changing the printing date. The manual part number will change when extensive changes are made. Manual updates may be issued between editions to correct errors or document product changes.
Contents DRAFT 4/7/98 1. Introduction to Xlib HP Extensions 2. Font Extensions 3. Support for Multiple Error Handlers 4. Locking an X Display 5. X Input Device Extension Functions What This Manual Covers . . . . . . . . . . . . Conventions Used in This Manual . . . . . . . . Changing Font Boldness . . . Changing Font Slant . . . . Mirroring or Rotating . . . . Changing Horizontal Size . . Specifying a Character Subset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Getting Extended Input Device Focus . . . . . . Setting Extended Input Device Focus . . . . . . Controlling Device Encodings . . . . . . . . . . Getting the Key Mapping of Extended Input Devices Changing the Key Mapping of Extended Input Devices . . . . . . . . . . . . . . . . . Getting the Modi er Mapping of Extended Input Devices . . . . . . . . . . . . . . . . . Setting the Modi er Mapping of Extended Input Devices . . . . . . . . . . . . . . . . . Querying the Device Button Mapping . . . . . .
Changing the Key Mapping of Extended Input Devices Setting the Modi er Mapping of Extended Input Devices . . . . . . . . . . . . . . . . . . Getting the Modi er Mapping of Extended Input Devices . . . . . . . . . . . . . . . . . . Getting the Server Mode . . . . . . . . . . . . Sample Use of HP Input Extensions . . . . . . . 7. 6-22 6-23 6-24 6-25 6-26 Internationalization Support Controlling Keyboard Input Using HP's X Window System . . . . . . . . . . . . . . . . . . .
1 Introduction to Xlib HP Extensions To provide better integration with existing products and peripherals available with HP 9000 computers, a number of extensions have been added to Hewlett-Packard's Xlib software. These extensions add to the existing X standard, creating a superset of functionality: The XLFD syntax has been extended to allow speci cations for increasing or decreasing boldness, changing the slant, mirroring, rotating, and increasing the horizontal size.
Warranty What This Manual Covers Note This manual covers the extensions to Xlib (Release 5, Version 11) that were created by Hewlett-Packard. Also covered are the X standard extended input functions that supersede the HP extended input functions. This manual does not document X standard Xlib, which is covered by the Xlib Reference Manual . The Multi-Bu ered Extension (MBX) is covered in PEXLIB Programming Guide by O'Reilly & Associates, Inc (HP Part Number B3176-90003).
Warranty Conventions Used in This Manual DRAFT 4/7/98 This document uses the following conventions: Global symbols in this manual are printed in this special font. These can be either function names, symbols de ned in include les, or structure names. Arguments are printed in italics . Each function is introduced by a general discussion that distinguishes it from other functions. The function declaration itself follows, and each argument is speci cally explained.
2 Font Extensions X11 supports scalable typefaces in addition to bitmapped fonts. The use of the XLFD (X Logical Font Description) for specifying either kind is covered in \Using Fonts" in the Using the X Window System manual. Hewlett-Packard has extended the XLFD conventions to provide for additional font capabilities. This chapter discusses how the XLFD name can be used to modify boldness, slant, and width, for either bitmapped fonts or scalable typefaces using the HP extensions.
Warranty Changing Font Slant The user can increase or decrease the slant of the font. The syntax for this extension is: Slant6value where: value Mirroring or Rotating The angle in 641 degree. Counterclockwise angles are indicated by +, clockwise angles by . The maximum slant is 675 . The user can specify that the font be rotated or mirrored. The syntax for this extension is: AddStyleName+Mx+My 6angle where: +Mx +My angle Changing Horizontal Size Mirrors the font horizontally.
Warranty setsize The set size in decipoints. If setsize is not speci ed, the set size is assumed to be the same as PointSize. If neither PixelSize nor PointSize is speci ed, 12-point is used. If both are speci ed and they con ict, an error is returned. Use either PixelSize or PointSize, but not both. Specifying a Character Subset The user can specify that only certain characters from the character set be used in creating a font from the scalable typeface.
3 Support for Multiple Error Handlers To establish multiple error handling routines for a single process (up to one routine per connection to the server), use XHPSetErrorHandler as follows: #include typedef int (*PFI) (); PFI XHPSetErrorHandler(display, routine) Display *display; int (*routine) (); int routine(display, error) Display XErrorEvent *display; *error; This function registers with Xlib the address of a routine to handle X errors.
4 Locking an X Display To provide better security for workstations and allow client programs to disable the key sequence used to reset the X server, the following functions may be used. Disabling the Reset Key Sequence The X server may be terminated by pressing a particular set of keys. By default, that set is 4left Shift5, 4CTRL5, and 4Reset5. To disable the reset key sequence, use XHPDisableReset. XHPDisableReset(display) Display display; display speci es the display.
5 X Input Device Extension Functions The functions described in this chapter allow client programs to access input devices other than the X keyboard and the X pointer. Note The functions described in this chapter supersede many of the HP extension functions described in Chapter 6. You should use the functions described in this chapter unless you require functionality that is only supported through the HP extension functions. Do not mix functions of the two types.
Warranty Receive the desired events via XNextEvent. Listing Input Devices To obtain a list of available input devices, use XListInputDevices. XDeviceInfo *XListInputDevices(display, ndevices return) Display *display; int *ndevices return; display ndevices return Speci es the connection to the X server. Speci es a pointer to a variable where the number of available devices can be returned. The XListInputDevices function lists the available input devices.
Warranty return an atom that can be compared with the type eld of the XDeviceInfo structure. The num classes eld is a number in the range 0-255 that speci es the number of input classes supported by the device for which information is returned by ListInputDevices. Some input classes, such as class Focus and class Proximity, do not have any information to be returned by ListInputDevices. The use eld speci es how the device is currently being used.
Warranty int length; short num buttons; } XButtonInfo The num buttons eld speci es the number of buttons that the device has. The XValuatorInfo structure describes the characteristics of the valuators on the device. It is de ned as follows: typedef struct _XValuatorInfo { XID class; int length; unsigned char num axes; unsigned char mode; unsigned long motion bu er; XAxisInfoPtr axes; } XValuatorInfo; The num axes eld contains the number of axes the device supports.
Warranty Freeing the List of Input Devices To free the XDeviceInfo array created by XListInputDevices, use XFreeDeviceList. XFreeDeviceList(list) XDeviceInfo *list; list Speci es a pointer to the list of XDeviceInfo structures to be freed. The XFreeDeviceList function frees the list of available extension input devices.
Warranty unsigned char input class; unsigned char event type base; } XInputClassInfo; The input class eld identi es one class of input supported by the device. De ned types include KeyClass, ButtonClass, ValuatorClass , ProximityClass, FeedbackClass, FocusClass, and OtherClass. The event type base identi es the event type of the rst event in that class.
Warranty XCloseDevice can generate a BadDevice error. Selecting Input from Extension Input Devices Selecting Extension Events To select input from an extended input device, use XSelectExtensionEvent int XSelectExtensionEvent(display, w, event list, event count) Display *display; Window w; XEventClass *event list; int event count; display w event list Speci es the connection to the X server. Speci es the window whose events you are interested in.
Warranty clients use in making XSelectExtensionEvent requests.
Warranty all clients event list return Returns a pointer to the list of event classes selected by all clients. The XGetSelectedExtensionEvents function reports the extension events selected by this client and all clients for the speci ed window. This function returns pointers to two event class arrays. One lists the input extension events selected by this client from the speci ed window. The other lists the event classes selected by all clients from the speci ed window.
Warranty If destination is InputFocus and if the focus window contains the pointer, the destination window is the window that contains the pointer; otherwise, the destination window is the focus window. To determine which clients should receive the speci ed events, XSendExtensionEvent uses the propagate argument as follows: If event count is zero, the event is sent to the client that created the destination window. If that client no longer exists, no event is sent.
Warranty count return Returns the number of event classes in the list returned by this request. The XGetDeviceDontPropagateList function returns a list of input extension events that will not be propagated to ancestors of the event window. An array of event classes is returned that identi es which events will not be propagated. XGetDeviceDontPropagateList can generate a BadClass or BadWindow error. You should use XFree to free the data returned by this function.
Warranty Getting Extended To get the device motion history, use XGetDeviceMotionEvents. Device Motion History XDeviceTimeCoord *XGetDeviceMotionEvents(display, device, start, stop, nevents return, mode return, axis count return) Display *display; XDevice *device; Time start, stop; int *nevents return; int *mode return; int *axis count return; display device start stop nevents return mode return Speci es the connection to the X server. Speci es the device whose motion history is to be queried.
Warranty The time member is set to the time, in milliseconds. The data member is a pointer to an array of integers. These integers are set to the values of each valuator or axis reported by the device. There is one element in the array per axis of motion reported by the device. The value of the array elements depends on the mode of the device. If the mode is Absolute, the values are the raw values generated by the device.
Warranty display device grab window owner events event count event list this device mode other devices mode time Speci es the connection to the X server. Speci es the device to be grabbed. Speci es the id of a window to be associated with the device. Speci es a Boolean value that indicates whether the events from the device are to be reported as usual or reported with respect to the grab window if the events are selected by the event list. Speci es the number of elements in the event list array.
Warranty lost while the device is frozen; they are simply queued in the server for later processing. If other devices mode is GrabModeAsync , processing of events from other devices is una ected by activation of the grab.
Warranty Grabbing Extended Input Device Buttons To grab extension input device buttons, use XGrabDeviceButton.
Warranty The XGrabDeviceButton function establishes a passive grab.
Warranty Ungrabbing Extended Input Device Buttons To ungrab an extended input device button, use XUngrabDeviceButton . int XUngrabDeviceButton(display, device, button, modi ers, modi er device, grab window) Display *display; XDevice *device; unsigned int button; unsigned int modi ers; XDevice *modi er device; Window grab window; display device button modi ers modi er device Speci es the connection to the X server. Speci es the device that is to be released.
Warranty owner events; event count; event list; this device mode, other devices mode; display Speci es the connection to the X server. device Speci es the device that is to be grabbed. key Speci es the device key that is to be grabbed or AnyKey. modi ers Speci es the set of keymasks or AnyModifier. The mask is the bitwise inclusive OR of the valid keymask bits. modi er device Speci es the device whose modi ers are to be used. If NULL is speci ed, the X keyboard will be used as the modi er device.
Warranty The interpretation of the remaining arguments is as for XGrabDevice. The active grab is terminated automatically when the logical state of the device has the speci ed keys released. Note that the logical state of a device (as seen by means of the X protocol) may lag the physical state if device event processing is frozen. If the key is not AnyKey, it must be in the range speci ed by min keycode and max keycode as returned by the XListInputDevices function. Otherwise, a BadValue error will result.
Warranty Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask. modi er device Speci es the device whose modi ers are to be used. If NULL is speci ed, the X keyboard will be used as the modi er device. Speci es the grab window. grab window The XUngrabDeviceKey function releases the passive key/modi er combination on the speci ed window if it was grabbed by this client.
Warranty AsyncThisDevice SyncThisDevice ReplayThisDevice AsyncOtherDevices SyncAllDevices 5-22 If the speci ed device is frozen by the client, event processing for that device continues as usual. If the device is frozen multiple times by the client on behalf of multiple separate grabs, AsyncThisDevice thaws for all. AsyncThisDevice has no e ect if the speci ed device is not frozen by the client.
Warranty AsyncAllDevices If all devices are frozen by the client, event processing for all devices continues normally. If any device is frozen multiple times by the client on behalf of multiple separate grabs, AsyncAllDevices thaws for all. AsyncAllDevices has no e ect unless all devices are frozen by the client. AsyncThisDevice, SyncThisDevice, and ReplayThisDevice have no e ect on the processing of events from the remaining devices.
Warranty results in a BadMatch error. A device that can be focused returns information for input class Focus when an XOpenDevice request is made. XGetDeviceFocus can generate BadDevice and BadMatch errors. Setting Extended Input To set the focus for an extended input device, use XSetDeviceFocus.
Warranty The speci ed focus window must be viewable at the time XSetDeviceFocus is called, or a BadMatch error results. If the focus window later becomes not viewable, the X server evaluates the revert to argument to determine the new focus window as follows: If revert to is RevertToParent , the focus reverts to the parent (or the closest viewable ancestor), and the new revert to value is taken to be RevertToNone .
Warranty rst keycode keycode count keysyms per keycode return Speci es the rst KeyCode to be returned. Speci es the number of KeyCodes to be returned. Returns the number of KeySyms per KeyCode. For the speci ed device, the XGetDeviceKeyMapping function returns the symbols for the speci ed number of KeyCodes starting with rst keycode . The value speci ed in rst keycode must be greater than or equal to min keycode as returned by XListInputDevices, or a BadValue error results.
Warranty device rst keycode keysyms per keycode keysyms keycode count Speci es the device whose key mapping is to be modi ed. Speci es the rst KeyCode to be changed. Speci es the number of KeySyms per KeyCode. Speci es the address of an array of KeySyms. Speci es the number of KeyCodes to be modi ed. For the speci ed device, the XChangeDeviceKeyMapping function de nes the symbols for the speci ed number of KeyCodes starting with rst keycode . The symbols for KeyCodes outside this range remain unchanged.
Warranty Getting the Modifier Mapping of Extended To get the modi er mapping of an extended input device, use XGetDeviceModifierMapping. Input Devices XModifierKeymap *XGetDeviceModifierMapping(display, device) Display *display; XDevice *device; display device Speci es the connection to the X server. Speci es the device whose modi er mapping is to be queried.
Warranty do not generate up transitions in hardware, if auto-repeat cannot be disabled on certain keys, or if multiple modi er keys are not supported. If such a restriction is violated, the status reply is MappingFailed , and none of the modi ers are changed. If the new KeyCodes speci ed for a modi er di er from those currently de ned and any (current or new) keys for that modi er are in the logically down state, XSetDeviceModifierMapping returns MappingBusy, and none of the modi ers are changed.
Warranty Changing the Device Button Mapping To change the device button mapping, use XSetDeviceButtonMapping. int XSetDeviceButtonMapping(display, device, map, nmap) Display *display; XDevice *device; unsigned char map[]; int nmap; display device Speci es the connection to the X server. Speci es the device whose button mapping is to be changed. Speci es the mapping list. Speci es the number of items in the mapping list.
Warranty the XOpenDevice request. For those devices that can be focused, XOpenDevice will return an XInputClassInfo structure with the input class eld equal to the constant FocusClass (de ned in the le XI.h). If the speci ed device is grabbed by another client, AlreadyGrabbed is returned. If the speci ed device is frozen by a grab on another device, GrabFrozen is returned. If the request is successful, Success is returned. A ChangeDeviceNotify event is sent to all clients that have selected that event.
Warranty Feedback Control These functions are provided to manipulate input devices that support feedbacks. A BadMatch error will be generated if the requested device does not support feedbacks. Whether or not a given device supports feedbacks can be determined by examining the information returned by the XOpenDevice request. For those devices that support feedbacks, XOpenDevice will return an XInputClassInfo structure with the input class eld equal to the constant FeedbackClass (de ned in the le XI.h).
Warranty typedef struct { XID class; int length; XID id; int accelNum; int accelDenom; int threshold; } XPtrFeedbackState; The accelNum eld returns the numerator for the acceleration multiplier. The accelDenom eld returns the denominator for the acceleration multiplier. The threshold eld returns the threshold for the acceleration. The XIntegerFeedbackState structure de nes the attributes that are returned for integer feedbacks.
Warranty int length; XID id; int percent; int pitch; int duration; } XBellFeedbackState; Bell feedbacks are those that can generate a sound. Some implementations may support a bell as part of a KbdFeedback feedback. Class BellFeedback is provided for implementations that do not choose to do so, and for devices that support multiple feedbacks that can produce sound. The meaning of the elds is the same as that of the corresponding elds in the XKbdFeedbackState structure.
Warranty moves three times as fast as normal. The fraction may be rounded arbitrarily by the X server. Accelerations only takes e ect if the device moves more that the threshold pixels at once and only applies to the amount beyond the value in the threshold argument. Setting a value to -1 restores the default. The values of the accelNum and threshold elds must be nonzero for the pointer values to be set. Otherwise, the parameter will be unchanged.
Warranty #define DvInteger typedef struct { XID class; int length; XID id; int int to display; } XIntegerFeedbackControl; (1L<<0) The XBellFeedbackControl structure de nes the attributes that can be controlled for Bell feedbacks.
Warranty The XGetFeedbackControl function returns a pointer to a list of XFeedbackState structures. Each item in this list describes one of the feedbacks supported by the device. The items are variable length, so each contains its length to allow traversal to the next item in the list. The feedback classes that are currently de ned are: KbdFeedbackClass, PtrFeedbackClass, StringFeedbackClass, IntegerFeedbackClass , LedFeedbackClass, and BellFeedbackClass. These constants are de ned in the le XI.h.
Warranty Miscellaneous Functions Changing the Mode of an Input Device To change the mode of a device, use XSetDeviceMode. int XSetDeviceMode(display, device, mode) Display *display; XDevice *device; int mode; display device mode Speci es the connection to the X server. Speci es the device whose mode is to be changed. Speci es the mode. You can pass Absolute or Relative.
Warranty typedef struct { unsigned char class; unsigned char length; unsigned char num valuators; unsigned char mode; int *valuators; } XValuatorState; The XKeyState structure contains: typedef struct { unsigned char class; unsigned char length; unsigned char num keys; char keys[32]; } XKeyState; The XButtonState structure contains: typedef struct { unsigned char class; unsigned char length; unsigned char num buttons; char buttons[32]; } XButtonState; Finding the Extension Version To nd the version of t
Warranty Ringing a Bell on an To ring a bell on a extension input device, use XDeviceBell. Extension Input Device void XDeviceBell (display, device, feedbackclass, feedbackid, percent) Display *display; XDevice *device; XID feedbackclass, feedbackid; int percent; display device feedbackclass Speci es the connection to the X server. Speci es the desired device. Speci es the feedbackclass. Valid values are KbdFeedbackClass and BellFeedbackClass. Speci es the id of the feedback that has the bell.
Warranty display device Speci es the connection to the X server. Speci es the device whose valuators are to be initialized. valuators Speci es the values to which each valuator is to be set. rst valuator Speci es the rst valuator to be set. num valuators Speci es the number of valuators to be set. This function initializes the speci ed valuators on the speci ed extension input device. Valuators are numbered beginning with zero.
Warranty the speci ed control and is mapped by a structure appropriate for that control. The rst two elds are common to all device controls: typedef struct { XID control; int length; } XDeviceState; The control may be compared to constants de ned in the le XI.h. Currently de ned device controls include DEVICE_RESOLUTION.
Warranty Status XChangeDeviceControl (display, device, control, value) Display *display; XDevice *device; XID control; XDeviceControl *value; display device control value Speci es the connection to the X server. Speci es the device whose con guration control status is to be modi ed. Identi es the speci c device control to be changed. Speci es a pointer to an XDeviceControl structure that describes which control is to be changed, and how it is to be changed.
Warranty beginning with zero. Only the valuators in the range speci ed by rst valuator and num valuators are set. A value of -1 in the resolutions list indicates that the resolution for this valuator is not to be changed. The num valuators eld speci es the number of valuators in the resolutions list. When this control is speci ed, XChangeDeviceControl fails with a BadMatch error if the speci ed device has no valuators.
Warranty 100, 100, 1, BlackPixel(display,0), WhitePixel(display,0)); XMapWindow (display, my); XSync(display,0); slist=list=(XDeviceInfoPtr) XListInputDevices (display, &ndevices); for (i=0; iinputclassinfo); for (j=0; jnum_classes; j++) { if (any->class == KeyClass) { K = (XKeyInfoPtr) any; printf ("device %s:\n",list->name); printf ("num_keys=%d min_keycode=%d max_keycode=%d\n\n", K->num_keys,K->min_keycode,K->max_keycode); } else if (any->clas
Warranty 5-46 X Input Device Extension Functions DRAFT 4/7/98 12:51
6 HP Input Device Extension Functions Prior to the addition of the X input device extension functions described in Chapter 5, the standard model for the X Window System consisted of a keyboard and a mouse. Although this met the needs of most users, it did not provide a way to easily use multiple input devices at the same time, and it did not accommodate applications in which a mouse was not the most appropriate input device.
Warranty Listing Available Input Devices To obtain a list of available input devices, use XHPListInputDevices . XHPDeviceList *XHPListInputDevices(display, ndevices) Display *display; int *ndevices; /* RETURN */ display ndevices Speci es the connection to the X server. Speci es as a return value the number of devices available. XHPListInputDevices returns information about the input devices that are available to the X server, including the standard X keyboard and pointer devices.
Warranty is always listed second and has an x id eld equal to the constant XKEYBOARD. In general, attempting to access the X keyboard or pointer devices using the HP extension functions generates a BadDevice error. A variety of device types are de ned in < X11/XHPlib.h >.
Warranty Enabling Extended Input Devices To enable an extended input device, use XHPSetInputDevice. int XHPSetInputDevice(display,deviceid,mode) Display *display; XID deviceid; int mode; display deviceid mode Speci es the connection to the X server. Speci es the device to open or close. This is a deviceid listed in the XHPDeviceList structure. Controls the mode to which the device is set. Valid values are ON|SYSTEM_EVENTS, ON|DEVICE_EVENTS, and OFF.
Warranty eventtype mask Address of a variable into which the server can return the event type for the extended input event. Address of a variable into which the server can return the event mask to use in selecting that event. The client program must request the event mask and event type to be used in selecting the events returned by devices. It does this by calling the server with a constant that corresponds to the desired event. The server returns the event mask and event type for the desired event.
Warranty Selecting Input From Extended Input Devices To select input from an extended input device, use XHPSelectExtensionEvent. XHPSelectExtensionEvent(display, window, deviceid, mask) Display *display; Window window; XID deviceid; Mask mask; display window Speci es the connection to the X server. Speci es the window ID. Client applications interested in an event for a particular window pass that window's ID. Speci es the device from which input is desired. Speci es the mask of input events.
Warranty Grabbing Extended To actively grab an extended input device, use XHPGrabDevice. Input Devices int XHPGrabDevice(display, deviceid, grab window, owner events, pointer mode, device mode, time) Display *display; XID deviceid; Window grab window; Bool owner events; int pointer mode; int device mode; Time time; display device id grab window owner events pointer mode device mode time Speci es the connection to the X server. Speci es the ID of the device to grab.
Warranty Ungrabbing Extended Input Devices To release a previously grabbed extended input device, use XHPUngrabDevice. int XHPUngrabDevice(display, deviceid, time) Display *display; XID deviceid; Time time; display deviceid time Speci es the connection to the X server. Speci es the ID of the device to grab. Speci es the time. You can pass either a timestamp, expressed in milliseconds, or CurrentTime. The XHPUngrabDevice function releases the input device.
Warranty grab window owner events event mask You can also pass AnyModifier, which is equivalent to issuing the grab request for all possible modi er combinations (including the combination of no modi ers). Speci es the ID of a window associated with the device speci ed above. Speci es a boolean value of either True or False. Speci es which device events are to be reported to the client.
Warranty Ungrabbing Extended Input Device Buttons To release previously grabbed extended input device buttons, use XHPUngrabDeviceButton. int XHPUngrabDeviceButton(display, deviceid, button, modi ers, ungrab window) Display *display; XID deviceid; unsigned int button; unsigned int modi ers; Window ungrab window; display deviceid button modi ers ungrab window Speci es the connection to the X server. Speci es the ID of the desired device. Speci es the code of the button that is to be ungrabbed.
Warranty Grabbing Extended Input Device Keys To passively grab a particular key on an extended input device, use XHPGrabDeviceButton . int XHPGrabDeviceKey(display, deviceid, keycode, modi ers, grab window, owner events, pointer mode, device mode) Display *display; XID deviceid; unsigned int keycode; unsigned int modi ers; Window grab window; Bool owner events; int pointer mode, device mode; display Speci es the connection to the X server. deviceid Speci es the ID of the desired device.
Warranty XHPGrabDeviceKey can generate BadDevice, BadAccess, BadWindow, and BadValue errors. Ungrabbing Extended Input Device Keys To release previously grabbed extended input device keys on an extended input device, use XHPUngrabDeviceKey. int XHPUngrabDeviceKey(display, deviceid, keycode, modi ers, ungrab window) Display *display; XID deviceid; unsigned int keycode; unsigned int modi ers; Window ungrab window; display deviceid keycode modi ers ungrab window Speci es the connection to the X server.
Warranty Getting Extended Input Device Focus To obtain the focus window id and current focus state of an extended input device, use XHPGetDeviceFocus. int XHPGetDeviceFocus(display, deviceid, focus return, revert to return) Display *display; XID deviceid; Window *focus return; /* RETURN */ int *revert to return; /* RETURN */ display deviceid focus return revert to return Speci es the connection to the X server. Speci es the ID of the device to examine. Returns the focus window ID, PointerRoot, or None.
Warranty than the current X server time. Otherwise, the last-focus-change time is set to the speci ed time (CurrentTime is replaced by the current X server time). This function causes the X server to generate XHPDeviceFocusIn and XHPDeviceFocusOut events. Depending on what value you assign to the focus argument, XHPSetDeviceFocus executes as follows: If you assign None to the to the focus argument, all device events are discarded until a new focus window is set, and the revert to argument is ignored.
Warranty Getting Current Extended Input Event Selection Masks To obtain the current event selection mask for a speci ed extended input device and window, use XHPGetCurrentDeviceMask. int XHPGetCurrentDeviceMask(display, window, deviceid, mask return) Display *display; Window window; XID deviceid; Mask *mask return; /* RETURN */ display window deviceid mask return Speci es the connection to the X server. Speci es the window ID of the window to examine. Speci es the ID of the device to examine.
Warranty start stop Specify the time interval in which the events are returned from the motion history bu er. You can pass a time stamp, expressed in milliseconds, or CurrentTime . If the stop time is in the future, it is equivalent to specifying CurrentTime. nevents return Returns the number of events from the motion history bu er. The XHPGetDeviceMotionEvents function returns all events in the motion history bu er that fall between the speci ed start and stop times, inclusive.
Warranty Disabling Auto-Repeat for Extended Input Devices To disable auto-repeat for an extended input device, use XHPDeviceAutoRepeatOff. int XHPDeviceAutoRepeatOff(display, deviceid) Display *display; XID deviceid; display deviceid Speci es the connection to the X server. Speci es the ID of the desired device. XHPDeviceAutoRepeatOff is provided to support the use of input devices other than the X keyboard and X pointer device. It cannot be used to turn auto-repeat o for the X keyboard device.
Warranty Sending an Acknowledge to Extended Input Devices To send an acknowledge signal to an extended input device, use XHPAcknowledge. int XHPAcknowledge(display, deviceid, acknowledge) Display *display; XID deviceid; unsigned int acknowledge; display deviceid acknowledge Speci es the connection to the X server. Speci es the ID of the desired device. Speci es the acknowledge to be sent.
Warranty XHPGetDeviceControl returns the control attributes of the device in the XHPDeviceState structure, which is de ned as follows: typedef struct { int int unsigned int unsigned int unsigned long int int int int char } XHPDeviceState; key click percent; bell percent; bell pitch; bell duration; led mask; global auto repeat; accelNumerator; accelDenominator; threshold; auto repeats[32]; For the LEDs, the least signi cant bit of led mask corresponds to LED one, and each bit set to 1 in led mask indicate
Warranty values Speci es a pointer to the XHPDeviceControl structure containing the values to be changed. XHPChangeDeviceControl allows the control attributes of input devices (other than the X keyboard and X pointer devices) to be changed. The speci ed device must have previously been opened (turned on) with XHPSetInputDevice. The attributes to be changed are speci ed in the XHPDeviceAttributes structure. They are not actually changed unless the corresponding bit is set in the value mask parameter.
Warranty from one) are supported. No standard interpretation of LEDs is de ned. If an led is speci ed without an led mode , a BadMatch error is generated. If both the auto repeat mode and key members are speci ed, the key and auto repeat mode members are speci ed, the auto repeat mode of that key is changed according to AutoRepeatModeOn, AutoRepeatModeOff, or AutoRepeatModeDefault, if possible.
Warranty max keycode must be greater than f irst keycode +keycode count01. If either of these conditions is not met, the function returns a BadValue error. The number of elements in the KeySyms list is: keycode count 3 keysyms per code + N . KeySym number N (counting from zero) for KeyCode K has the following index in keysyms: (K 0 f irst keycode wanted) 3 keysyms per keycode return + N .
Warranty speci ed device must have previously been opened (turned on) with XHPSetInputDevice. Starting with rst keycode , XHPChangeDeviceKeyMapping de nes the symbols for the speci ed number of keycodes. The symbols for keycodes outside this range remain unchanged. The number of elements must be: num codes 3 keysyms per keycode. (Otherwise, a BadLength error is generated.) The speci ed rst keycode must be greater than or equal to min keycode as reported by the XHPListInputDevices request.
Warranty XHPSetDeviceModifierMapping speci es the KeyCodes of the keys, if any, that are to be used as modi ers for the speci ed input device. X permits up to eight modi er keys. If more than eight are speci ed in the XModifierKeymap structure, a BadLength error is generated. There are eight modi ers, and the modi ermap member of the XModifierKeymap structure contains eight sets of max keypermod KeyCodes, one for each modi er in the order Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod 5.
Warranty Getting the Server Mode Some displays have both image and overlay planes. For such displays there are four combinations of image and overlay planes in which the server can run. To get the current mode of a speci ed screen, use XHPGetServerMode. int XHPGetServerMode(display, screen) Display *display; int screen; display screen Speci es the connection to the X server. Speci es the number of the screen whose mode is requested.
Warranty Sample Use of HP Input Extensions Note The following sample program, which creates a window and selects input from it, uses the HP Input device extension functions to access input devices other than the X pointer and keyboard. The functions used in this example are supported for compatibility with earlier versions of HP Xlib. Refer to the \Sample X Input Device Extension Program" in Chapter 5 for a sample program that uses the newer X standard input extension functions.
Warranty { XNextEvent (display,&event); if (event.type == devkeyp) printf ("Device key press event device=%d\n", ((XHPDeviceKeyEvent * ) &event)->deviceid); else if (event.type == devbutp) { b = (XHPDeviceButtonEvent * ) &event; printf ("Device button press event device=%d\n", b->deviceid); if (b->ev.
7 Internationalization Support An internationalized application is adaptable to the requirements of di erent native languages, local customs, and character string encodings. The process of adapting the operation to a particular native language, local custom, or string encoding is called localization. A goal of internationalization is to permit localization without program source modi cations or recompilation.
Warranty The X Window System uses the concept of keysyms to control the mapping of keys into characters. The set of keysyms for a particular keyboard is organized into a table called the keymap. To get information about keyboard mapping or to set the keyboard mapping use the xmodmap command.
Warranty xmodmap: up to 3 keys per modifier, (keycodes in parentheses): shift lock control mod1 mod2 mod3 mod4 mod5 Shift_R (0xc), Shift_L (0xd) Caps_Lock (0x37) Control_L (0xe) Meta_R (0xa) Mode_switch (0xb) The keyboard then uses the left extend-char key for extended characters and the right extend-char key for Meta. The client must be linked against R4 or R5 Xlib for this to work.
Warranty keysym name diacritic character hpmute_acute hpmute_grave hpmute_asciicircum hpmute_diaeresis hpmute_asciitilde acute diaeresis ^ ~ To nd out which muting diacritics are supported by a keyboard type: xmodmap -pk The entries in the third and fourth column of the keymap are the extend and shift-extend characters. To set the mute keysyms as they are for HP series 700 terminals execute: xmodmap mutes where mutes is a le containing the following ve lines.
Warranty ~ Input Method Support ~ The phrase input method is used in this chapter to describe whatever mechanism is used to convert keystrokes into characters. Input methods are described in the Xlib Reference Manual . The input methods for most languages supported by HP are simple input methods and require no additional support beyond that provided by Xlib.
Warranty Use of Asian Input Method Servers Users who wish to select from among multiple input servers available on a system may set the input method modi er. This can be set using the XmNinputMethod resource for Motif 1.2 applications, or the XMODIFIERS environment variable for non-Motif 1.2 applications. If the value is HPNLIO, then use of an NLIO-style input method is indicated. This is also the default if no value is speci ed.
Warranty Internationalized Output X11 R5 provides support for internationalized output through the use of font sets, which are accessed through XCreateFontSet and its associated routines. That X standard capability should be used instead of the associate font mechanism explained in this chapter. The associate font mechanism explained here was provided by HP to support internationalized text output before the X standard supported this functionality.
Warranty 1. There exists a language designation in the speci ed font. The XLoadFont and XLoadQueryFont functions look for the language designation in the following order: First examine the value of the font property LANGUAGE. This is an 8-bit STRING type property. Next examine the value of the environment variable LANG. Currently, japanese, japanese.euc, korean, chinese-s, and chinese-t are supported as valid LANGUAGE property or LANG environment variable designations. 2.
Warranty Checking for 16-bit Characters To determine if two bytes are de ned as a 16-bit character for a speci ed font, use XHPIs16bitCharacter . Bool XHPIs16bitCharacter(font, byte1, byte2) Font font; unsigned char byte1, byte2; font byte1 byte2 Speci es the font to check for a 16-bit character. Speci es the rst byte of a 16-bit character. Speci es the second byte of a 16-bit character. XHPIs16bitCharacter returns True if byte1 and byte2 are de ned as the rst and second bytes of a 16-bit character.
Warranty Note 7-10 Most of the KeySyms returned by XHPRoman8ToKeysym will be ISO Latin-1 and various terminal functions. Two of the characters in the Roman 8 set ('S' with caron and 's' with caron) convert to Keysyms in the ISO Latin-2 set.