| 1 | // This file contains generated code. Do not edit directly. |
| 2 | // To regenerate this, run 'make'. |
| 3 | |
| 4 | //! Bindings to the `xkb` X11 extension. |
| 5 | |
| 6 | #![allow (clippy::too_many_arguments)] |
| 7 | |
| 8 | #[allow (unused_imports)] |
| 9 | use std::borrow::Cow; |
| 10 | #[allow (unused_imports)] |
| 11 | use std::convert::TryInto; |
| 12 | #[allow (unused_imports)] |
| 13 | use crate::utils::RawFdContainer; |
| 14 | #[allow (unused_imports)] |
| 15 | use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd}; |
| 16 | use std::io::IoSlice; |
| 17 | use crate::connection::RequestConnection; |
| 18 | #[allow (unused_imports)] |
| 19 | use crate::connection::Connection as X11Connection; |
| 20 | #[allow (unused_imports)] |
| 21 | use crate::cookie::{Cookie, CookieWithFds, VoidCookie}; |
| 22 | use crate::errors::ConnectionError; |
| 23 | #[allow (unused_imports)] |
| 24 | use crate::errors::ReplyOrIdError; |
| 25 | #[allow (unused_imports)] |
| 26 | use super::xproto; |
| 27 | |
| 28 | pub use x11rb_protocol::protocol::xkb::*; |
| 29 | |
| 30 | /// Get the major opcode of this extension |
| 31 | fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> { |
| 32 | let info: Option = conn.extension_information(X11_EXTENSION_NAME)?; |
| 33 | let info: ExtensionInformation = info.ok_or(err:ConnectionError::UnsupportedExtension)?; |
| 34 | Ok(info.major_opcode) |
| 35 | } |
| 36 | |
| 37 | pub fn use_extension<Conn>(conn: &Conn, wanted_major: u16, wanted_minor: u16) -> Result<Cookie<'_, Conn, UseExtensionReply>, ConnectionError> |
| 38 | where |
| 39 | Conn: RequestConnection + ?Sized, |
| 40 | { |
| 41 | let request0: UseExtensionRequest = UseExtensionRequest { |
| 42 | wanted_major, |
| 43 | wanted_minor, |
| 44 | }; |
| 45 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 46 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 47 | assert_eq!(slices.len(), bytes.len()); |
| 48 | conn.send_request_with_reply(&slices, fds) |
| 49 | } |
| 50 | |
| 51 | pub fn select_events<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, clear: EventType, select_all: EventType, affect_map: MapPart, map: MapPart, details: &'input SelectEventsAux) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 52 | where |
| 53 | Conn: RequestConnection + ?Sized, |
| 54 | { |
| 55 | let request0: SelectEventsRequest<'_> = SelectEventsRequest { |
| 56 | device_spec, |
| 57 | clear, |
| 58 | select_all, |
| 59 | affect_map, |
| 60 | map, |
| 61 | details: Cow::Borrowed(details), |
| 62 | }; |
| 63 | let (bytes: [Cow<'_, [u8]>; 3], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 64 | let slices: [IoSlice<'_>; 3] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; |
| 65 | assert_eq!(slices.len(), bytes.len()); |
| 66 | conn.send_request_without_reply(&slices, fds) |
| 67 | } |
| 68 | |
| 69 | pub fn bell<Conn>(conn: &Conn, device_spec: DeviceSpec, bell_class: BellClassSpec, bell_id: IDSpec, percent: i8, force_sound: bool, event_only: bool, pitch: i16, duration: i16, name: xproto::Atom, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError> |
| 70 | where |
| 71 | Conn: RequestConnection + ?Sized, |
| 72 | { |
| 73 | let request0: BellRequest = BellRequest { |
| 74 | device_spec, |
| 75 | bell_class, |
| 76 | bell_id, |
| 77 | percent, |
| 78 | force_sound, |
| 79 | event_only, |
| 80 | pitch, |
| 81 | duration, |
| 82 | name, |
| 83 | window, |
| 84 | }; |
| 85 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 86 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 87 | assert_eq!(slices.len(), bytes.len()); |
| 88 | conn.send_request_without_reply(&slices, fds) |
| 89 | } |
| 90 | |
| 91 | pub fn get_state<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetStateReply>, ConnectionError> |
| 92 | where |
| 93 | Conn: RequestConnection + ?Sized, |
| 94 | { |
| 95 | let request0: GetStateRequest = GetStateRequest { |
| 96 | device_spec, |
| 97 | }; |
| 98 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 99 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 100 | assert_eq!(slices.len(), bytes.len()); |
| 101 | conn.send_request_with_reply(&slices, fds) |
| 102 | } |
| 103 | |
| 104 | pub fn latch_lock_state<Conn>(conn: &Conn, device_spec: DeviceSpec, affect_mod_locks: xproto::ModMask, mod_locks: xproto::ModMask, lock_group: bool, group_lock: Group, affect_mod_latches: xproto::ModMask, latch_group: bool, group_latch: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError> |
| 105 | where |
| 106 | Conn: RequestConnection + ?Sized, |
| 107 | { |
| 108 | let request0: LatchLockStateRequest = LatchLockStateRequest { |
| 109 | device_spec, |
| 110 | affect_mod_locks, |
| 111 | mod_locks, |
| 112 | lock_group, |
| 113 | group_lock, |
| 114 | affect_mod_latches, |
| 115 | latch_group, |
| 116 | group_latch, |
| 117 | }; |
| 118 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 119 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 120 | assert_eq!(slices.len(), bytes.len()); |
| 121 | conn.send_request_without_reply(&slices, fds) |
| 122 | } |
| 123 | |
| 124 | pub fn get_controls<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetControlsReply>, ConnectionError> |
| 125 | where |
| 126 | Conn: RequestConnection + ?Sized, |
| 127 | { |
| 128 | let request0: GetControlsRequest = GetControlsRequest { |
| 129 | device_spec, |
| 130 | }; |
| 131 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 132 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 133 | assert_eq!(slices.len(), bytes.len()); |
| 134 | conn.send_request_with_reply(&slices, fds) |
| 135 | } |
| 136 | |
| 137 | pub fn set_controls<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, affect_internal_real_mods: xproto::ModMask, internal_real_mods: xproto::ModMask, affect_ignore_lock_real_mods: xproto::ModMask, ignore_lock_real_mods: xproto::ModMask, affect_internal_virtual_mods: VMod, internal_virtual_mods: VMod, affect_ignore_lock_virtual_mods: VMod, ignore_lock_virtual_mods: VMod, mouse_keys_dflt_btn: u8, groups_wrap: u8, access_x_options: AXOption, affect_enabled_controls: BoolCtrl, enabled_controls: BoolCtrl, change_controls: Control, repeat_delay: u16, repeat_interval: u16, slow_keys_delay: u16, debounce_delay: u16, mouse_keys_delay: u16, mouse_keys_interval: u16, mouse_keys_time_to_max: u16, mouse_keys_max_speed: u16, mouse_keys_curve: i16, access_x_timeout: u16, access_x_timeout_mask: BoolCtrl, access_x_timeout_values: BoolCtrl, access_x_timeout_options_mask: AXOption, access_x_timeout_options_values: AXOption, per_key_repeat: &'input [u8; 32]) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 138 | where |
| 139 | Conn: RequestConnection + ?Sized, |
| 140 | { |
| 141 | let request0 = SetControlsRequest { |
| 142 | device_spec, |
| 143 | affect_internal_real_mods, |
| 144 | internal_real_mods, |
| 145 | affect_ignore_lock_real_mods, |
| 146 | ignore_lock_real_mods, |
| 147 | affect_internal_virtual_mods, |
| 148 | internal_virtual_mods, |
| 149 | affect_ignore_lock_virtual_mods, |
| 150 | ignore_lock_virtual_mods, |
| 151 | mouse_keys_dflt_btn, |
| 152 | groups_wrap, |
| 153 | access_x_options, |
| 154 | affect_enabled_controls, |
| 155 | enabled_controls, |
| 156 | change_controls, |
| 157 | repeat_delay, |
| 158 | repeat_interval, |
| 159 | slow_keys_delay, |
| 160 | debounce_delay, |
| 161 | mouse_keys_delay, |
| 162 | mouse_keys_interval, |
| 163 | mouse_keys_time_to_max, |
| 164 | mouse_keys_max_speed, |
| 165 | mouse_keys_curve, |
| 166 | access_x_timeout, |
| 167 | access_x_timeout_mask, |
| 168 | access_x_timeout_values, |
| 169 | access_x_timeout_options_mask, |
| 170 | access_x_timeout_options_values, |
| 171 | per_key_repeat: Cow::Borrowed(per_key_repeat), |
| 172 | }; |
| 173 | let (bytes, fds) = request0.serialize(major_opcode(conn)?); |
| 174 | let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1])]; |
| 175 | assert_eq!(slices.len(), bytes.len()); |
| 176 | conn.send_request_without_reply(&slices, fds) |
| 177 | } |
| 178 | |
| 179 | pub fn get_map<Conn>(conn: &Conn, device_spec: DeviceSpec, full: MapPart, partial: MapPart, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, first_key_action: xproto::Keycode, n_key_actions: u8, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, virtual_mods: VMod, first_key_explicit: xproto::Keycode, n_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8) -> Result<Cookie<'_, Conn, GetMapReply>, ConnectionError> |
| 180 | where |
| 181 | Conn: RequestConnection + ?Sized, |
| 182 | { |
| 183 | let request0 = GetMapRequest { |
| 184 | device_spec, |
| 185 | full, |
| 186 | partial, |
| 187 | first_type, |
| 188 | n_types, |
| 189 | first_key_sym, |
| 190 | n_key_syms, |
| 191 | first_key_action, |
| 192 | n_key_actions, |
| 193 | first_key_behavior, |
| 194 | n_key_behaviors, |
| 195 | virtual_mods, |
| 196 | first_key_explicit, |
| 197 | n_key_explicit, |
| 198 | first_mod_map_key, |
| 199 | n_mod_map_keys, |
| 200 | first_v_mod_map_key, |
| 201 | n_v_mod_map_keys, |
| 202 | }; |
| 203 | let (bytes, fds) = request0.serialize(major_opcode(conn)?); |
| 204 | let slices = [IoSlice::new(&bytes[0])]; |
| 205 | assert_eq!(slices.len(), bytes.len()); |
| 206 | conn.send_request_with_reply(&slices, fds) |
| 207 | } |
| 208 | |
| 209 | pub fn set_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, flags: SetMapFlags, min_key_code: xproto::Keycode, max_key_code: xproto::Keycode, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, total_syms: u16, first_key_action: xproto::Keycode, n_key_actions: u8, total_actions: u16, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, total_key_behaviors: u8, first_key_explicit: xproto::Keycode, n_key_explicit: u8, total_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, total_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8, total_v_mod_map_keys: u8, virtual_mods: VMod, values: &'input SetMapAux) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 210 | where |
| 211 | Conn: RequestConnection + ?Sized, |
| 212 | { |
| 213 | let request0 = SetMapRequest { |
| 214 | device_spec, |
| 215 | flags, |
| 216 | min_key_code, |
| 217 | max_key_code, |
| 218 | first_type, |
| 219 | n_types, |
| 220 | first_key_sym, |
| 221 | n_key_syms, |
| 222 | total_syms, |
| 223 | first_key_action, |
| 224 | n_key_actions, |
| 225 | total_actions, |
| 226 | first_key_behavior, |
| 227 | n_key_behaviors, |
| 228 | total_key_behaviors, |
| 229 | first_key_explicit, |
| 230 | n_key_explicit, |
| 231 | total_key_explicit, |
| 232 | first_mod_map_key, |
| 233 | n_mod_map_keys, |
| 234 | total_mod_map_keys, |
| 235 | first_v_mod_map_key, |
| 236 | n_v_mod_map_keys, |
| 237 | total_v_mod_map_keys, |
| 238 | virtual_mods, |
| 239 | values: Cow::Borrowed(values), |
| 240 | }; |
| 241 | let (bytes, fds) = request0.serialize(major_opcode(conn)?); |
| 242 | let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; |
| 243 | assert_eq!(slices.len(), bytes.len()); |
| 244 | conn.send_request_without_reply(&slices, fds) |
| 245 | } |
| 246 | |
| 247 | pub fn get_compat_map<Conn>(conn: &Conn, device_spec: DeviceSpec, groups: SetOfGroup, get_all_si: bool, first_si: u16, n_si: u16) -> Result<Cookie<'_, Conn, GetCompatMapReply>, ConnectionError> |
| 248 | where |
| 249 | Conn: RequestConnection + ?Sized, |
| 250 | { |
| 251 | let request0: GetCompatMapRequest = GetCompatMapRequest { |
| 252 | device_spec, |
| 253 | groups, |
| 254 | get_all_si, |
| 255 | first_si, |
| 256 | n_si, |
| 257 | }; |
| 258 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 259 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 260 | assert_eq!(slices.len(), bytes.len()); |
| 261 | conn.send_request_with_reply(&slices, fds) |
| 262 | } |
| 263 | |
| 264 | pub fn set_compat_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, recompute_actions: bool, truncate_si: bool, groups: SetOfGroup, first_si: u16, si: &'input [SymInterpret], group_maps: &'input [ModDef]) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 265 | where |
| 266 | Conn: RequestConnection + ?Sized, |
| 267 | { |
| 268 | let request0: SetCompatMapRequest<'_> = SetCompatMapRequest { |
| 269 | device_spec, |
| 270 | recompute_actions, |
| 271 | truncate_si, |
| 272 | groups, |
| 273 | first_si, |
| 274 | si: Cow::Borrowed(si), |
| 275 | group_maps: Cow::Borrowed(group_maps), |
| 276 | }; |
| 277 | let (bytes: [Cow<'_, [u8]>; 4], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 278 | let slices: [IoSlice<'_>; 4] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])]; |
| 279 | assert_eq!(slices.len(), bytes.len()); |
| 280 | conn.send_request_without_reply(&slices, fds) |
| 281 | } |
| 282 | |
| 283 | pub fn get_indicator_state<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetIndicatorStateReply>, ConnectionError> |
| 284 | where |
| 285 | Conn: RequestConnection + ?Sized, |
| 286 | { |
| 287 | let request0: GetIndicatorStateRequest = GetIndicatorStateRequest { |
| 288 | device_spec, |
| 289 | }; |
| 290 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 291 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 292 | assert_eq!(slices.len(), bytes.len()); |
| 293 | conn.send_request_with_reply(&slices, fds) |
| 294 | } |
| 295 | |
| 296 | pub fn get_indicator_map<Conn>(conn: &Conn, device_spec: DeviceSpec, which: u32) -> Result<Cookie<'_, Conn, GetIndicatorMapReply>, ConnectionError> |
| 297 | where |
| 298 | Conn: RequestConnection + ?Sized, |
| 299 | { |
| 300 | let request0: GetIndicatorMapRequest = GetIndicatorMapRequest { |
| 301 | device_spec, |
| 302 | which, |
| 303 | }; |
| 304 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 305 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 306 | assert_eq!(slices.len(), bytes.len()); |
| 307 | conn.send_request_with_reply(&slices, fds) |
| 308 | } |
| 309 | |
| 310 | pub fn set_indicator_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, which: u32, maps: &'input [IndicatorMap]) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 311 | where |
| 312 | Conn: RequestConnection + ?Sized, |
| 313 | { |
| 314 | let request0: SetIndicatorMapRequest<'_> = SetIndicatorMapRequest { |
| 315 | device_spec, |
| 316 | which, |
| 317 | maps: Cow::Borrowed(maps), |
| 318 | }; |
| 319 | let (bytes: [Cow<'_, [u8]>; 3], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 320 | let slices: [IoSlice<'_>; 3] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; |
| 321 | assert_eq!(slices.len(), bytes.len()); |
| 322 | conn.send_request_without_reply(&slices, fds) |
| 323 | } |
| 324 | |
| 325 | pub fn get_named_indicator<Conn, A>(conn: &Conn, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom) -> Result<Cookie<'_, Conn, GetNamedIndicatorReply>, ConnectionError> |
| 326 | where |
| 327 | Conn: RequestConnection + ?Sized, |
| 328 | A: Into<IDSpec>, |
| 329 | { |
| 330 | let led_id: IDSpec = led_id.into(); |
| 331 | let request0: GetNamedIndicatorRequest = GetNamedIndicatorRequest { |
| 332 | device_spec, |
| 333 | led_class, |
| 334 | led_id, |
| 335 | indicator, |
| 336 | }; |
| 337 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 338 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 339 | assert_eq!(slices.len(), bytes.len()); |
| 340 | conn.send_request_with_reply(&slices, fds) |
| 341 | } |
| 342 | |
| 343 | pub fn set_named_indicator<Conn, A>(conn: &Conn, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom, set_state: bool, on: bool, set_map: bool, create_map: bool, map_flags: IMFlag, map_which_groups: IMGroupsWhich, map_groups: SetOfGroups, map_which_mods: IMModsWhich, map_real_mods: xproto::ModMask, map_vmods: VMod, map_ctrls: BoolCtrl) -> Result<VoidCookie<'_, Conn>, ConnectionError> |
| 344 | where |
| 345 | Conn: RequestConnection + ?Sized, |
| 346 | A: Into<IDSpec>, |
| 347 | { |
| 348 | let led_id: IDSpec = led_id.into(); |
| 349 | let request0: SetNamedIndicatorRequest = SetNamedIndicatorRequest { |
| 350 | device_spec, |
| 351 | led_class, |
| 352 | led_id, |
| 353 | indicator, |
| 354 | set_state, |
| 355 | on, |
| 356 | set_map, |
| 357 | create_map, |
| 358 | map_flags, |
| 359 | map_which_groups, |
| 360 | map_groups, |
| 361 | map_which_mods, |
| 362 | map_real_mods, |
| 363 | map_vmods, |
| 364 | map_ctrls, |
| 365 | }; |
| 366 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 367 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 368 | assert_eq!(slices.len(), bytes.len()); |
| 369 | conn.send_request_without_reply(&slices, fds) |
| 370 | } |
| 371 | |
| 372 | pub fn get_names<Conn>(conn: &Conn, device_spec: DeviceSpec, which: NameDetail) -> Result<Cookie<'_, Conn, GetNamesReply>, ConnectionError> |
| 373 | where |
| 374 | Conn: RequestConnection + ?Sized, |
| 375 | { |
| 376 | let request0: GetNamesRequest = GetNamesRequest { |
| 377 | device_spec, |
| 378 | which, |
| 379 | }; |
| 380 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 381 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 382 | assert_eq!(slices.len(), bytes.len()); |
| 383 | conn.send_request_with_reply(&slices, fds) |
| 384 | } |
| 385 | |
| 386 | pub fn set_names<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, virtual_mods: VMod, first_type: u8, n_types: u8, first_kt_levelt: u8, n_kt_levels: u8, indicators: u32, group_names: SetOfGroup, n_radio_groups: u8, first_key: xproto::Keycode, n_keys: u8, n_key_aliases: u8, total_kt_level_names: u16, values: &'input SetNamesAux) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 387 | where |
| 388 | Conn: RequestConnection + ?Sized, |
| 389 | { |
| 390 | let request0: SetNamesRequest<'_> = SetNamesRequest { |
| 391 | device_spec, |
| 392 | virtual_mods, |
| 393 | first_type, |
| 394 | n_types, |
| 395 | first_kt_levelt, |
| 396 | n_kt_levels, |
| 397 | indicators, |
| 398 | group_names, |
| 399 | n_radio_groups, |
| 400 | first_key, |
| 401 | n_keys, |
| 402 | n_key_aliases, |
| 403 | total_kt_level_names, |
| 404 | values: Cow::Borrowed(values), |
| 405 | }; |
| 406 | let (bytes: [Cow<'_, [u8]>; 3], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 407 | let slices: [IoSlice<'_>; 3] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; |
| 408 | assert_eq!(slices.len(), bytes.len()); |
| 409 | conn.send_request_without_reply(&slices, fds) |
| 410 | } |
| 411 | |
| 412 | pub fn per_client_flags<Conn>(conn: &Conn, device_spec: DeviceSpec, change: PerClientFlag, value: PerClientFlag, ctrls_to_change: BoolCtrl, auto_ctrls: BoolCtrl, auto_ctrls_values: BoolCtrl) -> Result<Cookie<'_, Conn, PerClientFlagsReply>, ConnectionError> |
| 413 | where |
| 414 | Conn: RequestConnection + ?Sized, |
| 415 | { |
| 416 | let request0: PerClientFlagsRequest = PerClientFlagsRequest { |
| 417 | device_spec, |
| 418 | change, |
| 419 | value, |
| 420 | ctrls_to_change, |
| 421 | auto_ctrls, |
| 422 | auto_ctrls_values, |
| 423 | }; |
| 424 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 425 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 426 | assert_eq!(slices.len(), bytes.len()); |
| 427 | conn.send_request_with_reply(&slices, fds) |
| 428 | } |
| 429 | |
| 430 | pub fn list_components<Conn>(conn: &Conn, device_spec: DeviceSpec, max_names: u16) -> Result<Cookie<'_, Conn, ListComponentsReply>, ConnectionError> |
| 431 | where |
| 432 | Conn: RequestConnection + ?Sized, |
| 433 | { |
| 434 | let request0: ListComponentsRequest = ListComponentsRequest { |
| 435 | device_spec, |
| 436 | max_names, |
| 437 | }; |
| 438 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 439 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 440 | assert_eq!(slices.len(), bytes.len()); |
| 441 | conn.send_request_with_reply(&slices, fds) |
| 442 | } |
| 443 | |
| 444 | pub fn get_kbd_by_name<Conn>(conn: &Conn, device_spec: DeviceSpec, need: GBNDetail, want: GBNDetail, load: bool) -> Result<Cookie<'_, Conn, GetKbdByNameReply>, ConnectionError> |
| 445 | where |
| 446 | Conn: RequestConnection + ?Sized, |
| 447 | { |
| 448 | let request0: GetKbdByNameRequest = GetKbdByNameRequest { |
| 449 | device_spec, |
| 450 | need, |
| 451 | want, |
| 452 | load, |
| 453 | }; |
| 454 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 455 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 456 | assert_eq!(slices.len(), bytes.len()); |
| 457 | conn.send_request_with_reply(&slices, fds) |
| 458 | } |
| 459 | |
| 460 | pub fn get_device_info<Conn, A>(conn: &Conn, device_spec: DeviceSpec, wanted: XIFeature, all_buttons: bool, first_button: u8, n_buttons: u8, led_class: LedClass, led_id: A) -> Result<Cookie<'_, Conn, GetDeviceInfoReply>, ConnectionError> |
| 461 | where |
| 462 | Conn: RequestConnection + ?Sized, |
| 463 | A: Into<IDSpec>, |
| 464 | { |
| 465 | let led_id: IDSpec = led_id.into(); |
| 466 | let request0: GetDeviceInfoRequest = GetDeviceInfoRequest { |
| 467 | device_spec, |
| 468 | wanted, |
| 469 | all_buttons, |
| 470 | first_button, |
| 471 | n_buttons, |
| 472 | led_class, |
| 473 | led_id, |
| 474 | }; |
| 475 | let (bytes: [Cow<'static, [u8]>; 1], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 476 | let slices: [IoSlice<'_>; 1] = [IoSlice::new(&bytes[0])]; |
| 477 | assert_eq!(slices.len(), bytes.len()); |
| 478 | conn.send_request_with_reply(&slices, fds) |
| 479 | } |
| 480 | |
| 481 | pub fn set_device_info<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, first_btn: u8, change: XIFeature, btn_actions: &'input [Action], leds: &'input [DeviceLedInfo]) -> Result<VoidCookie<'c, Conn>, ConnectionError> |
| 482 | where |
| 483 | Conn: RequestConnection + ?Sized, |
| 484 | { |
| 485 | let request0: SetDeviceInfoRequest<'_> = SetDeviceInfoRequest { |
| 486 | device_spec, |
| 487 | first_btn, |
| 488 | change, |
| 489 | btn_actions: Cow::Borrowed(btn_actions), |
| 490 | leds: Cow::Borrowed(leds), |
| 491 | }; |
| 492 | let (bytes: [Cow<'_, [u8]>; 4], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 493 | let slices: [IoSlice<'_>; 4] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])]; |
| 494 | assert_eq!(slices.len(), bytes.len()); |
| 495 | conn.send_request_without_reply(&slices, fds) |
| 496 | } |
| 497 | |
| 498 | pub fn set_debugging_flags<'c, 'input, Conn>(conn: &'c Conn, affect_flags: u32, flags: u32, affect_ctrls: u32, ctrls: u32, message: &'input [String8]) -> Result<Cookie<'c, Conn, SetDebuggingFlagsReply>, ConnectionError> |
| 499 | where |
| 500 | Conn: RequestConnection + ?Sized, |
| 501 | { |
| 502 | let request0: SetDebuggingFlagsRequest<'_> = SetDebuggingFlagsRequest { |
| 503 | affect_flags, |
| 504 | flags, |
| 505 | affect_ctrls, |
| 506 | ctrls, |
| 507 | message: Cow::Borrowed(message), |
| 508 | }; |
| 509 | let (bytes: [Cow<'_, [u8]>; 3], fds: Vec) = request0.serialize(major_opcode(conn)?); |
| 510 | let slices: [IoSlice<'_>; 3] = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; |
| 511 | assert_eq!(slices.len(), bytes.len()); |
| 512 | conn.send_request_with_reply(&slices, fds) |
| 513 | } |
| 514 | |
| 515 | /// Extension trait defining the requests of this extension. |
| 516 | pub trait ConnectionExt: RequestConnection { |
| 517 | fn xkb_use_extension(&self, wanted_major: u16, wanted_minor: u16) -> Result<Cookie<'_, Self, UseExtensionReply>, ConnectionError> |
| 518 | { |
| 519 | use_extension(self, wanted_major, wanted_minor) |
| 520 | } |
| 521 | fn xkb_select_events<'c, 'input>(&'c self, device_spec: DeviceSpec, clear: EventType, select_all: EventType, affect_map: MapPart, map: MapPart, details: &'input SelectEventsAux) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 522 | { |
| 523 | select_events(self, device_spec, clear, select_all, affect_map, map, details) |
| 524 | } |
| 525 | fn xkb_bell(&self, device_spec: DeviceSpec, bell_class: BellClassSpec, bell_id: IDSpec, percent: i8, force_sound: bool, event_only: bool, pitch: i16, duration: i16, name: xproto::Atom, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError> |
| 526 | { |
| 527 | bell(self, device_spec, bell_class, bell_id, percent, force_sound, event_only, pitch, duration, name, window) |
| 528 | } |
| 529 | fn xkb_get_state(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetStateReply>, ConnectionError> |
| 530 | { |
| 531 | get_state(self, device_spec) |
| 532 | } |
| 533 | fn xkb_latch_lock_state(&self, device_spec: DeviceSpec, affect_mod_locks: xproto::ModMask, mod_locks: xproto::ModMask, lock_group: bool, group_lock: Group, affect_mod_latches: xproto::ModMask, latch_group: bool, group_latch: u16) -> Result<VoidCookie<'_, Self>, ConnectionError> |
| 534 | { |
| 535 | latch_lock_state(self, device_spec, affect_mod_locks, mod_locks, lock_group, group_lock, affect_mod_latches, latch_group, group_latch) |
| 536 | } |
| 537 | fn xkb_get_controls(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetControlsReply>, ConnectionError> |
| 538 | { |
| 539 | get_controls(self, device_spec) |
| 540 | } |
| 541 | fn xkb_set_controls<'c, 'input>(&'c self, device_spec: DeviceSpec, affect_internal_real_mods: xproto::ModMask, internal_real_mods: xproto::ModMask, affect_ignore_lock_real_mods: xproto::ModMask, ignore_lock_real_mods: xproto::ModMask, affect_internal_virtual_mods: VMod, internal_virtual_mods: VMod, affect_ignore_lock_virtual_mods: VMod, ignore_lock_virtual_mods: VMod, mouse_keys_dflt_btn: u8, groups_wrap: u8, access_x_options: AXOption, affect_enabled_controls: BoolCtrl, enabled_controls: BoolCtrl, change_controls: Control, repeat_delay: u16, repeat_interval: u16, slow_keys_delay: u16, debounce_delay: u16, mouse_keys_delay: u16, mouse_keys_interval: u16, mouse_keys_time_to_max: u16, mouse_keys_max_speed: u16, mouse_keys_curve: i16, access_x_timeout: u16, access_x_timeout_mask: BoolCtrl, access_x_timeout_values: BoolCtrl, access_x_timeout_options_mask: AXOption, access_x_timeout_options_values: AXOption, per_key_repeat: &'input [u8; 32]) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 542 | { |
| 543 | set_controls(self, device_spec, affect_internal_real_mods, internal_real_mods, affect_ignore_lock_real_mods, ignore_lock_real_mods, affect_internal_virtual_mods, internal_virtual_mods, affect_ignore_lock_virtual_mods, ignore_lock_virtual_mods, mouse_keys_dflt_btn, groups_wrap, access_x_options, affect_enabled_controls, enabled_controls, change_controls, repeat_delay, repeat_interval, slow_keys_delay, debounce_delay, mouse_keys_delay, mouse_keys_interval, mouse_keys_time_to_max, mouse_keys_max_speed, mouse_keys_curve, access_x_timeout, access_x_timeout_mask, access_x_timeout_values, access_x_timeout_options_mask, access_x_timeout_options_values, per_key_repeat) |
| 544 | } |
| 545 | fn xkb_get_map(&self, device_spec: DeviceSpec, full: MapPart, partial: MapPart, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, first_key_action: xproto::Keycode, n_key_actions: u8, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, virtual_mods: VMod, first_key_explicit: xproto::Keycode, n_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8) -> Result<Cookie<'_, Self, GetMapReply>, ConnectionError> |
| 546 | { |
| 547 | get_map(self, device_spec, full, partial, first_type, n_types, first_key_sym, n_key_syms, first_key_action, n_key_actions, first_key_behavior, n_key_behaviors, virtual_mods, first_key_explicit, n_key_explicit, first_mod_map_key, n_mod_map_keys, first_v_mod_map_key, n_v_mod_map_keys) |
| 548 | } |
| 549 | fn xkb_set_map<'c, 'input>(&'c self, device_spec: DeviceSpec, flags: SetMapFlags, min_key_code: xproto::Keycode, max_key_code: xproto::Keycode, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, total_syms: u16, first_key_action: xproto::Keycode, n_key_actions: u8, total_actions: u16, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, total_key_behaviors: u8, first_key_explicit: xproto::Keycode, n_key_explicit: u8, total_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, total_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8, total_v_mod_map_keys: u8, virtual_mods: VMod, values: &'input SetMapAux) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 550 | { |
| 551 | set_map(self, device_spec, flags, min_key_code, max_key_code, first_type, n_types, first_key_sym, n_key_syms, total_syms, first_key_action, n_key_actions, total_actions, first_key_behavior, n_key_behaviors, total_key_behaviors, first_key_explicit, n_key_explicit, total_key_explicit, first_mod_map_key, n_mod_map_keys, total_mod_map_keys, first_v_mod_map_key, n_v_mod_map_keys, total_v_mod_map_keys, virtual_mods, values) |
| 552 | } |
| 553 | fn xkb_get_compat_map(&self, device_spec: DeviceSpec, groups: SetOfGroup, get_all_si: bool, first_si: u16, n_si: u16) -> Result<Cookie<'_, Self, GetCompatMapReply>, ConnectionError> |
| 554 | { |
| 555 | get_compat_map(self, device_spec, groups, get_all_si, first_si, n_si) |
| 556 | } |
| 557 | fn xkb_set_compat_map<'c, 'input>(&'c self, device_spec: DeviceSpec, recompute_actions: bool, truncate_si: bool, groups: SetOfGroup, first_si: u16, si: &'input [SymInterpret], group_maps: &'input [ModDef]) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 558 | { |
| 559 | set_compat_map(self, device_spec, recompute_actions, truncate_si, groups, first_si, si, group_maps) |
| 560 | } |
| 561 | fn xkb_get_indicator_state(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetIndicatorStateReply>, ConnectionError> |
| 562 | { |
| 563 | get_indicator_state(self, device_spec) |
| 564 | } |
| 565 | fn xkb_get_indicator_map(&self, device_spec: DeviceSpec, which: u32) -> Result<Cookie<'_, Self, GetIndicatorMapReply>, ConnectionError> |
| 566 | { |
| 567 | get_indicator_map(self, device_spec, which) |
| 568 | } |
| 569 | fn xkb_set_indicator_map<'c, 'input>(&'c self, device_spec: DeviceSpec, which: u32, maps: &'input [IndicatorMap]) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 570 | { |
| 571 | set_indicator_map(self, device_spec, which, maps) |
| 572 | } |
| 573 | fn xkb_get_named_indicator<A>(&self, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom) -> Result<Cookie<'_, Self, GetNamedIndicatorReply>, ConnectionError> |
| 574 | where |
| 575 | A: Into<IDSpec>, |
| 576 | { |
| 577 | get_named_indicator(self, device_spec, led_class, led_id, indicator) |
| 578 | } |
| 579 | fn xkb_set_named_indicator<A>(&self, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom, set_state: bool, on: bool, set_map: bool, create_map: bool, map_flags: IMFlag, map_which_groups: IMGroupsWhich, map_groups: SetOfGroups, map_which_mods: IMModsWhich, map_real_mods: xproto::ModMask, map_vmods: VMod, map_ctrls: BoolCtrl) -> Result<VoidCookie<'_, Self>, ConnectionError> |
| 580 | where |
| 581 | A: Into<IDSpec>, |
| 582 | { |
| 583 | set_named_indicator(self, device_spec, led_class, led_id, indicator, set_state, on, set_map, create_map, map_flags, map_which_groups, map_groups, map_which_mods, map_real_mods, map_vmods, map_ctrls) |
| 584 | } |
| 585 | fn xkb_get_names(&self, device_spec: DeviceSpec, which: NameDetail) -> Result<Cookie<'_, Self, GetNamesReply>, ConnectionError> |
| 586 | { |
| 587 | get_names(self, device_spec, which) |
| 588 | } |
| 589 | fn xkb_set_names<'c, 'input>(&'c self, device_spec: DeviceSpec, virtual_mods: VMod, first_type: u8, n_types: u8, first_kt_levelt: u8, n_kt_levels: u8, indicators: u32, group_names: SetOfGroup, n_radio_groups: u8, first_key: xproto::Keycode, n_keys: u8, n_key_aliases: u8, total_kt_level_names: u16, values: &'input SetNamesAux) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 590 | { |
| 591 | set_names(self, device_spec, virtual_mods, first_type, n_types, first_kt_levelt, n_kt_levels, indicators, group_names, n_radio_groups, first_key, n_keys, n_key_aliases, total_kt_level_names, values) |
| 592 | } |
| 593 | fn xkb_per_client_flags(&self, device_spec: DeviceSpec, change: PerClientFlag, value: PerClientFlag, ctrls_to_change: BoolCtrl, auto_ctrls: BoolCtrl, auto_ctrls_values: BoolCtrl) -> Result<Cookie<'_, Self, PerClientFlagsReply>, ConnectionError> |
| 594 | { |
| 595 | per_client_flags(self, device_spec, change, value, ctrls_to_change, auto_ctrls, auto_ctrls_values) |
| 596 | } |
| 597 | fn xkb_list_components(&self, device_spec: DeviceSpec, max_names: u16) -> Result<Cookie<'_, Self, ListComponentsReply>, ConnectionError> |
| 598 | { |
| 599 | list_components(self, device_spec, max_names) |
| 600 | } |
| 601 | fn xkb_get_kbd_by_name(&self, device_spec: DeviceSpec, need: GBNDetail, want: GBNDetail, load: bool) -> Result<Cookie<'_, Self, GetKbdByNameReply>, ConnectionError> |
| 602 | { |
| 603 | get_kbd_by_name(self, device_spec, need, want, load) |
| 604 | } |
| 605 | fn xkb_get_device_info<A>(&self, device_spec: DeviceSpec, wanted: XIFeature, all_buttons: bool, first_button: u8, n_buttons: u8, led_class: LedClass, led_id: A) -> Result<Cookie<'_, Self, GetDeviceInfoReply>, ConnectionError> |
| 606 | where |
| 607 | A: Into<IDSpec>, |
| 608 | { |
| 609 | get_device_info(self, device_spec, wanted, all_buttons, first_button, n_buttons, led_class, led_id) |
| 610 | } |
| 611 | fn xkb_set_device_info<'c, 'input>(&'c self, device_spec: DeviceSpec, first_btn: u8, change: XIFeature, btn_actions: &'input [Action], leds: &'input [DeviceLedInfo]) -> Result<VoidCookie<'c, Self>, ConnectionError> |
| 612 | { |
| 613 | set_device_info(self, device_spec, first_btn, change, btn_actions, leds) |
| 614 | } |
| 615 | fn xkb_set_debugging_flags<'c, 'input>(&'c self, affect_flags: u32, flags: u32, affect_ctrls: u32, ctrls: u32, message: &'input [String8]) -> Result<Cookie<'c, Self, SetDebuggingFlagsReply>, ConnectionError> |
| 616 | { |
| 617 | set_debugging_flags(self, affect_flags, flags, affect_ctrls, ctrls, message) |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | impl<C: RequestConnection + ?Sized> ConnectionExt for C {} |
| 622 | |