// Whether or not the given event should toggle fullscreen.
Whether or not the given event should toggle fullscreen.
Whether or not the given event should toggle fullscreen .
fn should_toggle_fullscreen(winit_event: &winit::WindowEvent) -> bool {
    let input = match *winit_event {
        winit::WindowEvent::KeyboardInput { ref input, .. } => match input.state {
            event::ElementState::Pressed => input,
            _ => return false,
        },
        _ => return false,
    };
    let key = match input.virtual_keycode {
        None => return false,
        Some(k) => k,
    };
    let mods = &input.modifiers;
    // On linux, check for the F11 key (with no modifiers down).
    //
    // TODO: Somehow add special case for KDE?
    if cfg!(target_os = "linux") {
        if !mods.logo && !mods.shift && !mods.alt && !mods.ctrl {
            if let Key::F11 = key {
                return true;
            }
        }
    // On macos and windows check for the logo key plus `f` with no other modifiers.
    } else if cfg!(target_os = "macos") || cfg!(target_os = "windows") {
        if mods.logo && !mods.shift && !mods.alt && !mods.ctrl {
            if let Key::F = key {
                return true;
            }
        }
    }
    false
}
fn should_toggle_fullscreen ( winit_event : & winit :: WindowEvent ) -> bool { let input = match * winit_event { winit :: WindowEvent :: KeyboardInput { ref input , .. } => match input . state { event :: ElementState :: Pressed => input , _ => return false , } , _ => return false , } ; let key = match input . virtual_keycode { None => return false , Some ( k ) => k , } ; let mods = & input . modifiers ; // On linux, check for the F11 key (with no modifiers down). // // TODO: Somehow add special case for KDE? if cfg ! ( target_os " " ) { if ! mods . logo && ! mods . shift && ! mods . alt && ! mods . ctrl { if let Key :: F11 = key { return true ; } } // On macos and windows check for the logo key plus `f` with no other modifiers. } else if cfg ! ( target_os " " ) || cfg ! ( target_os " " ) { if mods . logo && ! mods . shift && ! mods . alt && ! mods . ctrl { if let Key :: F = key { return true ; } } } false }
Whether or not the given event should toggle fullscreen.
Whether or not the given event should toggle fullscreen .
winit_event
&winit::WindowEvent