|
|
HP Xlib Extensions: > Chapter 5 X Input Device Extension FunctionsGrabbing and Ungrabbing Extension Input Devices |
|
To grab a specified extension device, use XGrabDevice.
Title not available (Grabbing Extended Input Devices )
The XGrabDevice function actively grabs control of the device and generates DeviceFocusIn and DeviceFocusOut events. Further device events are reported only to the grabbing client. XGrabDevice overrides any active device grab by this client. The event_list argument is a pointer to a list of event classes. This list indicates which events the client wishes to receive while the grab is active. If owner_events is False, all generated device events are reported with respect to grab_window if selected. If owner_events is True and if a generated device event would normally be reported to this client, it is reported normally; otherwise, the event is reported with respect to the grab_window, and is only reported if specified in the event_list. The this_device_mode parameter controls further processing of events from this device and the other_device_mode parameter controls the further processing of events from all other devices. If this_device_mode is GrabModeAsync, device event processing continues as usual. If the device is currently frozen by this client, then processing of device events is resumed. If this_device_mode is GrabModeSync, the state of the device (as seen by client applications) appears to freeze, and the X server generates no further device events until the grabbing client issues a releasing XAllowDeviceEvents call or until the device grab is released. Actual device changes are not 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 unaffected by activation of the grab. If other_devices_mode is GrabModeSync, the state of all devices except the grabbed device (as seen by client applications) appears to freeze, and the X server generates no further events from those devices until the grabbing client issues a releasing XAllowDeviceEvents call or until the device grab is released. Actual events are not lost while the devices are frozen; they are simply queued in the server for later processing. If the device is actively grabbed by some other client, XGrabDevice fails and returns AlreadyGrabbed. If grab_window is not viewable, it fails and returns GrabNotViewable. If the device is frozen by an active grab of another client, it fails and returns GrabFrozen. If the specified time is earlier than the last-device-grab time or later than the current X server time, it fails and returns GrabInvalidTime. Otherwise, the last-device-grab time is set to the specified time (CurrentTime is replaced by the current X server time). If a grabbed device is closed by a client while an active grab by that client is in effect, the active grab is released. If the device is frozen only by an active grab of the requesting client, it is thawed. XGrabDevice can generate BadClass, BadDevice, BadValue, and BadWindow errors. To ungrab a specified extension device, use XUngrabDevice.
Title not available (Ungrabbing Extended Input Devices )
The XUngrabDevice function releases the device and any queued events if this client has it actively grabbed from XGrabDevice, XGrabDeviceButton, or XGrabDeviceKey. If other devices are frozen by the grab, XUngrabDevice thaws them. XUngrabDevice does not release the device and any queued events if the specified time is earlier than the last-device-grab time or is later than the current X server time. It also generates DeviceFocusIn and DeviceFocusOut events. The X server automatically performs an UngrabDevice request if the event window for an active device grab becomes not viewable. XUngrabDevice can generate a BadDevice error. To grab extension input device buttons, use XGrabDeviceButton.
Title not available (Grabbing Extended Input Device Buttons )
The XGrabDeviceButton function establishes a passive grab. When the specified button is pressed, the device is actively grabbed (as for XGrabDevice), the last-grab time is set to the time at which the button was pressed (as transmitted in the DeviceButtonPress event), and the DeviceButtonPress event is reported if all the following conditions are true:
The interpretation of the remaining arguments is as for XGrabDevice. The active grab is terminated automatically when the logical state of the device has all buttons released (independent of the logical state of the modifier keys). Note that the logical state of a device (as seen by client applications) may lag the physical state if device event processing is frozen. This request overrides all previous grabs by the same client on the same button modifier combinations on the same window. A modifiers of AnyModifier is equivalent to issuing the grab request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified have currently assigned KeyCodes. A button of AnyButton is equivalent to issuing the request for all possible buttons. Otherwise, it is not required that the specified button currently be assigned to a physical button. If some other client has already issued a XGrabDeviceButton with the same button modifier combination on the same window, a BadAccess error results. If AnyModifier was specified for the modifiers argument or AnyButton for the key argument, the request fails completely, and a BadAccess error results (no grabs are established), if there is a conflicting grab for any combination. XGrabDeviceButton has no effect on an active grab. XGrabDeviceButton can generate BadClass, BadDevice, BadMatch, BadValue, and BadWindow errors. To ungrab an extended input device button, use XUngrabDeviceButton.
Title not available (Ungrabbing Extended Input Device Buttons )
The XUngrabDeviceButton function releases the passive grab for a button modifier combination on the specified window if it was grabbed by this client. A modifiers of AnyModifier is equivalent to issuing the ungrab request for all possible modifier combinations, including the combination of no modifiers. A button of AnyButton is equivalent to issuing the request for all possible buttons. XUngrabDeviceButton has no effect on an active grab. XUngrabDeviceButton can generate BadDevice, BadMatch, BadValue, and BadWindow errors. To grab an extension input device key, use XGrabDeviceKey.
Title not available (Grabbing Extended Input Device Keys )
The XGrabDeviceKey function establishes a passive grab. In the future, the device is actively grabbed (as for XGrabDevice), the last-device-grab time is set to the time at which the Key was pressed (as transmitted in the DeviceKeyPress event), and the DeviceKeyPress event is reported if all the following conditions are true:
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 specified 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 specified by min_keycode and max_keycode as returned by the XListInputDevices function. Otherwise, a BadValue error will result. This request overrides all previous grabs by the same client on the same key modifier combinations on the same window. A modifiers of AnyModifier is equivalent to issuing the grab request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified have currently assigned KeyCodes. A key of AnyKey is equivalent to issuing the request for all possible keys. Otherwise, it is not required that the specified key currently be assigned to a physical key. If some other client has already issued a XGrabDeviceKey with the same key modifier combination on the same window, a BadAccess error results. When using AnyModifier or AnyKey, the request fails completely, and a BadAccess error results (no grabs are established) if there is a conflicting grab for any combination. XGrabDeviceKey has no effect on an active grab. XGrabDeviceKey can generate BadAccess, BadClass, BadDevice, BadMatch, BadValue, and BadWindow errors. It returns Success on successful completion of the request. To ungrab an extended input device key, use XUngrabDeviceKey.
Title not available (Ungrabbing Extended Input Device Keys )
The XUngrabDeviceKey function releases the passive key/modifier combination on the specified window if it was grabbed by this client. A modifier of AnyModifier is equivalent to issuing the ungrab request for all possible modifier combinations, including the combination of no modifiers. A key of AnyKey is equivalent to issuing the request for all possible keys. XUngrabDeviceKey has no effect on an active grab. XUngrabDeviceKey can generate BadDevice, BadMatch, BadValue, and BadWindow errors. To release queued events, use XAllowDeviceEvents.
Title not available (Releasing Queued Events )
The XAllowDeviceEvents function releases some queued events if the client has caused a device to freeze. It has no effect if the specified time is earlier than the last-grab time of the most recent active grab for the client and device, or if the specified time is later than the current X server time. The event modes are defined as follows: Title not available (Releasing Queued Events )
AsyncThisDevice, SyncThisDevice, and ReplayThisDevice have no effect on the processing of events from the remaining devices. AsyncOtherDevices has no effect on the processing of events from the specified device. When the event_mode is SyncAllDevices or AsyncAllDevices, the device parameter is ignored. It is possible for several grabs of different devices by the same or different clients to be active simultaneously. If a device is frozen on behalf of any grab, no event processing is performed for that device. It is possible for a single device to be frozen because of several grabs. In that case, the freeze must be released on behalf or each grab before events can again be processed. XAllowDeviceEvents can generate a BadDevice or BadValue error. |
|