Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::time::Duration;
use calloop::timer::{TimeoutAction, Timer};
use input::event::gesture::GestureEventCoordinates as _;
use niri_config::{
Action, Bind, Binds, Config, Key, ModKey, Modifiers, MruDirection, SwitchBinds, Trigger, Xkb,
Action, Bind, Binds, Config, Key, ModKey, Modifiers, MruDirection, SwitchBinds, Trigger,
};
use niri_ipc::LayoutSwitchTarget;
use smithay::backend::input::{
Expand Down Expand Up @@ -48,7 +48,6 @@ use crate::dbus::freedesktop_a11y::KbMonBlock;
use crate::layout::scrolling::ScrollDirection;
use crate::layout::{ActivateWindow, LayoutElement as _};
use crate::niri::{CastTarget, PointerVisibility, State};
use crate::protocols::virtual_keyboard::VirtualKeyboard;
use crate::ui::mru::{WindowMru, WindowMruUi};
use crate::ui::screenshot_ui::ScreenshotUi;
use crate::utils::spawning::{spawn, spawn_sh};
Expand Down Expand Up @@ -368,29 +367,6 @@ impl State {
) where
I::Device: 'static,
{
// Reset the keymap when handling a physical keyboard after a virtual one.
if self.niri.reset_keymap {
let device = event.device();
let is_virtual_keyboard = (&device as &dyn Any)
.downcast_ref::<VirtualKeyboard>()
.is_some();
if !is_virtual_keyboard {
self.niri.reset_keymap = false;

let config = self.niri.config.borrow();
let xkb_config = config.input.keyboard.xkb.clone();
std::mem::drop(config);

if xkb_config != Xkb::default() {
self.set_xkb_config(xkb_config.to_xkb_config());
} else {
// Use locale1 settings if xkb config is unset.
let xkb = self.niri.xkb_from_locale1.clone().unwrap_or_default();
self.set_xkb_config(xkb.to_xkb_config());
}
}
}

let mod_key = self.backend.mod_key(&self.niri.config.borrow());

let serial = SERIAL_COUNTER.next_serial();
Expand Down
6 changes: 0 additions & 6 deletions src/niri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,6 @@ pub struct Niri {
/// Most recent XKB settings from org.freedesktop.locale1.
pub xkb_from_locale1: Option<Xkb>,

/// Whether to reset the keymap on the next physical keyboard event.
///
/// Set to true when handling virtual keyboard events which override the keymap.
pub reset_keymap: bool,

pub cursor_manager: CursorManager,
pub cursor_texture_cache: CursorTextureCache,
pub cursor_shape_manager_state: CursorShapeManagerState,
Expand Down Expand Up @@ -2510,7 +2505,6 @@ impl Niri {
is_fdo_idle_inhibited: Arc::new(AtomicBool::new(false)),
keyboard_shortcuts_inhibiting_surfaces: HashMap::new(),
xkb_from_locale1: None,
reset_keymap: false,
cursor_manager,
cursor_texture_cache: Default::default(),
cursor_shape_manager_state,
Expand Down
4 changes: 0 additions & 4 deletions src/protocols/virtual_keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ impl VirtualKeyboardHandler for State {
time: u32,
_keyboard: KeyboardHandle<Self>,
) {
// The virtual keyboard impl in Smithay changes the keymap, so we'll need to reset it on
// the next real keyboard event.
self.niri.reset_keymap = true;

let event = VirtualKeyboardKeyEvent {
keycode,
state,
Expand Down