autocommit 2022-02-17 19:12:52 CET
This commit is contained in:
parent
cf322f05be
commit
195a92d98b
29 changed files with 610 additions and 175 deletions
|
|
@ -1,6 +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::theme::Color;
|
||||
use crate::{Axis, Command, Direction, InputDevice, Keyboard, LogLevel, ModifiedKeySym, Seat};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Entry;
|
||||
|
|
@ -195,10 +196,60 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_title_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetTitleColor { color });
|
||||
}
|
||||
|
||||
pub fn set_border_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetBorderColor { color });
|
||||
}
|
||||
|
||||
pub fn set_title_underline_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetTitleUnderlineColor { color });
|
||||
}
|
||||
|
||||
pub fn set_background_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetBackgroundColor { color });
|
||||
}
|
||||
|
||||
pub fn get_title_height(&self) -> i32 {
|
||||
let resp = self.with_response(|| self.send(&ClientMessage::GetTitleHeight));
|
||||
match resp {
|
||||
Response::GetTitleHeight { height } => height,
|
||||
_ => {
|
||||
log::warn!("Server did not reply to a get_title_height request");
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_border_width(&self) -> i32 {
|
||||
let resp = self.with_response(|| self.send(&ClientMessage::GetBorderWidth));
|
||||
match resp {
|
||||
Response::GetBorderWidth { width } => width,
|
||||
_ => {
|
||||
log::warn!("Server did not reply to a get_border_width request");
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_title_height(&self, height: i32) {
|
||||
self.send(&ClientMessage::SetTitleHeight { height })
|
||||
}
|
||||
|
||||
pub fn set_border_width(&self, width: i32) {
|
||||
self.send(&ClientMessage::SetBorderWidth { width })
|
||||
}
|
||||
|
||||
pub fn set_split(&self, seat: Seat, axis: Axis) {
|
||||
self.send(&ClientMessage::SetSplit { seat, axis });
|
||||
}
|
||||
|
||||
pub fn create_split(&self, seat: Seat, axis: Axis) {
|
||||
self.send(&ClientMessage::CreateSplit { seat, axis });
|
||||
}
|
||||
|
||||
pub fn create_seat(&self, name: &str) -> Seat {
|
||||
let response = self.with_response(|| self.send(&ClientMessage::CreateSeat { name }));
|
||||
match response {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::keyboard::mods::Modifiers;
|
||||
use crate::keyboard::syms::KeySym;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Direction, InputDevice, Keyboard, LogLevel, Seat};
|
||||
use bincode::{BorrowDecode, Decode, Encode};
|
||||
|
||||
|
|
@ -94,6 +95,30 @@ pub enum ClientMessage<'a> {
|
|||
kb: Keyboard,
|
||||
grab: bool,
|
||||
},
|
||||
GetTitleHeight,
|
||||
GetBorderWidth,
|
||||
SetTitleHeight {
|
||||
height: i32,
|
||||
},
|
||||
SetBorderWidth {
|
||||
width: i32,
|
||||
},
|
||||
SetTitleColor {
|
||||
color: Color,
|
||||
},
|
||||
SetTitleUnderlineColor {
|
||||
color: Color,
|
||||
},
|
||||
SetBorderColor {
|
||||
color: Color,
|
||||
},
|
||||
SetBackgroundColor {
|
||||
color: Color,
|
||||
},
|
||||
CreateSplit {
|
||||
seat: Seat,
|
||||
axis: Axis,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
@ -105,6 +130,8 @@ pub enum Response {
|
|||
ParseKeymap { keymap: Keymap },
|
||||
CreateSeat { seat: Seat },
|
||||
GetInputDevices { devices: Vec<InputDevice> },
|
||||
GetTitleHeight { height: i32 },
|
||||
GetBorderWidth { width: i32 },
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue