1
0
Fork 0
forked from wry/wry

autocommit 2022-02-16 18:14:14 CET

This commit is contained in:
Julian Orth 2022-02-16 18:14:14 +01:00
parent 086f2f73f4
commit 8d0b82c37c
17 changed files with 220 additions and 42 deletions

View file

@ -1,7 +1,7 @@
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::{Axis, Command, Direction, InputDevice, LogLevel, ModifiedKeySym, Seat};
use crate::{Axis, Command, Direction, InputDevice, Keyboard, LogLevel, ModifiedKeySym, Seat};
use std::cell::{Cell, RefCell};
use std::collections::hash_map::Entry;
use std::collections::HashMap;
@ -140,6 +140,10 @@ impl Client {
});
}
pub fn grab(&self, kb: Keyboard, grab: bool) {
self.send(&ClientMessage::GrabKb { kb, grab });
}
pub fn focus(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::Focus { seat, direction });
}
@ -206,8 +210,8 @@ impl Client {
}
}
pub fn get_input_devices(&self) -> Vec<InputDevice> {
let res = self.with_response(|| self.send(&ClientMessage::GetInputDevices));
pub fn get_input_devices(&self, seat: Option<Seat>) -> Vec<InputDevice> {
let res = self.with_response(|| self.send(&ClientMessage::GetInputDevices { seat }));
match res {
Response::GetInputDevices { devices } => devices,
_ => {

View file

@ -1,7 +1,7 @@
use crate::keyboard::keymap::Keymap;
use crate::keyboard::mods::Modifiers;
use crate::keyboard::syms::KeySym;
use crate::{Axis, Direction, InputDevice, LogLevel, Seat};
use crate::{Axis, Direction, InputDevice, Keyboard, LogLevel, Seat};
use bincode::{BorrowDecode, Decode, Encode};
#[derive(Encode, BorrowDecode, Debug)]
@ -64,7 +64,9 @@ pub enum ClientMessage<'a> {
seat: Seat,
},
GetSeats,
GetInputDevices,
GetInputDevices {
seat: Option<Seat>,
},
AddShortcut {
seat: Seat,
mods: Modifiers,
@ -88,6 +90,10 @@ pub enum ClientMessage<'a> {
seat: Seat,
direction: Direction,
},
GrabKb {
kb: Keyboard,
grab: bool,
},
}
#[derive(Encode, Decode, Debug)]