-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* stub keyboard-shortcuts-inhibit and virtual-pointer impls * implement keyboard-shortcuts-inhibit * implement virtual-pointer * deal with supressed key release edge-case; add allow-inhibiting property * add toggle-keyboard-shortcuts-inhibit bind * add InputBackend extensions; use Device::output() for absolute pos events * add a `State` parameter to the backend exts and better document future intent * Add some tests for is_inhibiting_shortcuts --------- Co-authored-by: Ivan Molodetskikh <[email protected]>
- Loading branch information
Showing
8 changed files
with
889 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use ::input as libinput; | ||
use smithay::backend::input; | ||
use smithay::backend::winit::WinitVirtualDevice; | ||
use smithay::output::Output; | ||
|
||
use crate::niri::State; | ||
use crate::protocols::virtual_pointer::VirtualPointer; | ||
|
||
pub trait NiriInputBackend: input::InputBackend<Device = Self::NiriDevice> { | ||
type NiriDevice: NiriInputDevice; | ||
} | ||
impl<T: input::InputBackend> NiriInputBackend for T | ||
where | ||
Self::Device: NiriInputDevice, | ||
{ | ||
type NiriDevice = Self::Device; | ||
} | ||
|
||
pub trait NiriInputDevice: input::Device { | ||
// FIXME: this should maybe be per-event, not per-device, | ||
// but it's not clear that this matters in practice? | ||
// it might be more obvious once we implement it for libinput | ||
fn output(&self, state: &State) -> Option<Output>; | ||
} | ||
|
||
impl NiriInputDevice for libinput::Device { | ||
fn output(&self, _state: &State) -> Option<Output> { | ||
// FIXME: Allow specifying the output per-device? | ||
None | ||
} | ||
} | ||
|
||
impl NiriInputDevice for WinitVirtualDevice { | ||
fn output(&self, _state: &State) -> Option<Output> { | ||
// FIXME: we should be returning the single output that the winit backend creates, | ||
// but for now, that will cause issues because the output is normally upside down, | ||
// so we apply Transform::Flipped180 to it and that would also cause | ||
// the cursor position to be flipped, which is not what we want. | ||
// | ||
// instead, we just return None and rely on the fact that it has only one output. | ||
// doing so causes the cursor to be placed in *global* output coordinates, | ||
// which are not flipped, and happen to be what we want. | ||
None | ||
} | ||
} | ||
|
||
impl NiriInputDevice for VirtualPointer { | ||
fn output(&self, _: &State) -> Option<Output> { | ||
self.output().cloned() | ||
} | ||
} |
Oops, something went wrong.