seat: Use user-provided xkb-config
This commit is contained in:
parent
6966305ad4
commit
7708cdc1a2
4 changed files with 23 additions and 7 deletions
|
|
@ -373,6 +373,10 @@ impl Config {
|
||||||
.insert(infos, configs);
|
.insert(infos, configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn xkb_config(&self) -> XkbConfig {
|
||||||
|
self.dynamic_conf.inputs().xkb.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn read_device(&mut self, device: &mut InputDevice) {
|
pub fn read_device(&mut self, device: &mut InputDevice) {
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ pub use smithay::{
|
||||||
utils::{Logical, Physical, Point, Size, Transform},
|
utils::{Logical, Physical, Point, Size, Transform},
|
||||||
wayland::{
|
wayland::{
|
||||||
output::{Mode, Output},
|
output::{Mode, Output},
|
||||||
seat::{keysyms as KeySyms, Keysym, ModifiersState as KeyModifiers},
|
seat::{keysyms as KeySyms, Keysym, ModifiersState as KeyModifiers, XkbConfig as WlXkbConfig},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use xkbcommon::xkb;
|
use xkbcommon::xkb;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct XkbConfig {
|
pub struct XkbConfig {
|
||||||
pub rules: String,
|
pub rules: String,
|
||||||
pub model: String,
|
pub model: String,
|
||||||
|
|
@ -35,6 +35,18 @@ impl Default for XkbConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Into<WlXkbConfig<'a>> for &'a XkbConfig {
|
||||||
|
fn into(self) -> WlXkbConfig<'a> {
|
||||||
|
WlXkbConfig {
|
||||||
|
rules: &self.rules,
|
||||||
|
model: &self.model,
|
||||||
|
layout: &self.layout,
|
||||||
|
variant: &self.variant,
|
||||||
|
options: self.options.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub mod ClickMethodDef {
|
pub mod ClickMethodDef {
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use smithay::reexports::input::ClickMethod as ClickMethodOrig;
|
use smithay::reexports::input::ClickMethod as ClickMethodOrig;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::Action,
|
config::{Action, Config},
|
||||||
shell::{
|
shell::{
|
||||||
Workspace,
|
Workspace,
|
||||||
grabs::SeatMoveGrabState,
|
grabs::SeatMoveGrabState,
|
||||||
|
|
@ -19,7 +19,6 @@ use smithay::{
|
||||||
primary_selection::set_primary_focus,
|
primary_selection::set_primary_focus,
|
||||||
seat::{
|
seat::{
|
||||||
keysyms, ButtonEvent, CursorImageStatus, FilterResult, KeysymHandle, MotionEvent, Seat,
|
keysyms, ButtonEvent, CursorImageStatus, FilterResult, KeysymHandle, MotionEvent, Seat,
|
||||||
XkbConfig,
|
|
||||||
},
|
},
|
||||||
shell::wlr_layer::Layer as WlrLayer,
|
shell::wlr_layer::Layer as WlrLayer,
|
||||||
SERIAL_COUNTER,
|
SERIAL_COUNTER,
|
||||||
|
|
@ -99,7 +98,7 @@ impl Devices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_seat(dh: &DisplayHandle, name: String) -> Seat<State> {
|
pub fn add_seat(dh: &DisplayHandle, config: &Config, name: String) -> Seat<State> {
|
||||||
let mut seat = Seat::<State>::new(dh, name, None);
|
let mut seat = Seat::<State>::new(dh, name, None);
|
||||||
let userdata = seat.user_data();
|
let userdata = seat.user_data();
|
||||||
userdata.insert_if_missing(SeatId::default);
|
userdata.insert_if_missing(SeatId::default);
|
||||||
|
|
@ -118,8 +117,9 @@ pub fn add_seat(dh: &DisplayHandle, name: String) -> Seat<State> {
|
||||||
// So instead of doing the right thing (and initialize these capabilities as matching
|
// So instead of doing the right thing (and initialize these capabilities as matching
|
||||||
// devices appear), we have to surrender to reality and just always expose a keyboard and pointer.
|
// devices appear), we have to surrender to reality and just always expose a keyboard and pointer.
|
||||||
let dh_clone = dh.clone();
|
let dh_clone = dh.clone();
|
||||||
|
let conf = config.xkb_config();
|
||||||
let _ = seat.add_keyboard(
|
let _ = seat.add_keyboard(
|
||||||
XkbConfig::default(),
|
(&conf).into(),
|
||||||
200,
|
200,
|
||||||
25,
|
25,
|
||||||
move |seat, focus| {
|
move |seat, focus| {
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ impl State {
|
||||||
let wl_drm_state = WlDrmState;
|
let wl_drm_state = WlDrmState;
|
||||||
|
|
||||||
let shell = Shell::new(&config, dh);
|
let shell = Shell::new(&config, dh);
|
||||||
let initial_seat = crate::input::add_seat(dh, "seat-0".into());
|
let initial_seat = crate::input::add_seat(dh, &config, "seat-0".into());
|
||||||
|
|
||||||
#[cfg(not(feature = "debug"))]
|
#[cfg(not(feature = "debug"))]
|
||||||
let dirty_flag = Arc::new(AtomicBool::new(false));
|
let dirty_flag = Arc::new(AtomicBool::new(false));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue