The Input Server Table of Contents | The Input Server Index |
Derived from: none
Declared in: be/interface/InputDevice.h
Library: libbe.so
Allocation: By the system only. See
A BInputDevice object is a "downstream" representation of an Input Server device, such as a mouse or a keyboard. The BInputDevice can Start() and Stop() the device it represents, and can send it input device control messages through its Control() function.
You never create BInputDevice objects yourself; instead, you ask the system to return one or more instances to you through the find_input_device() or get_input_devices() functions. Alternatively, you can work without an object by invoking the static versions of Start(), Stop(), and Control(). Note, however, that the static functions control all devices of a given type, whereas a BInputDevice instance can talk to a particular device.
BInputDevice objects don't live in the Input Server—they're used in "normal" applications as a means to control an Input Server device add-on.
The BInputDevice object is provided, primarily, to allow an application to talk to a custom input device.
You never subclass BInputDevice.
The constructor is private. Use find_input_device() or get_input_devices() to retrieve a BInputDevice instance.
|
Deletes the BInputDevice object. Deleting this object doesn't affect the device that it represents.
|
Sends an input device control message to the object's input device or, in the static version, to all devices of the given type, where, type can be B_POINTING_DEVICE, B_KEYBOARD_DEVICE, or B_UNDEFINED_DEVICE.
The control message is described by the code value; it can be supplemented or refined by message. For example, code can indicate that a certain parameter should be set, and message can supply the requested value.
![]() |
In general, you only use this function to send custom messages to a (custom) device. You never use it to send messages to a Be-defined input device since the messages that these devices respond to are covered by Be-defined functions. See Input Device Control Messages for a list of the messages that the Be-defined devices respond to, the functions that cover them, and the German women that love them. |
|
Name()Start() returns a pointer to the input device's name. The name, which is set when the device is registered, is meant to be human-readable and appropriate for use as the label of a UI element (such as a menu field). Device names are not unique.
Type() returns the input device's type, one of B_POINTING_DEVICE, B_KEYBOARD_DEVICE, and B_UNDEFINED_DEVICE.
|
Start() tells the object's input device to start generating events; Stop() tells it to stop generating events. IsRunning() returns true if the device is currently generating events (i.e. if it has been started and hasn't been stopped).
The static versions of Start() and Stop() start and stop all devices of the given type.
RETURN CODES
B_OK. The device is now started (Start()) or stopped (Stop())—even if the device was already started or stopped.
B_ERROR. The device couldn't be found.
![]() |
The Input Server tells a device to start and stop without asking the device if the operation was successful. This means, for example, that Start() can return B_OK (and IsRunning() can return true) even if the device isn't really running. For the Be-provided devices this isn't an issue—starting and stopping always succeeds (as long as the device exists). |
|
These functions get BInputDevice objects for you.
find_input_device() creates and hands you a BInputDevice object that represents the Input Server device registered as name. If name is invalid, the function returns NULL. The caller is responsible for freeing the object. Note that find_input_device() returns a new BInputDevice object on each (valid) call, even if you ask for the same device more than once.
get_input_devices() creates a new BInputDevice object for each registered device, and puts the objects in your list argument. list must already be allocated, and is automatically emptied by the function (even if the function fails).
RETURN CODES
get_input_devices() returns:
B_OK. Success.
B_ERROR. General failure.
Port errors. Couldn't talk to the Input Server.
|
Tells the Input Server to start or stop watching (as start is true or false) for changes to the set of registered devices. Change notifications are sent to target. The set of messages that the Server may send are listed in
The Input Server Table of Contents | The Input Server Index |
Copyright © 1999 Be, Inc. All rights reserved.
Text last modified