config: make focus-follows-mouse optional
This commit is contained in:
parent
fe2663fca3
commit
a12065a915
14 changed files with 96 additions and 6 deletions
|
|
@ -10,7 +10,10 @@ use {
|
|||
logging, Config, ConfigEntry, ConfigEntryGen, PollableId, WireMode, VERSION,
|
||||
},
|
||||
exec::Command,
|
||||
input::{acceleration::AccelProfile, capability::Capability, InputDevice, Seat},
|
||||
input::{
|
||||
acceleration::AccelProfile, capability::Capability, FocusFollowsMouseMode, InputDevice,
|
||||
Seat,
|
||||
},
|
||||
keyboard::{
|
||||
mods::{Modifiers, RELEASE},
|
||||
syms::KeySym,
|
||||
|
|
@ -924,6 +927,10 @@ impl Client {
|
|||
self.send(&ClientMessage::SetForward { seat, forward })
|
||||
}
|
||||
|
||||
pub fn set_focus_follows_mouse_mode(&self, seat: Seat, mode: FocusFollowsMouseMode) {
|
||||
self.send(&ClientMessage::SetFocusFollowsMouseMode { seat, mode })
|
||||
}
|
||||
|
||||
pub fn parse_keymap(&self, keymap: &str) -> Keymap {
|
||||
let res = self.send_with_response(&ClientMessage::ParseKeymap { keymap });
|
||||
get_response!(res, Keymap(0), ParseKeymap { keymap });
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
input::{acceleration::AccelProfile, capability::Capability, InputDevice, Seat},
|
||||
input::{
|
||||
acceleration::AccelProfile, capability::Capability, FocusFollowsMouseMode, InputDevice,
|
||||
Seat,
|
||||
},
|
||||
keyboard::{mods::Modifiers, syms::KeySym, Keymap},
|
||||
logging::LogLevel,
|
||||
theme::{colors::Colorable, sized::Resizable, Color},
|
||||
|
|
@ -464,6 +467,10 @@ pub enum ClientMessage<'a> {
|
|||
mod_mask: Modifiers,
|
||||
sym: KeySym,
|
||||
},
|
||||
SetFocusFollowsMouseMode {
|
||||
seat: Seat,
|
||||
mode: FocusFollowsMouseMode,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -390,6 +390,21 @@ impl Seat {
|
|||
pub fn consume(self) {
|
||||
self.set_forward(false)
|
||||
}
|
||||
|
||||
/// Sets the focus-follows-mouse mode.
|
||||
pub fn set_focus_follows_mouse_mode(self, mode: FocusFollowsMouseMode) {
|
||||
get!().set_focus_follows_mouse_mode(self, mode);
|
||||
}
|
||||
}
|
||||
|
||||
/// A focus-follows-mouse mode.
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
pub enum FocusFollowsMouseMode {
|
||||
/// When the mouse moves and enters a toplevel, that toplevel gets the keyboard focus.
|
||||
True,
|
||||
/// The keyboard focus changes only when clicking on a window or the previously
|
||||
/// focused window becomes invisible.
|
||||
False,
|
||||
}
|
||||
|
||||
/// Returns all seats.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue