Query: xhpgetdevicefocus
OS: hpux
Section: 3x
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XHPGetDeviceFocus(3X) XHPGetDeviceFocus(3X)NAMEXHPGetDeviceFocus - Get the focus window ID for an extension input device. XHPGetDeviceMotionEvents - Get the motion history buffer for a device. XHPGetDeviceControl - Get the control attributes of an extension input device. XHPGetDeviceKeyMapping - Get the key mapping of an extension input device. XHPGetDeviceModifierMapping - Get the modifier mapping of an extension input device.SYNOPSISint XHPGetDeviceFocus (display, deviceid, focus_return, revert_to_return) Display *display; XID deviceid; Window *focus_return; int *revert_to_return; XHPTimeCoord *XHPGetDeviceMotionEvents (display, deviceid, w, start, stop, nevents_return) Display *display; XID deviceid; Window w; Time start, stop; int *nevents_return; int XHPGetDeviceControl (display, deviceid, values_return) Display *display; XID deviceid; XHPDeviceState *values_return; KeySym *XHPGetDeviceKeyMapping (display, deviceid, first_keycode_wanted, keycode_count, keysyms_per_keycode_return) Display *display; XID deviceid; KeyCode first_keycode_wanted; int keycode_count; int *keysyms_per_keycode_return; XModifierKeymap *XHPGetDeviceModifierMapping (display, deviceid) Display *display; XID deviceid;ARGUMENTSdisplay Specifies the connection to the X server. deviceid Specifies the ID of the desired device. XHPGetDeviceFocus Only focus_return Specifies the address of a variable into which the server can return the ID of the window that contains the device focus. revert_to_return Specifies the address of a variable into which the server can return the current revert_to status for the device. XHPGetDeviceMotionEvents Only window Must contain the constant ALLWINDOWS. start Specifies the start time. stop Specifies the stop time. nevents_return Specifies the address of a variable into which the server will return the number of events in the motion buffer returned for this request. XHPGetDeviceControl Only values_return Specifies a pointer to an XHPDeviceState structure in which the device values will be returned. XHPGetDeviceKeyMapping Only first_keycode_wanted Specifies the first keycode that is to be returned. keycode_count Specifies the number of keycodes that are to be returned. keysyms_per_keycode_return Returns the number of keysyms per keycode.DESCRIPTIONThese requests are part of an HP-proprietary extension to X. Their functionality has been superseded by standard X input device extension requests. You should use XGetDeviceFocus instead of XHPGetDeviceFocus, XGetDeviceMotionEvents instead of XHPGetDeviceMotionEvents, XGetFeedbackControl instead of XHPGetDeviceControl, XGetDeviceKeyMapping instead of XHPGetDeviceKeyMapping, and XGetDeviceModifierMapping instead of XHPGetDeviceModifierMapping if possible. These requests are provided to support the use of input devices other than the X keyboard device and X pointer device. XHPGetDeviceFocus XHPGetDeviceFocus allows a client to determine the focus for a particular extended input device. It returns the focus window id and the current focus state of the specified extended input device. This request may not be used to determine the focus of the X keyboard device. The XGetInputFocus request should be used for that purpose. XHPGetDeviceMotionEvents This request returns all events in the device's motion history buffer that fall between the specified start and stop times inclusive. If the start time is in the future, or is later than the stop time, no events are returned. For all currently supported input devices, the window parameter must be the constant ALLWINDOWS, which can be obtained by including <X11/XHPlib.h>. The return type for this request is a structure defined as follows: typedef struct { Time time; unsigned short *data; } XHPTimeCoord; In order to correctly interpret the data returned by this request, client programs need information about the device that generated that data. This information is reported by the XHPListInputDevices request. The data field of the XHPTimeCoord structure is a pointer to an array of data items. Each item is of type short, and there is one data item per axis of motion reported by the device. The number of axes reported by the device can be determined from the num_axes field of the HPDeviceList structure for the device that is returned by the XHPListInputDevices request. The value of the data items depends on the mode of the device, which is reported in the mode field of the XHPDeviceList request, and may be compared to constants defined in <X11/XHPlib.h>. If the mode is ABSOLUTE, the data items are the raw values generated by the device. These may be scaled by the client program using the maximum values that the device can generate for each axis of motion that it reports. The maximum value for each axis is reported in the XHPaxis_info structure pointed to by the XHPDeviceList structure. If the mode is RELATIVE, the data items are the relative values generated by the device. The client program must choose an initial position for the device and maintain a current position by accumulating these relative values. The client program should use XFree to free the data returned by this request. This request is not valid for the X pointer device, or for devices that do not generate motion events. Invoking this request for an invalid device will result in a BadDevice error. The motion history buffer for the X pointer device can be obtained by using the XGetMotionEvents(3x) request.EXAMPLEThe following code fragment shows how positional data could be received from a graphics tablet via the motion buffer. It assumes that the client only is interested in the first two axes of motion. #include <X11/XHPlib.h> /* Find the graphics tablet information via XHPListInputDevices */ /* Scale the input to a window whose origin is at winx, winy */ /* and whose size is winw by winh. */ slist = XHPListInputDevices (disp, &ndevices); for (i=0,list=slist; i<ndevices; i++,list++) if (list->type == TABLET) { XHPSetInputDevice (disp, list->x_id, (ON | DEVICE_EVENTS)); tablet = list->x_id; ax = list->axes; if (list->mode == ABSOLUTE) { scalex = (float) winw / (float) (ax++)->max_val; scaley = (float) winh / (float) (ax++)->max_val; } else { scalex = 1; scaley = 1; } axes = list->num_axes; } XHPFreeDeviceList (slist); buf = XHPGetDeviceMotionEvents (disp, tablet, ALLWINDOWS, start, stop, &nevents); savbuf = buff; for (i=0; i<nevents; i++) { dp = buf->data; time = buf->time; x = winx + (*dp++ * scalex); y = winy + (*dp++ * scaley); /* now do something with the motion data. */ buf++; } XFree (savbuf); XHPGetDeviceControl The XHPGetDeviceControl request returns the control attributes of the device in the XHPDeviceState structure. The fields of the XHPDeviceState structure are defined as follows: typedef struct { int key_click_percent; int bell_percent; unsigned int bell_pitch; unsigned int bell_duration; unsigned long led_mask; int global_auto_repeat; int accelNumerator; int accelDenominator; int threshold; char auto_repeats[32]; } XHPDeviceState; For the LEDs, the least significant bit of led_mask corresponds to LED one, and each bit set to 1 in led_mask indicates an LED that is lit. The auto_repeats member is a bit vector. Each bit set to 1 indicates that auto-repeat is enabled for the corresponding key. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N+7, with the least significant bit in the byte representing key 8N. The global_auto_repeat member can be set to either AutoRepeatModeOn or AutoRepeatModeOff. XHPGetDeviceKeyMapping The XHPGetDeviceKeyMapping request, starting with first_keycode, returns the symbols for the specified number of KeyCodes. The value specified in the first_keycode argument must be greater than or equal to min_keycode as returned by the XHPListInputDevices request. Otherwise, XHPGetDeviceKeyMapping generates a BadValue error. In addition, the following expression must be less than or equal to max_keycode as returned by the XHPListInputDevices request: first_keycode + keycode_count - 1 If this is not the case, a BadValue error is generated. The number of elements in the KeySyms list is: keycode_count * keysyms_per_keycode_return KeySym number N, counting from zero, for KeyCode K has the following index in the list, counting from zero: (K - first_code) * keysyms_per_code + N The keysyms_per_keycode_return value is chosen arbitrarily by the X server to be large enough to report all requested symbols. A special KeySym value of NoSymbol is used to fill in unused elements for individual KeyCodes. To free the storage returned by XHPGetDeviceKeyMapping, use XFree. XHPGetDeviceModifierMapping The XHPGetDeviceModifierMapping request returns a newly created XModifierKeymap structure that contains the keys being used as modifiers for the specified device. The structure should be freed after use by calling XFreeModifiermap. If only zero values appear in the set for any modifier, that modifier is disabled.DIAGNOSTICSXHPGetDeviceKeyMapping can generate BadDevice and BadValue errors. BadDevice The specified device does not exist, was not previously enabled via XHPSetInputDevice, or is the X system pointer or X system keyboard. BadValue One of the values specified was beyond the range of valid values.RETURN VALUEXHPGetDeviceMotionEvents returns a pointer to the motion history buffer. XHPGetDeviceKeyMapping returns a pointer to an array of KeySyms. XHPGetDeviceModifierMapping returns an XModifierMap structure that contains the keys being used as modifiers for the device.FILESnoneORIGINHewlett-Packard CompanySEE ALSOXGetInputFocus(3x) XHPListInputDevices(3x) XHPSetDeviceFocus(3x) XGetMotionEvents(3x) XHPListInputDevices(3x) XHPChangeDeviceControl(3x) XGetKeyboardControl(3x) XChangeKeyboardControl(3x) XGetPointerControl(3x) XChangePointerControl(3x) XHPChangeDeviceKeyMapping(3x) XGetKeyboardMapping(3x) XChangeKeyboardMapping(3x) XGetModifierMapping(3x) XChangeModifierMapping(3x) XHPSetDeviceModifierMapping(3x) X Version 11 Release 5 XHPGetDeviceFocus(3X)