Skip to content

Commit

Permalink
linux: Replaces NO_SYMBOL with upsteam const
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv committed Dec 7, 2024
1 parent 5a01f34 commit 8ecafac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/linux/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ pub(super) use xkeysym::{KeyCode, Keysym};
use crate::keycodes::ModifierBitflag;
use crate::{Direction, InputError, InputResult, Key};

/// The "empty" keyboard symbol.
// TODO: Replace it with the NoSymbol from xkeysym, once a new version was
// published
pub const NO_SYMBOL: Keysym = Keysym::new(0);
#[cfg(feature = "x11rb")]
const DEFAULT_DELAY: u32 = 12;

Expand Down Expand Up @@ -203,7 +199,7 @@ where
keycode: Keycode,
) -> InputResult<()> {
trace!("trying to unmap keysym {:?}", keysym);
if c.bind_key(keycode, NO_SYMBOL).is_err() {
if c.bind_key(keycode, Keysym::NoSymbol).is_err() {
return Err(InputError::Unmapping(format!("{keysym:?}")));
};
self.needs_regeneration = true;
Expand Down
6 changes: 3 additions & 3 deletions src/linux/x11rb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use x11rb::{
wrapper::ConnectionExt as _,
};

use super::keymap::{Bind, KeyMap, Keysym, NO_SYMBOL};
use super::keymap::{Bind, KeyMap, Keysym};
use crate::{
keycodes::Modifier, Axis, Button, Coordinate, Direction, InputError, InputResult, Key,
Keyboard, Mouse, NewConError,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl Con {
trace!("{kc}: {syms_name:?}");
}

if syms.iter().all(|&s| s == NO_SYMBOL.raw()) {
if syms.iter().all(|&s| s == Keysym::NoSymbol.raw()) {
unused_keycodes.push_back(kc);
}
}
Expand Down Expand Up @@ -220,7 +220,7 @@ impl Drop for Con {
// changes
debug!("x11rb connection was dropped");
for &keycode in self.keymap.additionally_mapped.values() {
match self.connection.bind_key(keycode, NO_SYMBOL) {
match self.connection.bind_key(keycode, Keysym::NoSymbol) {
Ok(()) => debug!("unmapped keycode {keycode:?}"),
Err(e) => error!("unable to unmap keycode {keycode:?}. {e:?}"),
};
Expand Down

0 comments on commit 8ecafac

Please sign in to comment.