HPlogo HP Xlib Extensions: > Chapter 6 HP Input Device Extension Functions

Setting Extended Input Device Focus

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

To set the input focus of an extended input device, use XHPSetDeviceFocus.

int XHPSetDeviceFocus(display, deviceid, focus, revert_to, time)
Display *display;
XID deviceid;
Window focus;
int revert_to;
Time time;

Title not available (Setting Extended Input Device Focus )

display

Specifies the connection to the X server.

deviceid

Specifies the ID of the extended device.

focus

Specifies the window ID. This is the window in which you want to set the input focus. You can pass a window ID, PointerRoot or None.

revert_to

Specifies which window the input focus reverts to if the window becomes not viewable. You can pass RevertToParent, RevertToPointerRoot, or RevertToNone.

time

Specifies the time. You can pass either a timestamp, expressed in milliseconds, or CurrentTime.

The XHPSetDeviceFocus function changes the input focus and the last-focus-change time. The function has no effect if the specified time is earlier than the current last-focus-change time or is later than the current X server time. Otherwise, the last-focus-change time is set to the specified 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.

  • If you assign a window ID to the focus argument, it becomes the device's focus window. If a generated device event would normally be reported to this window or one of its inferiors, the event is reported normally. Otherwise, the event is reported relative to the focus window.

  • If you assign PointerRoot to the focus argument, the focus window is dynamically taken to be the root window of whatever screen the pointer is on at each device event. In this case, the revert_to argument is ignored.

The specified focus window must be viewable at the time XHPSetDeviceFocus is called. Otherwise, a BadMatch error is generated. If the focus window later becomes not viewable, the X server evaluates the revert_to argument to determine the new focus window:

  • If you assign RevertToParent to the revert_to argument, the focus reverts to the parent (or the closest viewable ancestor), and the new revert_to value is taken to be RevertToNone.

  • If you assign RevertToPointerRoot or RevertToNone to the revert_to argument, the focus reverts to PointerRoot or None, respectively. The X server generates HPDeviceFocusIn and HPDeviceFocusOut events when the focus reverts, but the last-focus-change time is not affected.

XHPSetDeviceFocus can generate BadMatch, BadValue, BadWindow, and BadDevice errors.

© 1995 Hewlett-Packard Development Company, L.P.