#include "xkb.h"
#include <unistd.h>
#include <xcb/xcb.h>
#include <xcb/xcbext.h>
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/xproto_internal.h"
namespace x11 {
Xkb::Xkb(Connection* connection, const x11::QueryExtensionReply& info)
: … { … }
std::string Xkb::KeyboardError::ToString() const { … }
template <>
void ReadError<Xkb::KeyboardError>(Xkb::KeyboardError* error_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::NewKeyboardNotifyEvent>(Xkb::NewKeyboardNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::MapNotifyEvent>(Xkb::MapNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::StateNotifyEvent>(Xkb::StateNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::ControlsNotifyEvent>(Xkb::ControlsNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::IndicatorStateNotifyEvent>(
Xkb::IndicatorStateNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::IndicatorMapNotifyEvent>(
Xkb::IndicatorMapNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::NamesNotifyEvent>(Xkb::NamesNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::CompatMapNotifyEvent>(Xkb::CompatMapNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::BellNotifyEvent>(Xkb::BellNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::ActionMessageEvent>(Xkb::ActionMessageEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::AccessXNotifyEvent>(Xkb::AccessXNotifyEvent* event_,
ReadBuffer* buffer) { … }
template <>
COMPONENT_EXPORT(X11)
void ReadEvent<Xkb::ExtensionDeviceNotifyEvent>(
Xkb::ExtensionDeviceNotifyEvent* event_,
ReadBuffer* buffer) { … }
Future<Xkb::UseExtensionReply> Xkb::UseExtension(
const Xkb::UseExtensionRequest& request) { … }
Future<Xkb::UseExtensionReply> Xkb::UseExtension(const uint16_t& wantedMajor,
const uint16_t& wantedMinor) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::UseExtensionReply> detail::ReadReply<
Xkb::UseExtensionReply>(ReadBuffer* buffer) { … }
Future<void> Xkb::SelectEvents(const Xkb::SelectEventsRequest& request) { … }
Future<void> Xkb::SelectEvents(
const DeviceSpec& deviceSpec,
const EventType& affectWhich,
const EventType& clear,
const EventType& selectAll,
const MapPart& affectMap,
const MapPart& map,
const std::optional<NKNDetail>& affectNewKeyboard,
const std::optional<NKNDetail>& newKeyboardDetails,
const std::optional<StatePart>& affectState,
const std::optional<StatePart>& stateDetails,
const std::optional<Control>& affectCtrls,
const std::optional<Control>& ctrlDetails,
const std::optional<uint32_t>& affectIndicatorState,
const std::optional<uint32_t>& indicatorStateDetails,
const std::optional<uint32_t>& affectIndicatorMap,
const std::optional<uint32_t>& indicatorMapDetails,
const std::optional<NameDetail>& affectNames,
const std::optional<NameDetail>& namesDetails,
const std::optional<CMDetail>& affectCompat,
const std::optional<CMDetail>& compatDetails,
const std::optional<uint8_t>& affectBell,
const std::optional<uint8_t>& bellDetails,
const std::optional<uint8_t>& affectMsgDetails,
const std::optional<uint8_t>& msgDetails,
const std::optional<AXNDetail>& affectAccessX,
const std::optional<AXNDetail>& accessXDetails,
const std::optional<XIFeature>& affectExtDev,
const std::optional<XIFeature>& extdevDetails) { … }
Future<void> Xkb::Bell(const Xkb::BellRequest& request) { … }
Future<void> Xkb::Bell(const DeviceSpec& deviceSpec,
const BellClassSpec& bellClass,
const IDSpec& bellID,
const int8_t& percent,
const uint8_t& forceSound,
const uint8_t& eventOnly,
const int16_t& pitch,
const int16_t& duration,
const Atom& name,
const Window& window) { … }
Future<Xkb::GetStateReply> Xkb::GetState(const Xkb::GetStateRequest& request) { … }
Future<Xkb::GetStateReply> Xkb::GetState(const DeviceSpec& deviceSpec) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetStateReply> detail::ReadReply<Xkb::GetStateReply>(
ReadBuffer* buffer) { … }
Future<void> Xkb::LatchLockState(const Xkb::LatchLockStateRequest& request) { … }
Future<void> Xkb::LatchLockState(const DeviceSpec& deviceSpec,
const ModMask& affectModLocks,
const ModMask& modLocks,
const uint8_t& lockGroup,
const Group& groupLock,
const ModMask& affectModLatches,
const uint8_t& latchGroup,
const uint16_t& groupLatch) { … }
Future<Xkb::GetControlsReply> Xkb::GetControls(
const Xkb::GetControlsRequest& request) { … }
Future<Xkb::GetControlsReply> Xkb::GetControls(const DeviceSpec& deviceSpec) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetControlsReply> detail::ReadReply<Xkb::GetControlsReply>(
ReadBuffer* buffer) { … }
Future<void> Xkb::SetControls(const Xkb::SetControlsRequest& request) { … }
Future<void> Xkb::SetControls(const DeviceSpec& deviceSpec,
const ModMask& affectInternalRealMods,
const ModMask& internalRealMods,
const ModMask& affectIgnoreLockRealMods,
const ModMask& ignoreLockRealMods,
const VMod& affectInternalVirtualMods,
const VMod& internalVirtualMods,
const VMod& affectIgnoreLockVirtualMods,
const VMod& ignoreLockVirtualMods,
const uint8_t& mouseKeysDfltBtn,
const uint8_t& groupsWrap,
const AXOption& accessXOptions,
const BoolCtrl& affectEnabledControls,
const BoolCtrl& enabledControls,
const Control& changeControls,
const uint16_t& repeatDelay,
const uint16_t& repeatInterval,
const uint16_t& slowKeysDelay,
const uint16_t& debounceDelay,
const uint16_t& mouseKeysDelay,
const uint16_t& mouseKeysInterval,
const uint16_t& mouseKeysTimeToMax,
const uint16_t& mouseKeysMaxSpeed,
const int16_t& mouseKeysCurve,
const uint16_t& accessXTimeout,
const BoolCtrl& accessXTimeoutMask,
const BoolCtrl& accessXTimeoutValues,
const AXOption& accessXTimeoutOptionsMask,
const AXOption& accessXTimeoutOptionsValues,
const std::array<uint8_t, 32>& perKeyRepeat) { … }
Future<Xkb::GetMapReply> Xkb::GetMap(const Xkb::GetMapRequest& request) { … }
Future<Xkb::GetMapReply> Xkb::GetMap(const DeviceSpec& deviceSpec,
const MapPart& full,
const MapPart& partial,
const uint8_t& firstType,
const uint8_t& nTypes,
const KeyCode& firstKeySym,
const uint8_t& nKeySyms,
const KeyCode& firstKeyAction,
const uint8_t& nKeyActions,
const KeyCode& firstKeyBehavior,
const uint8_t& nKeyBehaviors,
const VMod& virtualMods,
const KeyCode& firstKeyExplicit,
const uint8_t& nKeyExplicit,
const KeyCode& firstModMapKey,
const uint8_t& nModMapKeys,
const KeyCode& firstVModMapKey,
const uint8_t& nVModMapKeys) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetMapReply> detail::ReadReply<Xkb::GetMapReply>(
ReadBuffer* buffer) { … }
Future<void> Xkb::SetMap(const Xkb::SetMapRequest& request) { … }
Future<void> Xkb::SetMap(
const DeviceSpec& deviceSpec,
const SetMapFlags& flags,
const KeyCode& minKeyCode,
const KeyCode& maxKeyCode,
const uint8_t& firstType,
const uint8_t& nTypes,
const KeyCode& firstKeySym,
const uint8_t& nKeySyms,
const uint16_t& totalSyms,
const KeyCode& firstKeyAction,
const uint8_t& nKeyActions,
const uint16_t& totalActions,
const KeyCode& firstKeyBehavior,
const uint8_t& nKeyBehaviors,
const uint8_t& totalKeyBehaviors,
const KeyCode& firstKeyExplicit,
const uint8_t& nKeyExplicit,
const uint8_t& totalKeyExplicit,
const KeyCode& firstModMapKey,
const uint8_t& nModMapKeys,
const uint8_t& totalModMapKeys,
const KeyCode& firstVModMapKey,
const uint8_t& nVModMapKeys,
const uint8_t& totalVModMapKeys,
const VMod& virtualMods,
const std::optional<std::vector<SetKeyType>>& types,
const std::optional<std::vector<KeySymMap>>& syms,
const std::optional<std::vector<uint8_t>>& actionsCount,
const std::optional<std::vector<Action>>& actions,
const std::optional<std::vector<SetBehavior>>& behaviors,
const std::optional<std::vector<uint8_t>>& vmods,
const std::optional<std::vector<SetExplicit>>& c_explicit,
const std::optional<std::vector<KeyModMap>>& modmap,
const std::optional<std::vector<KeyVModMap>>& vmodmap) { … }
Future<Xkb::GetCompatMapReply> Xkb::GetCompatMap(
const Xkb::GetCompatMapRequest& request) { … }
Future<Xkb::GetCompatMapReply> Xkb::GetCompatMap(const DeviceSpec& deviceSpec,
const SetOfGroup& groups,
const uint8_t& getAllSI,
const uint16_t& firstSI,
const uint16_t& nSI) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetCompatMapReply> detail::ReadReply<
Xkb::GetCompatMapReply>(ReadBuffer* buffer) { … }
Future<void> Xkb::SetCompatMap(const Xkb::SetCompatMapRequest& request) { … }
Future<void> Xkb::SetCompatMap(const DeviceSpec& deviceSpec,
const uint8_t& recomputeActions,
const uint8_t& truncateSI,
const SetOfGroup& groups,
const uint16_t& firstSI,
const std::vector<SymInterpret>& si,
const std::vector<ModDef>& groupMaps) { … }
Future<Xkb::GetIndicatorStateReply> Xkb::GetIndicatorState(
const Xkb::GetIndicatorStateRequest& request) { … }
Future<Xkb::GetIndicatorStateReply> Xkb::GetIndicatorState(
const DeviceSpec& deviceSpec) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetIndicatorStateReply> detail::ReadReply<
Xkb::GetIndicatorStateReply>(ReadBuffer* buffer) { … }
Future<Xkb::GetIndicatorMapReply> Xkb::GetIndicatorMap(
const Xkb::GetIndicatorMapRequest& request) { … }
Future<Xkb::GetIndicatorMapReply> Xkb::GetIndicatorMap(
const DeviceSpec& deviceSpec,
const uint32_t& which) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetIndicatorMapReply> detail::ReadReply<
Xkb::GetIndicatorMapReply>(ReadBuffer* buffer) { … }
Future<void> Xkb::SetIndicatorMap(const Xkb::SetIndicatorMapRequest& request) { … }
Future<void> Xkb::SetIndicatorMap(const DeviceSpec& deviceSpec,
const uint32_t& which,
const std::vector<IndicatorMap>& maps) { … }
Future<Xkb::GetNamedIndicatorReply> Xkb::GetNamedIndicator(
const Xkb::GetNamedIndicatorRequest& request) { … }
Future<Xkb::GetNamedIndicatorReply> Xkb::GetNamedIndicator(
const DeviceSpec& deviceSpec,
const LedClass& ledClass,
const IDSpec& ledID,
const Atom& indicator) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetNamedIndicatorReply> detail::ReadReply<
Xkb::GetNamedIndicatorReply>(ReadBuffer* buffer) { … }
Future<void> Xkb::SetNamedIndicator(
const Xkb::SetNamedIndicatorRequest& request) { … }
Future<void> Xkb::SetNamedIndicator(const DeviceSpec& deviceSpec,
const LedClass& ledClass,
const IDSpec& ledID,
const Atom& indicator,
const uint8_t& setState,
const uint8_t& on,
const uint8_t& setMap,
const uint8_t& createMap,
const IMFlag& map_flags,
const IMGroupsWhich& map_whichGroups,
const SetOfGroups& map_groups,
const IMModsWhich& map_whichMods,
const ModMask& map_realMods,
const VMod& map_vmods,
const BoolCtrl& map_ctrls) { … }
Future<Xkb::GetNamesReply> Xkb::GetNames(const Xkb::GetNamesRequest& request) { … }
Future<Xkb::GetNamesReply> Xkb::GetNames(const DeviceSpec& deviceSpec,
const NameDetail& which) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetNamesReply> detail::ReadReply<Xkb::GetNamesReply>(
ReadBuffer* buffer) { … }
Future<void> Xkb::SetNames(const Xkb::SetNamesRequest& request) { … }
Future<void> Xkb::SetNames(
const DeviceSpec& deviceSpec,
const VMod& virtualMods,
const uint8_t& firstType,
const uint8_t& nTypes,
const uint8_t& firstKTLevelt,
const uint8_t& nKTLevels,
const uint32_t& indicators,
const SetOfGroup& groupNames,
const uint8_t& nRadioGroups,
const KeyCode& firstKey,
const uint8_t& nKeys,
const uint8_t& nKeyAliases,
const uint16_t& totalKTLevelNames,
const std::optional<Atom>& keycodesName,
const std::optional<Atom>& geometryName,
const std::optional<Atom>& symbolsName,
const std::optional<Atom>& physSymbolsName,
const std::optional<Atom>& typesName,
const std::optional<Atom>& compatName,
const std::optional<std::vector<Atom>>& typeNames,
const std::optional<std::vector<uint8_t>>& nLevelsPerType,
const std::optional<std::vector<Atom>>& ktLevelNames,
const std::optional<std::vector<Atom>>& indicatorNames,
const std::optional<std::vector<Atom>>& virtualModNames,
const std::optional<std::vector<Atom>>& groups,
const std::optional<std::vector<KeyName>>& keyNames,
const std::optional<std::vector<KeyAlias>>& keyAliases,
const std::optional<std::vector<Atom>>& radioGroupNames) { … }
Future<Xkb::PerClientFlagsReply> Xkb::PerClientFlags(
const Xkb::PerClientFlagsRequest& request) { … }
Future<Xkb::PerClientFlagsReply> Xkb::PerClientFlags(
const DeviceSpec& deviceSpec,
const PerClientFlag& change,
const PerClientFlag& value,
const BoolCtrl& ctrlsToChange,
const BoolCtrl& autoCtrls,
const BoolCtrl& autoCtrlsValues) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::PerClientFlagsReply> detail::ReadReply<
Xkb::PerClientFlagsReply>(ReadBuffer* buffer) { … }
Future<Xkb::ListComponentsReply> Xkb::ListComponents(
const Xkb::ListComponentsRequest& request) { … }
Future<Xkb::ListComponentsReply> Xkb::ListComponents(
const DeviceSpec& deviceSpec,
const uint16_t& maxNames) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::ListComponentsReply> detail::ReadReply<
Xkb::ListComponentsReply>(ReadBuffer* buffer) { … }
Future<Xkb::GetKbdByNameReply> Xkb::GetKbdByName(
const Xkb::GetKbdByNameRequest& request) { … }
Future<Xkb::GetKbdByNameReply> Xkb::GetKbdByName(const DeviceSpec& deviceSpec,
const GBNDetail& need,
const GBNDetail& want,
const uint8_t& load) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetKbdByNameReply> detail::ReadReply<
Xkb::GetKbdByNameReply>(ReadBuffer* buffer) { … }
Future<Xkb::GetDeviceInfoReply> Xkb::GetDeviceInfo(
const Xkb::GetDeviceInfoRequest& request) { … }
Future<Xkb::GetDeviceInfoReply> Xkb::GetDeviceInfo(const DeviceSpec& deviceSpec,
const XIFeature& wanted,
const uint8_t& allButtons,
const uint8_t& firstButton,
const uint8_t& nButtons,
const LedClass& ledClass,
const IDSpec& ledID) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::GetDeviceInfoReply> detail::ReadReply<
Xkb::GetDeviceInfoReply>(ReadBuffer* buffer) { … }
Future<void> Xkb::SetDeviceInfo(const Xkb::SetDeviceInfoRequest& request) { … }
Future<void> Xkb::SetDeviceInfo(const DeviceSpec& deviceSpec,
const uint8_t& firstBtn,
const XIFeature& change,
const std::vector<Action>& btnActions,
const std::vector<DeviceLedInfo>& leds) { … }
Future<Xkb::SetDebuggingFlagsReply> Xkb::SetDebuggingFlags(
const Xkb::SetDebuggingFlagsRequest& request) { … }
Future<Xkb::SetDebuggingFlagsReply> Xkb::SetDebuggingFlags(
const uint32_t& affectFlags,
const uint32_t& flags,
const uint32_t& affectCtrls,
const uint32_t& ctrls,
const std::vector<String8>& message) { … }
template <>
COMPONENT_EXPORT(X11)
std::unique_ptr<Xkb::SetDebuggingFlagsReply> detail::ReadReply<
Xkb::SetDebuggingFlagsReply>(ReadBuffer* buffer) { … }
}