On X11, extract event handlers

Make code more clear wrt explicit returns during event handling,
which may lead to skipped IME event handling.
This commit is contained in:
Kirill Chibisov 2024-02-09 06:32:03 +04:00
parent dbe0f852da
commit 273984a385
6 changed files with 1400 additions and 1349 deletions

View file

@ -940,10 +940,12 @@ impl EventLoopWindowTarget {
} }
} }
#[allow(dead_code)]
fn set_exit_code(&self, code: i32) { fn set_exit_code(&self, code: i32) {
x11_or_wayland!(match self; Self(evlp) => evlp.set_exit_code(code)) x11_or_wayland!(match self; Self(evlp) => evlp.set_exit_code(code))
} }
#[allow(dead_code)]
fn exit_code(&self) -> Option<i32> { fn exit_code(&self) -> Option<i32> {
x11_or_wayland!(match self; Self(evlp) => evlp.exit_code()) x11_or_wayland!(match self; Self(evlp) => evlp.exit_code())
} }

View file

@ -6,7 +6,7 @@ macro_rules! atom_manager {
($($name:ident $(:$lit:literal)?),*) => { ($($name:ident $(:$lit:literal)?),*) => {
x11rb::atom_manager! { x11rb::atom_manager! {
/// The atoms used by `winit` /// The atoms used by `winit`
pub(crate) Atoms: AtomsCookie { pub Atoms: AtomsCookie {
$($name $(:$lit)?,)* $($name $(:$lit)?,)*
} }
} }
@ -14,7 +14,7 @@ macro_rules! atom_manager {
/// Indices into the `Atoms` struct. /// Indices into the `Atoms` struct.
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) enum AtomName { pub enum AtomName {
$($name,)* $($name,)*
} }

View file

@ -41,7 +41,7 @@ impl From<io::Error> for DndDataParseError {
} }
} }
pub(crate) struct Dnd { pub struct Dnd {
xconn: Arc<XConnection>, xconn: Arc<XConnection>,
// Populated by XdndEnter event handler // Populated by XdndEnter event handler
pub version: Option<c_long>, pub version: Option<c_long>,

File diff suppressed because it is too large Load diff

View file

@ -1025,7 +1025,7 @@ fn mkdid(w: xinput::DeviceId) -> crate::event::DeviceId {
} }
#[derive(Debug)] #[derive(Debug)]
struct Device { pub struct Device {
_name: String, _name: String,
scroll_axes: Vec<(i32, ScrollAxis)>, scroll_axes: Vec<(i32, ScrollAxis)>,
// For master devices, this is the paired device (pointer <-> keyboard). // For master devices, this is the paired device (pointer <-> keyboard).

View file

@ -324,7 +324,7 @@ impl XConnection {
} }
} }
pub(crate) struct ScreenResources { pub struct ScreenResources {
/// List of attached modes. /// List of attached modes.
modes: Vec<randr::ModeInfo>, modes: Vec<randr::ModeInfo>,