autocommit 2022-03-30 18:10:37 CEST
This commit is contained in:
parent
c4854c4d7d
commit
a8136ed88c
17 changed files with 189 additions and 81 deletions
|
|
@ -4,13 +4,14 @@ use crate::_private::ipc::{ClientMessage, InitMessage, Response, ServerMessage};
|
|||
use crate::_private::{bincode_ops, logging, Config, ConfigEntry, ConfigEntryGen, VERSION};
|
||||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Command, Direction, InputDevice, LogLevel, ModifiedKeySym, Seat};
|
||||
use crate::{Axis, Command, Direction, LogLevel, ModifiedKeySym, Seat};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use std::{ptr, slice};
|
||||
use crate::input::{Capability, InputDevice};
|
||||
|
||||
pub(crate) struct Client {
|
||||
configure: extern "C" fn(),
|
||||
|
|
@ -317,6 +318,17 @@ impl Client {
|
|||
self.send(&ClientMessage::SetSeat { device, seat })
|
||||
}
|
||||
|
||||
pub fn has_capability(&self, device: InputDevice, cap: Capability) -> bool {
|
||||
let res = self.with_response(|| self.send(&ClientMessage::HasCapability { device, cap }));
|
||||
match res {
|
||||
Response::HasCapability { has } => has,
|
||||
_ => {
|
||||
log::error!("Server did not send a response to a has_capability request");
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn seat_set_keymap(&self, seat: Seat, keymap: Keymap) {
|
||||
self.send(&ClientMessage::SeatSetKeymap { seat, keymap })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ use crate::keyboard::keymap::Keymap;
|
|||
use crate::keyboard::mods::Modifiers;
|
||||
use crate::keyboard::syms::KeySym;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Direction, InputDevice, LogLevel, Seat};
|
||||
use crate::{Axis, Direction, LogLevel, Seat};
|
||||
use bincode::{BorrowDecode, Decode, Encode};
|
||||
use crate::input::{Capability, InputDevice};
|
||||
|
||||
#[derive(Encode, BorrowDecode, Debug)]
|
||||
pub enum ServerMessage {
|
||||
|
|
@ -136,6 +137,10 @@ pub enum ClientMessage<'a> {
|
|||
ToggleFloating {
|
||||
seat: Seat,
|
||||
},
|
||||
HasCapability {
|
||||
device: InputDevice,
|
||||
cap: Capability,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
@ -150,6 +155,7 @@ pub enum Response {
|
|||
GetInputDevices { devices: Vec<InputDevice> },
|
||||
GetTitleHeight { height: i32 },
|
||||
GetBorderWidth { width: i32 },
|
||||
HasCapability { has: bool },
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue