fn convert_hotkey(id: u32, key: &HotKey) -> Option<ACCEL> {
    let mut virt_key = FVIRTKEY;
    let key_mods: Modifiers = key.mods.into();
    if key_mods.ctrl() {
        virt_key |= FCONTROL;
    }
    if key_mods.alt() {
        virt_key |= FALT;
    }
    if key_mods.shift() {
        virt_key |= FSHIFT;
    }

    let raw_key = if let Some(vk_code) = super::keyboard::key_to_vk(&key.key) {
        let mod_code = vk_code >> 8;
        if mod_code & 0x1 != 0 {
            virt_key |= FSHIFT;
        }
        if mod_code & 0x02 != 0 {
            virt_key |= FCONTROL;
        }
        if mod_code & 0x04 != 0 {
            virt_key |= FALT;
        }
        vk_code & 0x00ff
    } else {
        tracing::error!("Failed to convert key {:?} into virtual key code", key.key);
        return None;
    };

    Some(ACCEL {
        fVirt: virt_key,
        key: raw_key as u16,
        cmd: id as u16,
    })
}
/// Convert a hotkey to an accelerator.
///
/// Note that this conversion is dependent on the keyboard map.
/// Therefore, when the keyboard map changes (WM_INPUTLANGCHANGE),
/// we should be rebuilding the accelerator map.
Convert a hotkey to an accelerator.
Note that this conversion is dependent on the keyboard map.
Therefore, when the keyboard map changes (WM_INPUTLANGCHANGE),
we should be rebuilding the accelerator map.
Convert a hotkey to an accelerator . Note that this conversion is dependent on the keyboard map . Therefore when the keyboard map changes ( WM_INPUTLANGCHANGE ) we should be rebuilding the accelerator map .
fn convert_hotkey(id: u32, key: &HotKey) -> Option<ACCEL> {
    let mut virt_key = FVIRTKEY;
    let key_mods: Modifiers = key.mods.into();
    if key_mods.ctrl() {
        virt_key |= FCONTROL;
    }
    if key_mods.alt() {
        virt_key |= FALT;
    }
    if key_mods.shift() {
        virt_key |= FSHIFT;
    }
    let raw_key = if let Some(vk_code) = super::keyboard::key_to_vk(&key.key) {
        let mod_code = vk_code >> 8;
        if mod_code & 0x1 != 0 {
            virt_key |= FSHIFT;
        }
        if mod_code & 0x02 != 0 {
            virt_key |= FCONTROL;
        }
        if mod_code & 0x04 != 0 {
            virt_key |= FALT;
        }
        vk_code & 0x00ff
    } else {
        tracing::error!("Failed to convert key {:?} into virtual key code", key.key);
        return None;
    };
    Some(ACCEL {
        fVirt: virt_key,
        key: raw_key as u16,
        cmd: id as u16,
    })
}
fn convert_hotkey ( id : u32 , key : & HotKey ) -> Option < ACCEL > { let mut virt_key = FVIRTKEY ; let key_mods : Modifiers = key . mods . into ( ) ; if key_mods . ctrl ( ) { virt_key |= FCONTROL ; } if key_mods . alt ( ) { virt_key |= FALT ; } if key_mods . shift ( ) { virt_key |= FSHIFT ; } let raw_key = if let Some ( vk_code ) = super :: keyboard :: key_to_vk ( & key . key ) { let mod_code = vk_code >> 8 ; if mod_code & 0x1 != 0 { virt_key |= FSHIFT ; } if mod_code & 0x02 != 0 { virt_key |= FCONTROL ; } if mod_code & 0x04 != 0 { virt_key |= FALT ; } vk_code & 0x00ff } else { tracing :: error ! ( " " key key ) ; return None ; } ; Some ( ACCEL { fVirt : virt_key , key : raw_key as u16 , cmd : id as u16 , } ) }
Convert a hotkey to an accelerator.
Convert a hotkey to an accelerator .
id
u32
key
&HotKey
id
u32
key
&HotKey