config: add fallback output mode
This commit is contained in:
parent
a975e3b25a
commit
dd3f8bad40
16 changed files with 215 additions and 19 deletions
|
|
@ -106,7 +106,10 @@ use {
|
|||
wire_ei::EiSeatId,
|
||||
},
|
||||
ahash::AHashMap,
|
||||
jay_config::keyboard::syms::{KeySym, SYM_Escape},
|
||||
jay_config::{
|
||||
input::FallbackOutputMode,
|
||||
keyboard::syms::{KeySym, SYM_Escape},
|
||||
},
|
||||
kbvm::Keycode,
|
||||
smallvec::SmallVec,
|
||||
std::{
|
||||
|
|
@ -226,6 +229,7 @@ pub struct WlSeatGlobal {
|
|||
input_method_grab: CloneCell<Option<Rc<dyn InputMethodKeyboardGrab>>>,
|
||||
forward: Cell<bool>,
|
||||
focus_follows_mouse: Cell<bool>,
|
||||
fallback_output_mode: Cell<FallbackOutputMode>,
|
||||
swipe_bindings: PerClientBindings<ZwpPointerGestureSwipeV1>,
|
||||
pinch_bindings: PerClientBindings<ZwpPointerGesturePinchV1>,
|
||||
hold_bindings: PerClientBindings<ZwpPointerGestureHoldV1>,
|
||||
|
|
@ -325,6 +329,7 @@ impl WlSeatGlobal {
|
|||
input_method_grab: Default::default(),
|
||||
forward: Cell::new(false),
|
||||
focus_follows_mouse: Cell::new(true),
|
||||
fallback_output_mode: Cell::new(FallbackOutputMode::Cursor),
|
||||
swipe_bindings: Default::default(),
|
||||
pinch_bindings: Default::default(),
|
||||
hold_bindings: Default::default(),
|
||||
|
|
@ -469,6 +474,15 @@ impl WlSeatGlobal {
|
|||
self.keyboard_node.get().node_output()
|
||||
}
|
||||
|
||||
pub fn get_fallback_output(&self) -> Rc<OutputNode> {
|
||||
if self.fallback_output_mode.get() == FallbackOutputMode::Focus
|
||||
&& let Some(output) = self.get_keyboard_output()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
self.get_cursor_output()
|
||||
}
|
||||
|
||||
pub fn set_workspace(&self, ws: &Rc<WorkspaceNode>) {
|
||||
let tl = match self.keyboard_node.get().node_toplevel() {
|
||||
Some(tl) => tl,
|
||||
|
|
@ -1393,6 +1407,10 @@ impl WlSeatGlobal {
|
|||
self.focus_follows_mouse.set(focus_follows_mouse);
|
||||
}
|
||||
|
||||
pub fn set_fallback_output_mode(&self, fallback_output_mode: FallbackOutputMode) {
|
||||
self.fallback_output_mode.set(fallback_output_mode);
|
||||
}
|
||||
|
||||
pub fn set_window_management_enabled(self: &Rc<Self>, enabled: bool) {
|
||||
self.pointer_owner
|
||||
.set_window_management_enabled(self, enabled);
|
||||
|
|
|
|||
|
|
@ -213,12 +213,12 @@ impl NodeSeatState {
|
|||
fn release_kb_focus2(&self, focus_last: bool) {
|
||||
self.release_kb_grab();
|
||||
while let Some((_, seat)) = self.kb_foci.pop() {
|
||||
let output = seat.get_fallback_output();
|
||||
seat.kb_owner
|
||||
.set_kb_node(&seat, seat.state.root.clone(), seat.state.next_serial(None));
|
||||
// log::info!("keyboard_node = root");
|
||||
if focus_last {
|
||||
seat.get_cursor_output()
|
||||
.node_do_focus(&seat, Direction::Unspecified);
|
||||
output.node_do_focus(&seat, Direction::Unspecified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ impl ZwlrLayerShellV1RequestHandler for ZwlrLayerShellV1 {
|
|||
self.client.lookup(req.output)?.global.clone()
|
||||
} else {
|
||||
for seat in self.client.state.seat_queue.rev_iter() {
|
||||
let output = seat.get_cursor_output();
|
||||
let output = seat.get_fallback_output();
|
||||
if !output.is_dummy {
|
||||
break 'get_output output.global.opt.clone();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue