config: add fallback output mode
This commit is contained in:
parent
a975e3b25a
commit
dd3f8bad40
16 changed files with 215 additions and 19 deletions
|
|
@ -54,7 +54,7 @@ use {
|
|||
Axis, Direction, Workspace,
|
||||
client::{Client as ConfigClient, ClientCapabilities, ClientMatcher},
|
||||
input::{
|
||||
FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, Timeline,
|
||||
FallbackOutputMode, FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, Timeline,
|
||||
acceleration::{ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT, AccelProfile},
|
||||
capability::{
|
||||
CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD,
|
||||
|
|
@ -518,6 +518,16 @@ impl ConfigProxyHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_fallback_output_mode(
|
||||
&self,
|
||||
seat: Seat,
|
||||
mode: FallbackOutputMode,
|
||||
) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
seat.set_fallback_output_mode(mode);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_management_enabled(
|
||||
&self,
|
||||
seat: Seat,
|
||||
|
|
@ -1056,7 +1066,7 @@ impl ConfigProxyHandler {
|
|||
let name = self.get_workspace(ws)?;
|
||||
let workspace = match self.state.workspaces.get(name.deref()) {
|
||||
Some(ws) => ws,
|
||||
_ => seat.get_cursor_output().create_workspace(name.deref()),
|
||||
_ => seat.get_fallback_output().create_workspace(name.deref()),
|
||||
};
|
||||
seat.set_workspace(&workspace);
|
||||
Ok(())
|
||||
|
|
@ -1112,11 +1122,12 @@ impl ConfigProxyHandler {
|
|||
Some(ws) => ws,
|
||||
_ => return Ok(()),
|
||||
},
|
||||
WorkspaceSource::Seat(s) => match self.get_seat(s)?.get_cursor_output().workspace.get()
|
||||
{
|
||||
Some(ws) => ws,
|
||||
_ => return Ok(()),
|
||||
},
|
||||
WorkspaceSource::Seat(s) => {
|
||||
match self.get_seat(s)?.get_fallback_output().workspace.get() {
|
||||
Some(ws) => ws,
|
||||
_ => return Ok(()),
|
||||
}
|
||||
}
|
||||
};
|
||||
self.state.move_ws_to_output(&ws, &output);
|
||||
Ok(())
|
||||
|
|
@ -3355,6 +3366,9 @@ impl ConfigProxyHandler {
|
|||
} => self
|
||||
.handle_keymap_from_names(rules, model, groups, options)
|
||||
.wrn("keymap_from_names")?,
|
||||
ClientMessage::SetFallbackOutputMode { seat, mode } => self
|
||||
.handle_set_fallback_output_mode(seat, mode)
|
||||
.wrn("set_fallback_output_mode")?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -780,7 +780,7 @@ impl State {
|
|||
pub fn ensure_map_workspace(&self, seat: Option<&Rc<WlSeatGlobal>>) -> Rc<WorkspaceNode> {
|
||||
seat.cloned()
|
||||
.or_else(|| self.seat_queue.last().map(|s| s.deref().clone()))
|
||||
.map(|s| s.get_cursor_output())
|
||||
.map(|s| s.get_fallback_output())
|
||||
.or_else(|| self.root.outputs.lock().values().next().cloned())
|
||||
.or_else(|| self.dummy_output.get())
|
||||
.unwrap()
|
||||
|
|
@ -916,7 +916,7 @@ impl State {
|
|||
let ws = match self.workspaces.get(name) {
|
||||
Some(ws) => ws,
|
||||
_ => {
|
||||
let output = output.unwrap_or_else(|| seat.get_cursor_output());
|
||||
let output = output.unwrap_or_else(|| seat.get_fallback_output());
|
||||
if output.is_dummy {
|
||||
log::warn!("Not showing workspace because seat is on dummy output");
|
||||
return;
|
||||
|
|
@ -929,7 +929,7 @@ impl State {
|
|||
|
||||
pub fn float_map_ws(&self) -> Rc<WorkspaceNode> {
|
||||
if let Some(seat) = self.seat_queue.last() {
|
||||
let output = seat.get_cursor_output();
|
||||
let output = seat.get_fallback_output();
|
||||
if !output.is_dummy {
|
||||
return output.ensure_workspace();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue