mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
Detect keyboard devices on Linux
This commit is contained in:
parent
687e080bdd
commit
bfea37f64d
@ -274,6 +274,10 @@ init_device() {
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(KEY_A, keys) && test_bit(KEY_Z, keys)) {
|
||||
_flags |= IDF_has_keyboard;
|
||||
}
|
||||
|
||||
// Check device type.
|
||||
if (test_bit(BTN_GAMEPAD, keys)) {
|
||||
_device_class = DC_gamepad;
|
||||
@ -286,6 +290,9 @@ init_device() {
|
||||
|
||||
} else if (test_bit(BTN_WHEEL, keys)) {
|
||||
_device_class = DC_steering_wheel;
|
||||
|
||||
} else if (_flags & IDF_has_keyboard) {
|
||||
_device_class = DC_keyboard;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,11 +283,17 @@ output(ostream &out) const {
|
||||
}
|
||||
|
||||
if (_buttons.size() > 0) {
|
||||
out << ", " << _buttons.size() << " buttons";
|
||||
out << ", " << _buttons.size() << " button";
|
||||
if (_buttons.size() != 1) {
|
||||
out.put('s');
|
||||
}
|
||||
}
|
||||
|
||||
if (_controls.size() > 0) {
|
||||
out << ", " << _controls.size() << " controls";
|
||||
out << ", " << _controls.size() << " control";
|
||||
if (_controls.size() != 1) {
|
||||
out.put('s');
|
||||
}
|
||||
}
|
||||
|
||||
if (_flags & IDF_has_pointer) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user